Quirky Help
基于截图或终端输出提供精准的故障排查指引和下一步操作建议。
下载 13
基于iGPT引擎的邮件上下文分析与结构化提取,支持多层级推理和流式输出。
openclaw skills install @sammy-spk/igpt-email-ask命令、参数、文件名以原文为准
针对用户邮件内容提出问题,并获得基于上下文的推理性、结构化回答。由 iGPT 的上下文引擎驱动,可跨时间重建对话、决策、责任归属与意图。
此技能通过调用 iGPT 的 recall/ask 接口,基于用户连接的邮件数据生成答案。与基础检索不同,上下文引擎具备以下能力:
connectors/authorize 完成 OAuth 授权后,ask 才能返回结果。可通过 datasources.list() 检查连接状态igptai 包pip install igptai将 API 密钥设置为环境变量:
export IGPT_API_KEY="your-api-key-here"from igptai import IGPT
import os
igpt = IGPT(api_key=os.environ["IGPT_API_KEY"], user="user_123")
res = igpt.recall.ask(input="总结本周会议中的关键风险、决策和下一步行动。")
if res is not None and res.get("error"):
print("iGPT 错误:", res)
else:
print(res)传入 output_format="json" 可获取非结构化 JSON;也可提供 Schema 实现结构化校验输出:
# 简单 JSON 输出
res = igpt.recall.ask(
input="本周有哪些待办事项?",
output_format="json"
)
# 结构化校验输出(带 Schema)
res = igpt.recall.ask(
input="本周的待办事项",
quality="cef-1-normal",
output_format={
"strict": True,
"schema": {
"type": "object",
"required": ["action_items"],
"additionalProperties": False,
"properties": {
"action_items": {
"type": "array",
"items": {
"type": "object",
"required": ["title", "owner", "due_date"],
"properties": {
"title": {"type": "string"},
"owner": {"type": "string"},
"due_date": {"type": "string"}
}
}
}
}
}
}
)
print(res)示例响应:
{
"action_items": [
{
"title": "批准修订后的第一季度预算分配",
"owner": "Dvir Ben-Aroya",
"due_date": "2026-01-15"
},
{
"title": "批准 FY2026 年最终战略重点",
"owner": "董事会",
"due_date": "2026-01-31"
}
]
}iGPT 上下文引擎提供三个质量层级:
# 正常:快速响应,适用于简单问题
res = igpt.recall.ask(
input="我下次与 Acme 公司的会议是什么时候?",
quality="cef-1-normal"
)
# 高级:更深入推理,适合复杂多线程分析
res = igpt.recall.ask(
input="目前与 Acme 公司的谈判进展如何?我们有哪些优势?",
quality="cef-1-high"
)
# 推理:最大深度,用于复杂的跨线程整合分析
res = igpt.recall.ask(
input="回顾过去一个季度与 Acme 的所有沟通,有哪些模式表明存在风险?我们应该如何应对?",
quality="cef-1-reasoning"
)流式传输返回解析后的 JSON 数据块(字典),而非原始文本。需从每个数据块中提取内容:
stream = igpt.recall.ask(
input="从首次接触到现在,详细说明 Acme 项目的时间线。",
stream=True
)
for chunk in stream:
if isinstance(chunk, dict) and chunk.get("error"):
print("流式错误:", chunk)
break
# 每个数据块都是一个解析后的 JSON 字典
print(chunk)流式传输具有容错性:若连接中断,迭代器会返回错误数据块并正常结束,不会抛出异常。
# 验证用户是否已连接数据源
status = igpt.datasources.list()
if status is not None and not status.get("error"):
print("已连接的数据源:", status)
else:
# 首次连接数据源
auth = igpt.connectors.authorize(service="spike", scope="messages")
print("请打开以下链接完成授权:", auth.get("url"))| 参数 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| input | string | 是 | 要询问的提示或问题内容 |
| user | string | 是(或在构造函数中设置) | 唯一用户标识符,限定查询范围至该用户的已连接数据。按需传入值可覆盖构造函数默认值 |
| stream | boolean | 否(默认:false) | 若为 true,返回一个生成器,通过 SSE 逐块返回解析后的 JSON 字典 |
| quality | string | 否 | 上下文引擎质量层级:"cef-1-normal"、"cef-1-high" 或 "cef-1-reasoning" |
| output_format | string 或 object | 否 | 输出格式:"text"(默认)、"json",或 {"strict": true, "schema": <JSON Schema>} 用于结构化校验输出 |
markdown
SDK 不会抛出异常,而是返回标准化的错误对象:
res = igpt.recall.ask(input="昨天董事会会议发生了什么?")
if res is not None and res.get("error"):
error = res["error"]
if error == "auth":
print("检查您的 API 密钥")
elif error == "params":
print("检查您的请求参数")
elif error == "network_error":
print("网络问题 —— SDK 会在返回此错误前进行指数退避重试(默认 3 次)")
else:
print(res)此技能仅与以下接口通信:
https://api.igpt.ai/v1/recall/ask/ —— 推理接口https://api.igpt.ai/v1/connectors/authorize/ —— 仅在初始数据源连接设置时使用https://api.igpt.ai/v1/datasources/list/ —— 用于检查连接状态不与其他外部接口通信。不向任何第三方服务发送数据。igptai PyPI 包源码可在 https://github.com/igptai/igpt-python 获取。
IGPT_API_KEY 以 Bearer Token 方式通过 HTTPS 认证。无 shell 访问、无文件系统访问、无系统命令执行。user 标识符。用户 A 无法访问用户 B 的邮件数据。隔离在索引和执行层面强制实施,而非作为过滤层。IGPT_API_KEY 环境变量外。network_error 前,会对失败请求进行指数退避重试(默认 3 次,基础延迟 100ms,倍数因子 2)。完整安全模型请参阅 https://docs.igpt.ai/docs/security/model。
api.igpt.ai 以外的接口以下均为自然语言提示,均可正常工作:
"总结本周邮件线程中的主要风险" —— 跨线程分析"昨天董事会会议中有哪些待办事项?" —— 任务提取"Acme 项目当前进展如何?" —— 交易情报"预算审批由谁负责,截止时间是什么?" —— 所有权与截止日期提取"过去 7 天内是否有邮件语气明显转负面的线程?" —— 情感分析"为明天与 Sarah 的会议生成一份简报" —— 会议准备已收录 1 个 Skill