zanderchase / dagchain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dagchain

Quick Install

pip install dagchain

🤔 What is this?

This is a proof of concept repo for vectorstore loader orchestration Ⓒ. It combines LangChain with Dagster.

Run an example

We have created an example to show how to get started with this.

  1. Clone this repo
  2. Go into repository for examples cd examples
  3. Install dependencies: pip install -r requirements.txt
  4. Set OPENAI_API_KEY environment variable export OPENAI_API_KEY={YOUR_API_KEY}
  5. Run make ingest-local and navigate to http://127.0.0.1:3000/ to view the dag jobs you have created.See alternative storage options below.
  6. Run make run-local to interact with a langchain agent using the local vectorstore.

To edit ingest and run files you should only need to update the examples/{storage_type}/ingest.py and examples/{storage_type}/query.py files. Right now for local storage I have set up two dags that leverage common loading logic. To add a new loader run simply create new document loader and set it up in the examples/main.py file using dagchain. i. You can use any Langchain Document Loaders to load your own data.

Storage

Weaviate

To run with Weaviate Vector Database you will need to:

  1. Sign up for an account here: Weaviate
  2. Create a cluster with no auth, start the cluster, and get the url of the running instance (should look like: https://{your-endpoint-name}.weaviate.network/),and set environment variable export WEAVIATE_URL={YOUR_URL}
  3. Run make ingest-weaviate and navigate to http://127.0.0.1:3000/ to view the dag jobs you have created.
  4. Run make run-weaviate to interact with a langchain agent using the weaviate vectorstore.

Pinecone

To run with Pinecone Vector Database you will need to:

  1. Sign up for an account here: Pinecone
  2. Navigate to API Key page and set two environment variables export PINECONE_API_KEY={YOUR_API_KEY} and export PINECONE_ENVIRONMENT={YOUR_ENVIRONMENT}
  3. Run make ingest-pinecone and navigate to http://127.0.0.1:3000/ to view the dag jobs you have created.
  4. Run make run-pinecone to interact with a langchain agent using the pinecone vectorstore.

Future

This can be used to replace the manual run of ingest.sh in ChatLangChain to provide scheduled updates of vectorstores as well as handling and managing inputs from various sources.

Sample View

Screen Shot 2023-02-17 at 2 35 52 PM

Contributing Guide

To build package:

  1. Clean up any artifacts from before: rm -rf dist
  2. Build package: python -m build (will create dist folder)
  3. Upload package: twine upload dist/*

About

License:MIT License


Languages

Language:Python 99.5%Language:Makefile 0.5%