GGitHub采集材料
OrionBelt:用语义层约束AI查询
发布时间未知 · 北京时间
智能体应用
有实践材料可继续查看
代码仓库安装说明使用说明示例代码
原文与观测指标
1 个来源GGitHub
查看原文 OrionBelt:用语义层约束AI查询
ralforion星标101采集时的累计值
每小时增长待观察星标 / 小时 · 观测区间平均值
最近提交10-27 15:26提交时间不是项目发布时间
发布时间:未知 · 首次发现 10-27 15:47 · 北京时间
指标采集:10-27 15:47 · 指标已取得
项目文档有线索安装说明有线索使用说明有线索示例有线索
仅反映文档与示例线索,未实际运行项目。
摘要
OrionBelt通过YAML定义指标、维度和表关系,再编译为数据库方言SQL,帮助智能体和BI工具查询数据,并阻止可能导致重复计数的多事实表连接。材料还给出一次性API批量建模与查询的用法。
摘要由 AI 生成,请以原文为准。观测历史 · 最近 1 条 展开 / 收起
缺失不计为零;增长只比较同一指标来源的有效记录,按实际间隔折算每小时。上游缓存可能延迟数值更新。
| 采集时间 · 北京时间 | 指标 | 数值 | 来源 | 状态 |
|---|---|---|---|---|
| 10-27 15:47:59 | Star | 101 | GitHub 公开页面 | 已取得 |
采集原文 展开 / 收起
orionbelt-semantic-layer
Source-available semantic and context layer, rule engine, and semantic sidecar for agentic AI and governed analytics. Compiles declarativ…
项目说明 展开 / 收起
OrionBelt® Semantic and Context Layer, Rule Engine, and Semantic Sidecar Define shared metrics or model a set of questions in YAML. Let agents and BI tools query through one semantic compiler. A semantic sidecar: it rides alongside the systems you already run instead of replacing them. Ask an LLM to write SQL against a raw star schema and sooner or later it joins two fact tables and hands you a revenue number inflated by a factor of eight. It looks right. Nobody catches it. OrionBelt is a semantic and context layer with a rule engine, and it runs as a semantic sidecar. You or an agent declare dimensions, measures, metrics, and joins in YAML, scoped to one task or maintained as a shared model. OrionBelt compiles them into dialect-specific SQL through a real AST, and routes multi-fact queries through a Composite Fact Layer planner that blocks the join paths that produce fan traps. Queries ask for "Total Revenue" by "Country"; physical table and column mappings live in the model. No BI tool in the middle. No runtime lock-in. Point it at what you already have. Model the questions An agent can model just the questions it needs to answer. With POST /v1/oneshot/batch, it submits a task-specific OBML model and several independent queries in one request. OBSL validates the model, compiles or executes the queries, and returns separately identified results with SQL, explanations, warnings, and errors as applicable. For "revenue by country, monthly revenue, and average order value," the agent defines the relevant columns and calculations once and asks three questions against them. A freshly loaded model is removed after the batch by default; persist_model: true keeps it in the session for follow-up questions. The same compiler supports this workflow and long-lived shared models. Follow the agent workflow guide for a complete example, or see the one-shot API contract. Four ways in The same model serves every surface you already use. Four of them, and one model behind all four: Surface Port Speaks Connect with PostgreSQL wire 5432 Postgres protocol DuckDB via ATTACH, Tableau, Dremio as a federated source, Power BI, Superset, DBeaver, Metabase, psql Arrow Flight SQL 8815 gRPC + Arrow DuckDB via adbc_scanner, Tableau and Power BI through the Flight SQL JDBC/ODBC drivers, ADBC clients (Python, Go, Java) REST 8000 HTTP + JSON your code, notebooks, curl, and the 8 PEP 249 drivers (which compile here, then execute on the warehouse directly) MCP stdio / HTTP Model Context Protocol AI agents: Claude, Cursor, Copilot, Windsurf Both SQL surfaces speak OBSQL, so SELECT "Region", "Total Sales" FROM sales_model is the same query whichever one you came in through. ADBC is how you use the Flight SQL surface rather than a fifth surface of its own, and DuckDB is a client that can take either SQL surface. Eight ways out Compiles to BigQuery, ClickHouse, Databricks, Dremio, DuckDB/MotherDuck, MySQL, PostgreSQL, and Snowflake. The warehouse behind the model is independent of the surface in front of it: any of the four surfaces, against any of the eight dialects. Here is TPC-DS query 98. Two measures over the same column, identical but for one line: Class Revenue is pinned to a coarser grain than the query asks for. measures: Store Sales Amount: columns: [{dataObject: Store Sales, column: Ext Sales Price}] aggregation: sum Class Revenue: columns: [{dataObject: Store Sales, column: Ext Sales Price}] aggregation: sum grain: {mode: FIXED, keepOnly: [Class]} # <- pin to Class, ignore query grain metrics: Revenue Ratio: expression: "{[Store Sales Amount]} * 100.0 / {[Class Revenue]}" That one grain line is what becomes SUM(...) OVER (PARTITION BY "Class") below. The query names business concepts. No tables, no joins, no SQL: select: dimensions: [Item ID, Item Description, Category, Class, Current Price] measures: [Store Sales Amount, Revenue Ratio] where: - {field: Category, op: inlist, value: [Sports, Books, Home]} - {field: Order Date, op: between, value: ["1999-02-22", "1999-03-24"]} pip install orionbelt-semantic-layer obsl compile tpcds.obml.yml -q Q98.yml -d duckdb WITH "base" AS ( SELECT "Item"."i_item_id" AS "Item ID", "Item"."i_item_desc" AS "Item Description", "Item"."i_category" AS "Category", "Item"."i_class" AS "Class", "Item"."i_current_price" AS "Current Price", CAST(SUM("Store Sales"."ss_ext_sales_price") AS DECIMAL(18, 2)) AS "Store Sales Amount", SUM("Store Sales"."ss_ext_sales_price") AS "Class Revenue" FROM "main"."store_sales" AS "Store Sales" LEFT JOIN "main"."item" AS "Item" ON "Store Sales"."ss_item_sk" = "Item"."i_item_sk" LEFT JOIN "main"."date_dim" AS "Date" ON "Store Sales"."ss_sold_date_sk" = "Date"."d_date_sk" WHERE "Item"."i_category" IN ('Sports', 'Books', 'Home') AND "Date"."d_date" BETWEEN '1999-02-22' AND '1999-03-24' GROUP BY ALL ) SELECT "Item ID" AS "Item ID", "Item Description" AS "Item Description", "Category" AS "Category", "Class" AS "Class", "Current Price" AS "Current Price", "Store Sales Amount" AS "Store Sales Amount", "Store Sales Amount" * 100.0 / NULLIF(SUM("Class Revenue") OVER (PARTITION BY "Class"), 0) AS "Revenue Ratio" FROM "base" AS "base" ORDER BY "Category" ASC, "Class" ASC, "Item ID" ASC, "Item Description" ASC, "Revenue Ratio" ASC You did not write the join path, the window function over an aggregate, the NULLIF guard, or one table name. Change -d duckdb to -d snowflake and the same two files compile for Snowflake, or for any of eight dialects. This is checked, not asserted. 40 TPC-DS queries are built against a single OBML model and compared row by row against each engine's own reference SQL: 39 of 40 match on DuckDB at sf=1, 37 of 40 on ClickHouse at sf=10. Every one of the remaining differences traces to a reference variant rather than a compilation error, and each is documented. See the sweep, or the queries in examples/tpcds_queries/. The same answer on every engine Compiling for eight engines is the easy part. The engines disagree about results, and a layer that