Repository navigation
feat(sdk): llm 文本调用支持 webSearch 开关 - #8
Merged
Merged
Conversation
TextModelInput 新增 webSearch?: boolean,使用模型供应商自带的联网搜索; 构建扫描到该字段时写入 requires.operations 的 llm.webSearch。 需要桌面端在输入 schema 与模型路由中配套实现。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
桌面端 listModels 的文本条目已返回 webSearch(AOE-HQ/aoe-desktop#2742), SDK 类型与创作指引同步:说明未标注时按不支持处理,Gemini 同时传 tools 时降级。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
「实时应答助手」工作台需要在回答时事类问题时联网。各家模型供应商(Gemini grounding、OpenAI/Claude 的 web search 工具、Kimi、豆包等)都有自带的联网搜索,但当前 Host 的
llm.generateText/llm.streamText没有开关:输入 schema 是additionalProperties: false,多传字段会被直接拒收。工作台只能自己挂web_search工具,再让用户另外申请 Tavily / Exa 等 connector 的 API key。改动
在 SDK 契约里给文本调用加一个开关,接入方式与
reasoning相同:sdk/host-contracts.mts:TextModelInput新增webSearch?: boolean,默认 false,模型不支持时 Host 按 false 处理。generateObject不加。tooling/compiler/host-operations.ts、tooling/contracts/workbenchOperations.ts:服务端代码里的文本调用用到webSearch时,构建把llm.webSearch写入manifest.requires.operations,旧客户端会提示升级,而不是在运行时拒收参数。references/llm.md:说明用法,并建议把联网作为用户可选项,因为它会增加延迟和费用。tests/authoring.test.mjs:requires 扫描用例覆盖webSearch。需要桌面端配套
只合并这个 PR,联网不会生效。 参数校验和模型调用都在 Floatboat 桌面端,需要:
llm.generateText/llm.streamText的输入 schema 里接受webSearch。capabilities.list里声明llm.webSearch,listModels最好能标出哪些模型支持联网。验证
在 Windows 上,Node 22.23.4:
pnpm workbench:check、pnpm test通过。sdk-boundary、agent-stream、catalog、host-connection、skills、workspaces、pack-cli、runtime-package、live-preview全部通过;authoring.test.mjs中 requires 扫描用例(含本次新增断言)通过。authoring.test.mjs另有两项失败,在未改动的 main 上同样失败,与本 PR 无关:一项因为 Windows 没有符号链接权限(EPERM);「平台未连接」一项在本机开着 Floatboat 时超时。pnpm skills:check在 Windows 检出时报SKILL_ENTRY_STALE,原因是 CRLF 换行,main 上同样如此;内容没有差异,所以没有提交生成的入口文件。🤖 Generated with Claude Code