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.
- Install Gel's Python binding and this package
pip install gel langchain-gel- Initialize the project
Locally:
gel project initIn the cloud:
gel project init --server-instance <org-name>/<instance-name>
- Add necessary components to the schema. Gel uses explicit schema and migrations, which gives you more control and preserves data integrity.
langchain-gelexpects 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- Use
GelVectorStoreas usual. It's a drop-in replacement for any other vectorstore in the LangChain ecosystem.
from langchain_gel import GelVectorStore
vectorstore = GelVectorStore()When you are ready to migrate to Gel's native vector handling, check out Gel's documentation to find instructions.
