Skip to main content

Semantic context for your LLMs — generated automatically

Project description

official project PyPI version License

Databao Context Engine

Semantic context for your LLMs — generated automatically.
No more copying schemas. No manual documentation. Just accurate answers.

WebsiteQuickstartData SourcesContributing


What is Databao Context Engine?

Databao Context Engine is a Python library that automatically generates governed semantic context from your databases, BI tools, documents, and spreadsheets.

Use it with any LLM to deliver accurate, context-aware answers — without copying schemas or writing documentation by hand.

You can add Databao Context Engine as a standard Python dependency in your code or via Databao CLI (coming soon).

Your data sources → Context Engine → Unified semantic graph → Any LLM

Why choose Databao Context Engine?

Feature What it means for you
Auto-generated context Extracts schemas, relationships, and semantics automatically
Runs locally Your data never leaves your environment
MCP integration Works with Claude Desktop, Cursor, and any MCP-compatible tool
Multiple sources Databases, dbt projects, spreadsheets, documents
Built-in benchmarks Measure and improve context quality over time
LLM agnostic OpenAI, Anthropic, Ollama, Gemini — use any model
Governed & versioned Track, version, and share context across your team
Dynamic or static Serve context via MCP server or export as artifact

Installation

Databao Context Engine is available on PyPI and can be installed with uv, pip, or another package manager.

Using uv

uv add databao-context-engine

Using pip

pip install databao-context-engine

Supported data sources

  • Athena
  • BigQuery
  • ClickHouse
  • DuckDB
  • MSSQL
  • MySQL
  • PostgreSQL
  • Snowflake
  • SQLite
  • dbt projects
  • PDF files
  • Markdown and text files

Supported LLMs

Provider Configuration
Ollama languageModel: OLLAMA: runs locally, free

Quickstart

1. Create a domain

# Initialize the domain in an existing directory
from databao_context_engine import init_dce_domain

domain_manager = init_dce_domain(Path(tempfile.mkdtemp()))

# Or use an existing project
from databao_context_engine import DatabaoContextDomainManager

domain_manager = DatabaoContextDomainManager(domain_dir=Path("path/to/project"))

2. Configure data sources

from databao_context_engine import (
    DatasourceConnectionStatus,
    DatasourceType,
)

# Create a new datasource
postgres_datasource_id = domain_manager.create_datasource_config(
    DatasourceType(full_type="postgres"),
    datasource_name="my_postgres_datasource",
    config_content={
        "connection": {"host": "localhost", "user": "dev", "password": "pass"}
    },
).datasource.id

# Check the connection to the datasource is valid
check_result = domain_manager.check_datasource_connection()

assert len(check_result) == 1
assert check_result[0].datasource_id == postgres_datasource_id
assert check_result[0].connection_status == DatasourceConnectionStatus.VALID

3. Build context

build_result = domain_manager.build_context()

assert len(build_result) == 1
assert build_result[0].datasource_id == postgres_datasource_id
assert build_result[0].datasource_type == DatasourceType(full_type="postgres")
assert build_result[0].context_file_path.is_file()

4. Use the built contexts

Create a context engine

# Switch to the engine if you're already using a domain_manager
context_engine = domain_manager.get_engine_for_domain()

# Or directly create a context engine from the path to your DCE domaint
from databao_context_engine import DatabaoContextEngine

context_engine = DatabaoContextEngine(domain_dir=Path("path/to/project"))

Get all built contexts

# Switch to the engine to use the context built
all_built_contexts = context_engine.get_all_contexts()
assert len(all_built_contexts) == 1
assert all_built_contexts[0].datasource_id == postgres_datasource_id

print(all_built_contexts[0].context)

Search in built contexts

# Run a vector similarity search
results = context_engine.search_context("my search query")

print(f"Found {len(results)} results for query")
print(
    "\n\n".join(
        [f"{str(result.datasource_id)}\n{result.context_result}" for result in results]
    )
)

Contributing

We’d love your help! Here’s how to get involved:

  • Star this repo — it helps others find us!
  • 🐛 Found a bug? Open an issue
  • 💡 Have an idea? We’re all ears — create a feature request
  • 👍 Upvote issues you care about — helps us prioritize
  • 🔧 Submit a PR
  • 📝 Improve docs — typos, examples, tutorials — everything helps!

New to open source? No worries! We're friendly and happy to help you get started. 🌱

For more details, see CONTRIBUTING.

📄 License

Apache 2.0 — use it however you want. See the LICENSE file for details.


Like Databao Context Engine? Give us a ⭐ — it means a lot!

WebsiteDiscord

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

databao_context_engine-0.7.0.tar.gz (124.2 kB view details)

Uploaded Source

Built Distribution

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

databao_context_engine-0.7.0-py3-none-any.whl (195.8 kB view details)

Uploaded Python 3

File details

Details for the file databao_context_engine-0.7.0.tar.gz.

File metadata

File hashes

Hashes for databao_context_engine-0.7.0.tar.gz
Algorithm Hash digest
SHA256 447e7c1cf6bbe899a125296e2362838cc7e5bd4770cb1d9bf682c9c12bac20aa
MD5 92a6f716f6cbda45a2d473bdd85c0543
BLAKE2b-256 c472040aa0c0c1fa2302bc350ae0dc18cd82dadad9bcab1b23d2bb2b0491b6a8

See more details on using hashes here.

File details

Details for the file databao_context_engine-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for databao_context_engine-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4521c63980e87a9906e890424244e672a0bdc953d13c9e484152dd2a8612fd5
MD5 19206202c4b42ad8850906199b6ee22c
BLAKE2b-256 27fda271eac8b1486f41a4d40b89aa7212f8f1581b9c97b00e9b60b35ca5a32c

See more details on using hashes here.

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