GitHub - geldata/langchain-gel: Gel integration package for the LangChain framework · GitHub
Skip to content

About

Gel integration package for the LangChain framework

Resources

Stars

1 star

Watchers

7 watching

Forks

Repository files navigation

langchain-gel

This package enables LangChain to interact with Gel as a vectorstore. See LangChain's documentation to learn more about how to take advantage of that.

Note: check out Gel's AI extension to learn how to automate embedding management away while taking advantage of poweful schema and EdgeQL query language.

Usage

  1. Install Gel's Python binding and this package
pip install gel langchain-gel
  1. Initialize the project

Locally:

gel project init

In the cloud:

gel project init --server-instance <org-name>/<instance-name>
  1. Add necessary components to the schema. Gel uses explicit schema and migrations, which gives you more control and preserves data integrity. langchain-gel expects the following schema:
using extension pgvector;
                                    
module default {
    scalar type EmbeddingVector extending ext::pgvector::vector<1536>;

    type Record {
        required collection: str;
        text: str;
        embedding: EmbeddingVector;
        external_id: str {
            constraint exclusive;
        };
        metadata: json;

        index ext::pgvector::hnsw_cosine(m := 16, ef_construction := 128)
            on (.embedding)
    } 
}

Copy-paste this to dbschema/default.gel and run a migration:

gel migration create \
&& gel migrate
  1. Use GelVectorStore as usual. It's a drop-in replacement for any other vectorstore in the LangChain ecosystem.
from langchain_gel import GelVectorStore

vectorstore = GelVectorStore()

Next steps

When you are ready to migrate to Gel's native vector handling, check out Gel's documentation to find instructions.

About

Gel integration package for the LangChain framework

Resources

Stars

1 star

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages