運用代理的商業智慧
能從您的資料倉儲,把商業問題轉化為可信洞察的代理程式:分層脈絡、語意層中受治理的指標、受防護的 SQL、無法回答時會明確說明的答案、代理程式無法用話術繞過的存取規則,以及以您自己的黃金問題進行的評估,並透過 MCP 提供服務,全部建構在 DuckDB、sqlglot 與 MetricFlow 之上。
適合對象 寫給撰寫 SQL、熟悉自家資料倉儲,並受託讓使用者能向資料提問的分析工程師、BI 開發人員與資料科學家,目標是打造一個能算出正確數字的助理。
在 Kindle 或任何電子閱讀器上閱讀
此 EPUB 亦可於 Apple Books、Kobo 及多數電子閱讀器上閱讀。
傳送至 Kindle
將本版次的 EPUB 寄送至 繁體中文.
-
核准我們的地址
Amazon 只會從您已核准的地址將內容寄送到 Kindle,且每個寄送服務都須個別核准。請將我們的地址加入您的「已核准的個人文件電子郵件清單」。
books@rollingedition.com開啟 Amazon 的個人文件設定. 在 Amazon 上,路徑為「管理您的內容和裝置」、「偏好設定」、「個人文件設定」。
已傳送。幾分鐘內將會出現在你的 Kindle 書庫中。
如果未能送達,幾乎都是第 1 步的核准設定出了問題:請確認 books@rollingedition.com 已列入你的「已核准的個人文件電子郵件清單」。
您已儲存之書籍的每個新版次,也會送達您的 Kindle。
這不是 Kindle 地址。地址應以 @kindle.com 結尾,可在 Amazon 的個人文件設定中找到。
你今天已寄送 {count} 本書,這是單一帳戶一天的寄送上限。請明天再試。
今日的書籍寄送已達上限。請明日再試。
本書未能寄出。請於數分鐘後再試。
本版次檔案過大,無法以電子郵件寄送。
傳送至 Kindle 功能隨 Labs 提供。
這不是 Kindle 地址。地址應以 @kindle.com 結尾,可在 Amazon 的個人文件設定中找到。
本書未能寄出。請於數分鐘後再試。
或下載 EPUB 檔,並將其拖曳至 Amazon 的 Send to Kindle 頁面。
Kindle is a trademark of Amazon.com, Inc.
目錄
11 章,閱讀時間約 15 小時 58 分鐘,附有78 個範例。
-
1資料代理程式的完整流程
讀完本章,你將能建立商店的資料倉儲,讓一個已錄製回應的模型針對商業問題撰寫 SQL,執行該 SQL 並找出它回傳的錯誤數字,改以單一已定義的指標回答同一個問題,並在五個黃金問題上為兩種做法評分。
-
2Where raw text-to-SQL gets the number wrong
By the end of this chapter, you can name the five ways schema-only text-to-SQL returns a plausible wrong number on a real warehouse, show each one on the shop's warehouse, count them across a set of golden questions, and tell which a better prompt can fix and which need definitions the schema doesn't hold.
-
3從你自己的工作建立黃金問題
讀完本章後,你能根據公司裡的人實際提出的問題撰寫黃金問題,並為每一題附上黃金 SQL、提問者的角色,以及該題所需的答案類型。
-
4Give the agent layered context
By the end of this chapter, you can give a model that writes SQL more than the schema, in layers: notes on columns whose names mislead, a glossary of the shop's business terms, and verified queries retrieved for each question.
-
5Define metrics once in a semantic layer
By the end of this chapter, you can write the shop's semantic models and metrics in MetricFlow's YAML spec, compile a metric request to SQL with the book's own compiler, show that its entity joins can't fan out, group by the fiscal calendar, and confirm that MetricFlow compiles the same definitions to the same results.
-
6優先將問題導向受治理的指標
讀完本章後,你將能夠:把語意層的指標而非資料倉儲的資料表,作為工具提供給代理;讓代理回傳結構化的指標請求,並在執行任何查詢之前先加以驗證;當一個問題可能對應多個指標時,讓代理向使用者反問;並在黃金問題上衡量這些改變帶來的差異。
-
7Let the agent write SQL inside guards
By the end of this chapter, you can handle the questions no metric covers by letting the agent write SQL that runs read-only on a database holding only the rows and columns its role may read, and that is parsed, checked against an allowlist of tables, bounded in rows, size, cost and time, repaired once from an error, and transpiled to your warehouse's dialect.
-
8在無法回答時要說出來
讀完本章,你可以把拒答當成一種正式的回答:區分倉儲能回答與不能回答的問題,以已知類型的理由拒答,檢查所問期間的資料是否已經到齊,為每個答案呈現其出處,並用精確率與召回率衡量拒答,使代理既不亂猜,也不過度拒絕。
-
9讓代理程式守在誰能看到什麼的界線內
讀完本章,你將能在代理程式之下、在各角色自己的資料庫中,強制執行每個角色的列篩選、欄位遮罩與最小群組大小;語意層中的改寫與防護機制則作為縱深防禦,使任何提示都無法擴大存取範圍。
-
10評判答案並找出退化
讀完本章後,你將能夠:同時以多項指標為代理程式的一次執行評分;只在結果無法直接比較時,才以模型擔任評審;用任何人都能重新計算的參考標籤來校準該評審;觀察分數在不同次執行之間的變動幅度;並在 CI 中依據已錄製的執行結果,為提示詞、情境或指標的變更設下關卡。
-
11Serve the semantic layer over MCP
By the end of this chapter, you can serve the shop's governed metrics as MCP tools that answer for the role the server was built for, return each answer with its provenance as structured data, test the server in memory, and run the book's agent through it as a host.