Skip to main content

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.

Metadata

Release files for cognee-community-graph-adapter-turingdb 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cognee-community-graph-adapter-turingdb 0.2.0
File Size Uploaded Provenance
cognee_community_graph_adapter_turingdb-0.2.0.tar.gz 342.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cognee-community-graph-adapter-turingdb 0.2.0
File Interpreter ABI Platform
cognee_community_graph_adapter_turingdb-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 352.4 kB

Release files / cognee_community_graph_adapter_turingdb-0.2.0.tar.gz

Download URL cognee_community_graph_adapter_turingdb-0.2.0.tar.gz
Size 342.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5fc19252bedb288c40b6a2a4be605911fb88dcc576513ce0e4fb8f42d9261934
BLAKE2b-256 checksum
How to use checksums
3ac6a250c1f0cc8658210130d0f644223dcf695b60a49892b504a7f66801f521
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.10.18 Darwin/24.1.0

Release files / cognee_community_graph_adapter_turingdb-0.2.0-py3-none-any.whl

Download URL cognee_community_graph_adapter_turingdb-0.2.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e54c131e7cd563d9a825980d574b65912016b5729fc54664fc42dbcb66706e99
BLAKE2b-256 checksum
How to use checksums
7d9bde5c233363b06bc377cc47d33c8f8849b1ecefea5a1afd52556093ddb930
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.10.18 Darwin/24.1.0

Security for cognee-community-graph-adapter-turingdb 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page