数据表
配置 AI Field
让一列由 Agent 根据其他列自动计算 — 抽 theme、做翻译、打分。
AI Field 是什么 — 不是什么
AI Field 是一种特殊字段,它的值不是用户输入也不是确定性公式,而是每次刷新时 Agent 按 prompt 现算的。本质上是把"对每行运行一次小型 LLM 调用"的能力做成了字段。
它不是:实时同步、零成本、确定性。每次刷新都消耗 token,结果有方差。所以适合"批量打标签 / 抽要点 / 翻译"这类离线作业,不适合"显示当前状态"这类实时数据。
配置三件事
- Prompt — 告诉 Agent 这一列要算什么;用
{column_name}引用本行其他字段 - 依赖字段 — 哪些列会被 prompt 读到(用于变更检测和 Auto 模式)
- 模型 — 推荐
haiku/gpt-4o-mini这类便宜快的;GPT-4 / Sonnet 留给真需要推理的场景 - 输出格式(可选)— 文本、JSON、select 枚举;选 select 时会自动 cast 并校验
示例 prompts
下面三个 prompt 覆盖了 80% 的使用场景:抽取、分类、生成。注意每个都明确要求输出格式 — 这是减少方差的关键。
// Theme extraction (output: JSON array)
From the {transcript} below, extract 3 themes as a JSON array.
Output only the JSON, no commentary.
// Sentiment classification (output: select enum)
Classify the sentiment of {feedback} as one of:
positive, neutral, negative.
Output only the single word.
// Summary generation (output: text, length-bounded)
Summarize {article_body} in 2 sentences for a busy product manager.
Lead with the most actionable insight.Auto vs Manual 模式
Auto 模式下,任意一个依赖字段变了就触发本行重算 — 写起来爽,但一个不小心 1000 行全跑一遍。Manual 模式只在你点 refresh 时才算,可以选 "all rows" / "current view" / "selected rows"。
推荐默认用 Manual — 等行多了再说 Auto。Manual 还有一个额外好处:可以在某次跑完后导出 CSV 留档,避免后续 prompt 调整把历史结果覆盖。
成本控制
- 用便宜模型 —
haiku一次约 $0.001/行;GPT-4 约 $0.05/行 - Prompt 里只塞必要字段 —
{summary}比{full_transcript}便宜 50x - 一次性 batch 跑:勾 "Skip rows with non-empty output" 避免重复扣费
- 在 Settings → Usage 看每张表 / 字段的累计 token — 异常一眼就出来
- Pro 版多 provider 路由:把 AI field 默认指给便宜 provider,对话用贵的
调试 AI Field
某一行结果不对?右键该单元格 → "Show last prompt" 看实际发给模型的字符串。九成的问题都是某个依赖字段为空导致 prompt 里出现 undefined,模型瞎猜。
想批量重跑被改过 prompt 的字段:Settings → Tables → AI fields → "Invalidate cache",下次 refresh 全部重算。