AgensGraph integration for LangChain graph and vector stores
Project description
🦜️🔗 LangChain AgensGraph
This plugin provides support for GraphStore and VectorStore integration in langchain, for persisting graphs directly in AgensGraph.
See the associated guide below:
📦 Installation
pip install -U langchain-agensgraph
💻 Usage
AgensGraph
The AgensGraph class provides functionality to interact with agensgraph as a graphstore in langchain.
from langchain_agensgraph.graphs.agensgraph import AgensGraph
conf = {
"dbname": "",
"user": "",
"password": "",
"host": "",
"port": ,
}
graph = AgensGraph(graph_name="", conf=conf)
graph.query("MATCH (n) RETURN n LIMIT 1;")
AgensgraphVector
The AgensgraphVector class provides functionality for managing an AgensGraph vector store.
It enables you to create new vector indexes, add vectors to existing indexes, and perform queries using vector indexes.
from langchain.docstore.document import Document
from langchain_openai import OpenAIEmbeddings
from langchain_agensgraph.vectorstores.agensgraph_vector import AgensgraphVector
# Create a vector store from some documents and embeddings
docs = [
Document(
page_content=(
"LangChain is a framework to build "
"with LLMs by chaining interoperable components."
),
)
]
embeddings = OpenAIEmbeddings(
model="text-embedding-3-large",
api_key="sk-...", # Replace with your OpenAI API key
)
db = AgensgraphVector.from_documents(
docs,
embeddings,
url="postgresql://username:password@host:port/dbname"
)
# Query the vector store for similar documents
docs_with_score = db.similarity_search_with_score("What is LangChain?", k=1)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_agensgraph-0.1.0.tar.gz.
File metadata
- Download URL: langchain_agensgraph-0.1.0.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/20.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ae266c05e23256565f8ea264262dde8325199e33ccea1e588200f1c4ab561ff
|
|
| MD5 |
5f38787508767bb284f5b6fda60681ad
|
|
| BLAKE2b-256 |
7289929234eaaddcba06d287b484294f88c9d2dbf4d6481e6a35f323962366c6
|
File details
Details for the file langchain_agensgraph-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_agensgraph-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/20.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06f6b8793ee8c4966e10eb1837f056c28a8e747bfbb022427fd591c32381d3d4
|
|
| MD5 |
6a2582b42fa87337f467221fa1646226
|
|
| BLAKE2b-256 |
c23580013688aa6c50324058d0d3b20041adfe9c86fbdf94e80bd2664ee03087
|