项目 / NVIDIA/auto-ontology

NVIDIA/auto-ontology

暂无行业标签
语言 Python标签 —数据更新 2026-11-25 06:49:28 · 仓库 2026-11-24

一段话介绍

英伟达出的知识图谱框架,帮 AI 把数据连成网

本站整理,非 GitHub 官方 description。

官方 description(GitHub API 原样)
Auto Ontology is a Python framework for building semantic, graph-based reasoning layers over data. It enables deterministic query generation, better context retrieval, and more explainable AI for LLM and agent workflows.
12,534累计星
1,026Fork
+10,159峰值日增
8上榜次数

官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。

行业与场景 — 暂未挂到行业场景库

更多信息

以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。

我的用法
安装或使用说明见 https://build.nvidia.com。
特点或设计要点
- **Natural-language querying** of structured data — questions are translated to
SQL and executed against connected databases, powered by NVIDIA NIM.
- **Semantic catalog / ontology layer** over relational sources, stored in
Postgres alongside the catalog it describes.
- **Authentication & RBAC** —using [Better Auth](https://github.com/better-auth/better-auth).
- **Web UI** for chat, analysis, data catalog, analytics, and settings.
- **Flexible deployment** — Helm chart for Kubernetes or Docker Compose for a
local stack.
星标走势近 18 天
本站点评(非项目 README 原文)
让 AI 不只记零散信息,而是像人一样把知识点串成关系网,查资料时更能举一反三,做知识库类应用的趁手工具。
首次发现 2026-11-06 · 最近在榜 2026-11-14 · 语言 Python · 贡献者 DinaLaptii、yuvalshkolar、liavnave、liofnv、tomer-levin-nv
agentimagellmsdk

GitHub 项目主页介绍

来自 GitHub 仓库 README / 主页介绍正文,正文较长,已截断:保留前 20000 字符(原始 25,873 字节),完整内容见 GitHub 仓库。

<!--
SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES.
All rights reserved.
SPDX-License-Identifier: Apache-2.0
-->

# Auto Ontology

[![#1 on the BEAVER leaderboard](https://img.shields.io/badge/BEAVER_leaderboard-%231-76b900)](https://beaverbench.github.io/#leaderboard)
[![#1 on the BIRD-Interact leaderboard](https://img.shields.io/badge/BIRD--Interact_leaderboard-%231-76b900)](https://bird-interact.github.io/)

Agents can retrieve documents and query databases, but reliability gates agentic analytics: a revenue metric answered faster is worth nothing if the number is wrong. Agents need context to answer accurately: what each business concept means, where it lives, how it connects, how to calculate it, where it comes from, and whether to trust it. An ontology holds that context: a shared, governed map from the concepts people ask about to the data behind them. NVIDIA Auto Ontology is an open library that builds that ontology automatically from enterprise metadata, reconciles definitions across systems, and exposes it to any agent harness through MCP, CLI, and API. It complements the semantic models customers already own, and [Apache Ossie](https://ossie.apache.org/) keeps it portable.

Auto Ontology leads on the [BIRD-Interact](https://bird-interact.github.io/) and [BEAVER](https://beaverbench.github.io/#leaderboard) benchmarks, which test the accuracy of text-to-SQL analytics question answering in interactive flows with ambiguous user inputs and on large-scale, messy databases.

It enables developers to:

- **Discover:** generate enterprise ontologies from metadata; connect existing ontologies and semantic models; build AI-ready knowledge graphs.
- **Ground:** give agents trusted business meaning for metrics, entities, and relationships; reconcile inconsistent definitions across systems.
- **Validate:** test a draft with real questions before experts certify it; check generated queries against the catalog and the definitions retrieval surfaced; return the SQL and steps with every answer.
- **Expose:** serve context to any agent harness through MCP, CLI, and API.
- **Learn:** fold certified corrections and usage back into the ontology, so shared context improves with use.

An ontology matters most when:

- questions are varied, open-ended, and ambiguous;
- data spans many disparate sources with overlapping or conflicting
  definitions;
- meanings must be reused and governed across runs, teams, and agents;
- the model or its context budget can't hold the full documentation;
- users ask in business terms and need routing to the right source and grain.

With one well-modeled source and a fixed set of questions, direct SQL may be
enough.

## Quickstart

This runs Auto Ontology with Docker Compose against Wide World Importers,
Microsoft's sample sales database. You need Docker with Compose v2,
[uv](https://docs.astral.sh/uv/), and an NVIDIA API key (`nvapi-...`) from
[build.nvidia.com](https://build.nvidia.com).

1. Clone the repository and create `.env`:

   ```bash
   git clone https://github.com/NVIDIA/auto-ontology.git && cd auto-ontology
   cp .env.example .env
   ```

   Then set these values in `.env`:

   ```dotenv
   DEFAULT_MODELS_API_KEY=nvapi-...
   AUTH_SECRET=<a long random string, e.g. from openssl rand -base64 32>
   APP_URL=http://localhost:3000
   POSTGRES_PASSWORD=<a new password>
   CONNECTION_STRINGS=postgresql://postgres:<the same password>@postgres:5432/wideworldimporters
   AUTO_ONTOLOGY_ADMIN_PASSWORD=<a new password>
   PGADMIN_PASSWORD=<a new password>
   ```

   Compose publishes Postgres, pgAdmin, and the web app on the host, so replace
   each default password before you start it. `.env.example` also sets an API
   key per model role: replace each `nvapi-your-api-key-here` with your key, or
   delete those lines so they fall back to `DEFAULT_MODELS_API_KEY`.

2. Start Postgres and load the sample database. The seed script lives in
   auto-ontology-eval; pass it the Postgres password you set:

   ```bash
   docker compose up -d --wait postgres
   git clone https://github.com/NVIDIA/auto-ontology-eval.git ../auto-ontology-eval
   (cd ../auto-ontology-eval && uv sync && cp .env.example .env && \
     POSTGRES_PASSWORD='<the same password>' \
     uv run python scripts/seed/seed_wwi.py --database-name wideworldimporters --drop)
   ```

3. Build and start the rest of the stack:

   ```bash
   docker compose up -d --build
   ```

4. Open <http://localhost:3000> and sign in with `AUTO_ONTOLOGY_ADMIN_EMAIL` and
   `AUTO_ONTOLOGY_ADMIN_PASSWORD` from `.env`. Go to **Settings → Semantic
   Compilation** and turn it on. Ingestion runs at startup; compilation starts
   immediately and reports **Semantic compilation is ready** when it finishes.

5. Ask a question in **Chat**:

   > What was revenue for the USB food flash drive - sushi roll in Pennsylvania
   > in June 2015?

   The agent resolves *revenue*, *product*, and *state* to terms in the
   ontology, follows their relationships to the joins it needs, and runs the
   query. The answer comes back with its SQL and the steps that produced it,
   so you can check the result against the source:

   ```text
   Answer:  Revenue for USB food flash drive - sushi roll in Pennsylvania in
            June 2015 was $588.80, from 3 invoice lines.

   SQL:     SELECT SUM(il.extendedprice) AS revenue, COUNT(*) AS invoice_lines
            FROM sales.invoicelines il
            JOIN sales.invoices i             ON il.invoiceid = i.invoiceid
            JOIN warehouse.stockitems si      ON il.stockitemid = si.stockitemid
            JOIN sales.customers c            ON i.customerid = c.customerid
            JOIN application.cities ct        ON c.deliverycityid = ct.cityid
            JOIN application.stateprovinces sp ON ct.stateprovinceid = sp.stateprovinceid
            WHERE si.stockitemname = 'USB food flash drive - sushi roll'
              AND sp.stateprovincename = 'Pennsylvania'
              AND i.invoicedate >= '2015-06-01' AND i.invoicedate < '2015-07-01'

   Steps:   Resolved terms: Invoice Line (revenue), Stock Item, State Province, Invoice
            Joined: invoice line -> invoice -> customer -> city -> state province
            Validated the filter values against the data, then executed
   ```

6. Ask something the data can't answer. Wide World Importers has no
   advertising data, so a question about ad spend has nothing to resolve
   against. An agent connected through [MCP](#mcp-server) checks answerability
   first and asks you to clarify:

   ```text
   You:    What was return on ad spend for the sushi roll flash drive in June 2015?
   Agent:  check_answerable -> coverage 0.5; no term covers "ad spend"
   Agent:  I can find revenue for that product, but this data has no
           advertising spend, so I can't compute return on ad spend. Do you
           want June 2015 revenue instead, or is ad spend tracked in another
           source I should connect?
   ```

If the UI loads without its left navigation after a restart, the browser is
holding a stale session cookie. Clear site data for `localhost:3000` and sign in
again. For other setup failures, see the
[setup skill's troubleshooting guide](./skills/nvidia-ontology-setup/references/troubleshooting.md).

## How it works

Auto Ontology works in two stages: it generates an ontology that people
certify, and the agent answers questions from it.

The ontology answers six questions, each with its own element:

| Question                 | Element       | In Auto Ontology                                                                                                 |
| ------------------------ | ------------- | ---------------------------------------------------------------------------------------------------------------- |
| What does it mean?       | Concept       | A term, such as *Customer* or *Invoice Line*, with a description and synonyms                                    |
| Where is it?             | Mapping       | Column attributes tie each term to the tables and columns that hold it                                           |
| What's connected?        | Relationship  | Joins between tables, including bridge tables: declared keys, plus inferred links confirmed against the data     |
| How do I calculate it?   | Metric        | SQL attributes: reviewed SQL under a term, such as a margin, reused so answers compute each measure the same way |
| Where does it come from? | Lineage       | Each term and attribute links to its source tables and columns, and each answer returns its SQL                  |
| Should I use it?         | Certification | Experts certify names, descriptions, and attributes, and certified elements are marked as reviewed               |

**Generate:** the ingestion service builds a first draft from the source
databases, and people refine it. Semantic compilation starts once you turn it
on in **Settings → Semantic Compilation**.

- **Catalog ingest:** read tables, columns, keys, views, and query history; tag
  PII if you turn on PII detection; embed tables and columns in pgvector.
- **Per table:** profile values with SQL. A model finds foreign key candidates
  and junction tables, writes column descriptions, and names the terms.
- **Across tables:** group copies of a schema into term families, and link
  foreign keys to the terms they reference, keeping an inferred link only when
  the data confirms it. A model attaches foreign key columns left unlinked,
  suggests SQL attributes from query history and for bridge tables, and
  describes each column attribute.
- **Output:** the ontology in Postgres with embeddings in pgvector, which you
  can import or export as Ossie YAML.
- **Certify:** test the draft with real questions in Chat, or with
  `check_answerable` and `ask_question` over MCP. Refine terms, descriptions,
  and SQL attributes in the UI or through the API, and certify them once
  they're correct. Edits are re-embedded right away, and the next compilation
  keeps them, except which semantic foreign key each join uses, which every
  compilation re-selects.

The [Generate tool flow](./docs/architecture.md#generate-an-ontology) shows
which steps call a model and which are SQL or rules.

The result is a semantic graph you can explore in the UI. In this example, one
compilation of Wide World Importers produced 31 terms; selecting **Order** shows
its description, related terms, mapped columns, and SQL attributes:

<p>
<img src="./docs/assets/ontology-graph.png" alt="Semantic graph of the Wide World Importers ontology, with the Order term selected" width="800">
</p>

**Answer:** the reasoning model answers each question in a loop, choosing one
tool at a time:

- **`retrieve`:** search the semantic layer by meaning and by name for business
  concepts, column meanings, and named calculations. Results come back as
  tables and columns with their descriptions and stored values, definitions
  with their SQL, and join paths. The model searches again whenever something
  is missing.
- **`run_sql`:** look at stored values or test a draft. Before the query runs,
  table and column names are checked against the catalog, and tables against
  what `retrieve` showed.
- **`submit`:** give the final query and an explanation. The query is checked
  and run, and an error goes back to the model to fix. A question about the
  data itself, such as which tables exist or what a term means, is answered in
  words: `retrieve` looks it up with `purpose=information`, and `submit` returns
  the answer without SQL.
- **Result:** the answer comes back with its SQL and the steps it took, and a
  chart in Chat.

No tool calls a language model except `predict`, which answers predictive
questions when `KUMO_RFM_API_URL` is set; see [Predictions](#predictions). If
the model reaches its tool-call limit without an accepted query, the agent
reports that the question can't be answered from this data. The
[Answer tool flow](./docs/architecture.md#answer-a-question) shows the loop,
its tools, and its limits.

In Chat, each answer shows its SQL, and you can view the rows, download them as
CSV, or read them as a chart:

<p>
<img src="./docs/assets/qa-example.png" alt="Chat answering which products drive the most revenue and highest customer count, with the generated SQL and a revenue chart" width="550">
</p>

Auto Ontology is compatible with [Apache Ossie](https://ossie.apache.org/), the
open standard for exchanging semantic models. Ossie includes a
[converter for Auto Ontology](https://github.com/apache/ossie-converters/tree/main/nvidia),
which Auto Ontology uses to import and export model definitions as Ossie YAML.
Use **Settings → Import / Export**, or `POST /api/model/import` and
`POST /api/model/export`.

The services behind both stages, and how clients reach them:

```mermaid
flowchart LR
  subgraph clients["Clients"]
    direction TB
    ui["Browser: web UI"]
    rest["Scripts: REST API with API tokens"]
    mcpc["MCP clients: Cursor, Claude Desktop, agents"]
  end
  mcp["MCP server: read-only tools (FastMCP, port 3003)"]
  fe["Web app, auth, API gateway (Next.js, port 3000)"]
  subgraph private["Private network"]
    direction TB
    be["Backend: text-to-SQL agent, catalog and ontology APIs (FastAPI, port 3001)"]
    ing["Ingestion and semantic compilation (FastAPI, port 3002)"]
    pg[("Postgres + pgvector: app data, catalog, ontology, embeddings")]
  end
  src[("Source databases: 10 connectors")]
  models["Model endpoints: NVIDIA NIM or OpenAI-compatible (reasoning, non-reasoning, embed, rerank)"]
  vault["Vault (optional): connection credentials"]
  kumo["KumoRFM (optional): predictions"]
  ui --> fe
  rest --> fe
  mcpc --> mcp
  mcp -- "public API" --> fe
  fe --> be
  fe -- "users, sessions, settings" --> pg
  be -- "trigger ingest and compile" --> ing
  be --> pg
  ing --> pg
  be -- "run SQL" --> src
  ing -- "read schema, sample values" --> src
  be --> models
  ing --> models
  be -.-> vault
  ing -.-> vault
  be -.-> kumo
```

| Component           | Technology                        | Role                                                                                 | Port |
| ------------------- | --------------------------------- | ------------------------------------------------------------------------------------ | ---- |
| Frontend            | Next.js, Better Auth, Prisma      | Web UI for chat, catalog, analytics, and settings; auth and RBAC; public API gateway | 3000 |
| Backend             | FastAPI (Python 3.12+), LangChain | Text-to-SQL agent, catalog, ontology APIs                                            | 3001 |
| Ingestion service   | FastAPI (Python 3.12+)            | Ingestion and semantic compilation                                                   | 3002 |
| MCP server          | FastMCP                           | Read-only agent tools over the public API                                            | 3003 |
| Postgres + pgvector | PostgreSQL 17                     | Catalog, ontology, app data, vector store                                            | 5432 |
| HashiCorp Vault     | Optional                          | Connection credential storage                                                        | n/a  |

Browser and API clients go through the web app on port 3000, and MCP clients
through the MCP server on port 3003, which calls the same public API. Keep
ports 3001 and 3002 on a private network: FastAPI trusts the user identity the
frontend forwards in the `x-auto-ontology-user-id` header, and the ingestion
service's endpoints (ingest, delete, reset, compile) have no authentication of
their own.

Full pipeline detail, with tool-flow diagrams for generating an ontology and
answering a question: [docs/architecture.md](./docs/architecture.md).

## Use it from your agent

### MCP server

The [MCP](https://modelcontextprotocol.io) server gives any MCP client read-only
tools over the ontology. Each user signs in through Auto Ontology, and every
call runs with that user's permissions.

| Job           | Tools                                                         |
| ------------- | ------------------------------------------------------------- |
| Readiness     | `check_readiness`: can this deployment answer anything at all |
| Terms         | `search_terms`, `get_term`, `get_term_columns`, `get_term_sql_attributes`, `get_sql_attribute`, `describe_table` |
| Answerability | `check_answerable`: does the ontology cover this question     |
| Questions     | `ask_question`: the answer, the SQL, and the rows             |

Run the server against your deployment:

```bash
AUTO_ONTOLOGY_API_URL=http://localhost:3000 \
  uvx --from "git+https://github.com/NVIDIA/auto-ontology.git#subdirectory=mcp" auto-ontology-mcp
```

Cursor (`~/.cursor/mcp.json`):

```json
{
  "mcpServers": {
    "auto-ontology": { "url": "http://localhost:3003/mcp" }
  }
}
```

Claude Desktop (`claude_desktop_config.json`), bridged with
[`mcp-remote`](https://www.npmjs.com/package/mcp-remote):

```json
{
  "mcpServers": {
    "auto-ontology": {
      "command": "npx",
      "args": ["mcp-remote", "http://localhost:3003/mcp"]
    }
  }
}
```

Restart the client after editing its config, then sign in when it prompts.
Sign-in, configuration, and troubleshooting are in [docs/mcp.md](./docs/mcp.md).

### Agent skills

Three skills teach a coding agent to work with Auto Ontology. Start at
[AGENTS.md](./AGENTS.md).

| Skill                                                                | Covers                                               |
| -------------------------------------------------------------------- | ---------------------------------------------------- |
| [`nvidia-ontology-setup`](./skills/nvidia-ontology-setup/)           | Install, connect sources, compile, prove readiness   |
| [`nvidia-ontology-management`](./skills/nvidia-ontology-management/) | Inspect, model, certify, import/export, and publish  |
| [`nvidia-ontology-query`](./skills/nvidia-ontology-query/)           | Ask questions and validate the SQL, rows, and answer |

### REST API

Ask a question with `POST /api/chat/completions` on the web app's origin. Mint
an API token under the user menu → **API Tokens**. The response is a
server-sent event stream: a `result` event carries the answer, and
`data: [DONE]` ends the stream.

```bash
curl -N http://localhost:3000/api/chat/completions \
  -H "x-api-key: $AUTO_ONTOLOGY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"question": "How many orders shipped last week?"}'
```

```python
import json
import os

import requests

response = requests.post(
    "http://localhost:3000/api/chat/completions",
    headers={"x-api-key": os.environ["AUTO_ONTOLOGY_API_TOKEN"]},
    json={"question": "How many orders shipped last week?"},
    stream=True,
    timeout=900,
)
response.raise_for_status()

for line in response.iter_lines(decode_unicode=True):
    if not line or not line.startswith("data:"):
        continue
    payload = line.removeprefix("data:").strip()
    if payload == "[DONE]":
        break
    event = json.loads(payload)
    if event["type"] == "result":
        print(event["answer"]["response"])
        print(event["answer"]["sql_code"])
    elif event["type"] == "error":
        raise RuntimeError(event["message"])
```

Event types, multi-turn conversations, and the gateway trust boundary are in
[docs/conversation-api.md](./docs/conversation-api.md). Every other operation is
in the [OpenAPI spec](./docs/openapi/auto-ontology-api.json).

## Connectors, models, and predictions

### Sources

Auto Ontology connects to eleven engines:

- PostgreSQL
- MySQL
- Databricks
- Snowflake
- ClickHouse
- Trino
- Google BigQuery
- Apache Kyuubi
- HeavyDB
- DuckDB
- SQLite

Add connections under **Settings → Connections**, or list them in
`CONNECTION_STRINGS`. DuckDB and SQLite are connection-string only. See
[docs/connections.md](./docs/connections.md) f
↑