Skip to main content

Gel integration package for the LangChain framework

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_gel-1.0.1.tar.gz (86.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_gel-1.0.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file langchain_gel-1.0.1.tar.gz.

File metadata

  • Download URL: langchain_gel-1.0.1.tar.gz
  • Upload date:
  • Size: 86.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for langchain_gel-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5a032f0fb8edbcc0c6edf70cf8095238f94b4486e969d85a8855b452fc2a0d5d
MD5 e3f142dd0a86310c3d2630305f4b3c6c
BLAKE2b-256 54d00ebabde6efca52c71afabc548cedffbce92756adf0b0980b4e5a8bf2e51a

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_gel-1.0.1.tar.gz:

Publisher: publish.yml on geldata/langchain-gel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_gel-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: langchain_gel-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for langchain_gel-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7e9bb027fa30d40400e189c9bea08bb4f8528f3f9144a525abf0f6bedeb197ea
MD5 4fc0036c71f54b77f9fa02b08e57da35
BLAKE2b-256 6eb927e65aa928fb7da7ecf457a50a1edf5c0ad1b4a37d0f64438289be201e55

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_gel-1.0.1-py3-none-any.whl:

Publisher: publish.yml on geldata/langchain-gel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page