跳到正文

工具托管

grav 能提供给模型的工具。一个工具就是一行数据 —— 由一个 kind 负责执行,所以新增工具不用改代码。

3 个工具 3 个已发布
工具
3
3 个在这里执行
已启用
3
全部发布给模型
调用数
0
0 次错误
已安装的类型
2
每种一个文件 + 一行注册

模型怎么用上这些工具

在任意一次 chat completion 里点名托管的工具,然后执行它引导的那次调用。

1 · 声明

curl https://ai.grav.cn/proxy/ai/v1/chat/completions \
  -H "Authorization: Bearer $PROXY_AUTH_KEY" \
  -d '{"model":"<your-model>",
       "messages":[{"role":"user","content":"scrape example.com"}],
       "grav_tools":["firecrawl-scrape"]}'
grav_tools 决定要向模型声明哪些托管工具 (不写就是全部已启用的)。客户端自己带了 tools 时,一律以客户端的为准。

2 · 执行

curl https://ai.grav.cn/proxy/ai/v1/tools/call \
  -H "Authorization: Bearer $PROXY_AUTH_KEY" \
  -d '{"name":"firecrawl-scrape",
       "arguments":{"url":"https://example.com"}}'
模型回答里的 tool_calls 条目可以原样丢进来 —— grav 也认 function.name / function.arguments。

firecrawl-scrape

HTTP 请求 已发布 无密钥
0 次调用 闲置

Scrape a single URL and return its content as markdown. A key is optional (keyless tier).

类型 http 每次调用发一个请求;url、请求头、查询参数或请求体里可以用 {{param}}。
端点 POST https://api.firecrawl.dev/v2/scrape
鉴权 bearer
参数 url:string * formats:array = ['markdown'] onlyMainContent:boolean = True
JSON schema
展开
{
  "additionalProperties": false,
  "properties": {
    "formats": {
      "default": [
        "markdown"
      ],
      "description": "Output formats, e.g. [\u0027markdown\u0027].",
      "type": "array"
    },
    "onlyMainContent": {
      "default": true,
      "description": "Drop navigation / footer noise.",
      "type": "boolean"
    },
    "url": {
      "description": "The absolute URL to scrape.",
      "type": "string"
    }
  },
  "required": [
    "url"
  ],
  "type": "object"
}
只读 —— 编辑在 /api/tools/firecrawl-scrape。
到管理端编辑

http-get

HTTP 请求 已发布 无密钥
0 次调用 闲置

Fetch any URL over GET and return the raw body as text.

类型 http 每次调用发一个请求;url、请求头、查询参数或请求体里可以用 {{param}}。
端点 GET {{url}}
鉴权 none
参数 url:string *
JSON schema
展开
{
  "additionalProperties": false,
  "properties": {
    "url": {
      "description": "Absolute http(s) URL to fetch.",
      "type": "string"
    }
  },
  "required": [
    "url"
  ],
  "type": "object"
}
只读 —— 编辑在 /api/tools/http-get。
到管理端编辑