Registry / llm-agents / ragstack-ai-knowledge-store

ragstack-ai-knowledge-store

JSON →
library0.2.1pypiunverified

ragstack-ai-knowledge-store is a component of the DataStax RAGStack AI ecosystem, focusing on graph-based knowledge storage and retrieval. It allows users to build and query knowledge graphs backed by Astra DB, DataStax's cloud-native database. The current version is 0.2.1. While the main `ragstack-ai` project has frequent releases, this sub-package's versioning may not always align directly with the primary project's major versions.

pip install ragstack-ai-knowledge-store
INSTALL
IMPORT
SIG · RAGSTACK-AI-KNOWLE
R
ragstack-ai-knowledge-store
llm-agentsenv0.2.1
Install
5.2s avg
Import
Disk
126MB
Pass rate
6/ 10
Env Coverage6 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 5.6s
py 3.11
✕ build_error
✓ 5.15s
py 3.12
✕ build_error
✓ 4.7s
py 3.13
✕ build_error
✓ 5.15s
py 3.9
✓ —
✓ 5.45s
126MB installed
● package 126MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AstraDBKnowledgeStore
from ragstack_ai.knowledge_store import AstraDBKnowledgeStore
This is the primary class for interacting with a graph knowledge store in Astra DB.

This quickstart demonstrates how to initialize `AstraDBKnowledgeStore` and add `langchain_core.documents.Document` objects to it. It requires an active Astra DB instance and valid credentials. The `graph_name` parameter identifies your specific knowledge graph within Astra DB.

import os from ragstack_ai.knowledge_store import AstraDBKnowledgeStore from langchain_core.documents import Document # Ensure Astra DB credentials are set as environment variables # ASTRA_DB_APPLICATION_TOKEN, ASTRA_DB_ID, ASTRA_DB_KEYSPACE (optional, defaults to 'default') astra_db_token = os.environ.get("ASTRA_DB_APPLICATION_TOKEN", "YOUR_ASTRA_DB_TOKEN") astra_db_id = os.environ.get("ASTRA_DB_ID", "YOUR_ASTRA_DB_ID") astra_db_keyspace = os.environ.get("ASTRA_DB_KEYSPACE", "default") if not all([astra_db_token, astra_db_id]): print("Please set ASTRA_DB_APPLICATION_TOKEN and ASTRA_DB_ID environment variables.") exit() try: # Initialize the Knowledge Store kg_store = AstraDBKnowledgeStore( astra_db_id=astra_db_id, astra_db_application_token=astra_db_token, astra_db_keyspace=astra_db_keyspace, graph_name="my_rag_knowledge_graph" # A unique name for your graph ) # Add documents to the knowledge store documents = [ Document(page_content="Leonardo da Vinci was an Italian polymath.", metadata={"source": "wiki"}), Document(page_content="The Mona Lisa is a half-length portrait painting by Leonardo da Vinci.", metadata={"source": "wiki"}) ] print("Adding documents...") kg_store.add_documents(documents=documents) print("Documents added successfully.") # Example: Simple graph traversal (conceptual, actual queries depend on graph structure) # Note: Complex graph queries typically use specific methods or a dedicated graph query engine. # This demonstrates basic interaction. print(f"Knowledge Store initialized for graph: {kg_store.graph_name}") except Exception as e: print(f"An error occurred: {e}") print("Ensure your Astra DB credentials are correct and the database is accessible.")
Debug
Known issues
gotchaThe PyPI version of `ragstack-ai-knowledge-store` (e.g., 0.2.1) might be significantly lower than the overall `ragstack-ai` project's GitHub release versions (e.g., 1.x.x). This can lead to confusion or dependency conflicts if not managed carefully.
fix
Always check the specific PyPI page for `ragstack-ai-knowledge-store` for its correct version and dependencies. Do not assume it is locked to the main `ragstack-ai` project's version.
affects: <1.0.0
breakingThis library is tightly coupled with DataStax Astra DB. It does not provide a local or in-memory graph store option. An active Astra DB instance and valid application token/database ID are mandatory for operation.
fix
Ensure you have an Astra DB account, a database provisioned, and generate an Application Token. Set `ASTRA_DB_APPLICATION_TOKEN` and `ASTRA_DB_ID` as environment variables or pass them directly to the `AstraDBKnowledgeStore` constructor.
affects: All versions
gotchaWhile part of the RAGStack ecosystem, `ragstack-ai-knowledge-store` specifically deals with graph data. Its query interface and interaction patterns are different from generic vector stores. Integrating it directly into LangChain or LlamaIndex RAG chains might require specific RAGStack connectors (e.g., `ragstack-ai-langchain`).
fix
Familiarize yourself with graph database concepts and the specific methods provided by `AstraDBKnowledgeStore` for adding and retrieving graph-structured data. For full LangChain/LlamaIndex integration, consult the documentation for `ragstack-ai-langchain` or `ragstack-ai-llamaindex`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'ragstack_ai.knowledge_store'
The `ragstack-ai-knowledge-store` package is not installed or there's a typo in the import path.
fix
Run `pip install ragstack-ai-knowledge-store` to install the package. Double-check the import statement: `from ragstack_ai.knowledge_store import AstraDBKnowledgeStore`.
astrapy.exceptions.DevOpsAPIException: No database with ID '...' found
The provided `ASTRA_DB_ID` or `ASTRA_DB_APPLICATION_TOKEN` is incorrect or the database does not exist/is not accessible.
fix
Verify your Astra DB ID and Application Token. Ensure they are correctly set as environment variables or passed to the `AstraDBKnowledgeStore` constructor. Check your Astra DB dashboard for the correct ID and ensure the token has sufficient permissions.
TypeError: add_documents() missing 1 required positional argument: 'documents'
The `add_documents` method expects an iterable (e.g., a list) of `Document` objects, but it received a single `Document` or an incorrect type.
fix
Always pass a list of `Document` objects to `add_documents`, even if it's a list containing only one document: `kg_store.add_documents(documents=[Document(...)])`.
Upgrade
Version history
0.2.1latest on PyPI · released Jul 30, 2024
Audit
Dependencies
ragstack-ai-datastax-langchain-corerequiredRequired for core functionalities and document handling, provides base interfaces.
pydanticrequiredUsed for data validation and settings management within the library.
ragstack-aioptionalThe umbrella RAGStack library, often implicitly or explicitly required for a full RAGStack setup.
Agent activity
53 hits · last 30 days
node
44
OpenAI (training)
1
Resources
ragstack-ai-knowledge-store — pip install ragstack-ai-knowledge-store · libregistry