Turn Database Docs into Agent-Ready Knowledge (OKF Series, Part 3)
说明与用途
编译器将 LiveSQLBench 原始文档转换为 OKF,生成表和业务规则的概念文件,SQL 代理可以像浏览维基一样读取它们。
问题
An AI SQL agent needs more than a schema; it must understand business terms and rules that are documented in disparate formats, which are not directly usable by the agent.
结果
The compiler successfully transforms raw documentation into an OKF bundle for all 18 databases, enabling an SQL agent to read and query the knowledge as if browsing a wiki.
工作流
- Set up project layout with okf_compiler package and data/bundles folders
- Create docker-compose.yml to run the LiveSQLBench PostgreSQL image
- Start the container and verify the disaster_template database tables
- Implement readers.py to load the three raw files into Python objects
- Build concept.py to write individual concept files with frontmatter and body
- Generate tables.py to create a concept file per table
- Generate rules.py to create a concept file per business rule with links
- Write indexes.py to produce index files and a log
- Create cli.py to expose a single compile command
- Run the compiler on all 18 databases in the benchmark
证据
A compiler. A small Python package that reads a database's raw documentation and writes it as an OKF bundle: one concept file per table and per business rule, linked to each other, with an index file in each folder.
The agent reads the bundle the way you'd browse a wiki: the index first, then only the files the question needs.
We ask the same questions twice: once with the bundle, and once with all the raw documentation pasted into the prompt.
- 记录日期: 2026-10-03T05:40:50.509Z