Turingdb graph database adapter for cognee
Project description
Cognee Community TuringDB Graph Adapter
This is a community-maintained adapter that enables Cognee to work with TuringDB as a graph database.
Installation
pip install cognee-community-graph-adapter-turingdb
Usage
import asyncio
import os
import pathlib
from os import path
from cognee import config, prune, add, cognify, search, SearchType
# Import the register module to enable TuringDB support
from cognee_community_graph_adapter_turingdb import register
async def main():
# Set up local directories
system_path = pathlib.Path(__file__).parent
config.system_root_directory(path.join(system_path, ".cognee_system"))
config.data_root_directory(path.join(system_path, ".cognee_data"))
# Configure databases
config.set_relational_db_config({
"db_provider": "sqlite",
})
# Configure TuringDB as the graph database
config.set_graph_db_config({
"graph_database_provider": "turingdb",
"graph_database_url": os.getenv("GRAPH_DB_URL", "http://localhost:6666"),
})
# Optional: Clean previous data
await prune.prune_data()
await prune.prune_system(metadata=True)
# Add and process your content
await add("""
Natural language processing (NLP) is an interdisciplinary
subfield of computer science and information retrieval.
""")
await add("""
Sandwiches are best served toasted with cheese, ham, mayo,
lettuce, mustard, and salt & pepper.
""")
await cognify()
# Search using graph completion
query_text = "Tell me about NLP"
search_results = await search(
query_type=SearchType.GRAPH_COMPLETION,
query_text=query_text
)
for result in search_results:
print("\nSearch result: \n" + result)
if __name__ == "__main__":
asyncio.run(main())
Configuration
The TuringDB adapter can be configured as a graph database. The following configuration parameters are available:
Database Configuration:
graph_database_provider: Set to "turingdb"graph_database_url: Your TuringDB server url (default: "http://localhost:6666")
Environment Variables
Set the following environment variables or pass them directly in the config, or set the in the .env file:
export GRAPH_DB_URL="http://localhost:6666"
Alternative: You can also use the .env.template file from the main cognee repository. Copy it to your project directory, rename it to .env, and fill in your TuringDB configuration values.
Requirements
- Python >= 3.11, <= 3.13
- turingdb >= 1.22.0
- cognee >= 0.5.2
This adapter allows Cognee to leverage TuringDB's capabilities for advanced knowledge graph operations.
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 cognee_community_graph_adapter_turingdb-0.1.1.tar.gz.
File metadata
- Download URL: cognee_community_graph_adapter_turingdb-0.1.1.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.11.13 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50de53698e4c081d3209331247faf54b8994f29ed87767797a3b5c92713aa956
|
|
| MD5 |
75ef1b3129ed595b0e583cc975c15c8d
|
|
| BLAKE2b-256 |
a03e7e4c5525023f1e3b7662de0d9164576b387eed2c8a6c878767c1b3d770ba
|
File details
Details for the file cognee_community_graph_adapter_turingdb-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cognee_community_graph_adapter_turingdb-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.11.13 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dea00d6e28c763d789d1d5c04e2894c92285093fcb54a8dc772e936c9523df0b
|
|
| MD5 |
987b3d3288bcd7f8c8fb84421325f5dc
|
|
| BLAKE2b-256 |
468ec1c86159ab08d9d161219f4af30eb51c5d0c0b5c55d06546dd154da0e4e4
|