feat(fel): 新增 You.com 联网搜索社区工具(fel-community/tool-youcom-search)#416
Open
Emos21 wants to merge 2 commits into
Open
feat(fel): 新增 You.com 联网搜索社区工具(fel-community/tool-youcom-search)#416Emos21 wants to merge 2 commits into
Emos21 wants to merge 2 commits into
Conversation
在 fel-community 下新增 tool-youcom-search 模块,提供标准 @ToolMethod 工具 youcom/web_search,供 FEL 智能体联网检索实时 信息。密钥仅从环境变量 YDC_API_KEY 读取;密钥缺失或调用失败时 返回中文提示字符串,不抛出异常,保证宿主流程不受影响。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
覆盖请求构造(路径、X-API-Key、查询参数)、网页与新闻结果映射、 可选字段缺失降级、条数默认值与上限截断、无密钥友好提示、 401/403/422/429/500 错误映射、非法 Json 与超时容错,并通过 Tool.Metadata.fromMethod 验证工具注解可被 FEL 框架正确解析。 另含一个由 YDC_API_KEY 环境变量门控的真实接口联调测试。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4 tasks
Member
|
你好,我是这个项目的maintainer,你可以通过readme中的联系方式加一下我的联系方式,我们聊一下相关改动吧?你这个是在什么场景下使用呢? |
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.
关联 Issue: #415
动机
FEL 已具备完善的工具机制与 fel-community 社区模块体系,但框架内尚无联网搜索工具。本 PR 新增
tool-youcom-search社区模块,让基于 FEL 构建的智能体获得开箱即用、带来源引用的实时联网检索能力。纯增量改动,全部位于fel-community内(外加一行模块注册)。变更内容
framework/fel/java/fel-community/tool-youcom-search模块(模块结构、构建插件配置完全参照model-openai)YouComSearchService— 标准工具定义:@Group+@ToolMethod(namespace="youcom", name="web_search")+@Genericable,参数 query(必填)/ count(默认 5,上限 20)/ freshness(可选),与WeatherService示例同构;已通过Tool.Metadata.fromMethod元数据解析测试,tool-discoverer 可正常发现注册YouComSearchServiceImpl—@Component @Fitable("default");调用GET https://ydc-index.io/v1/search(X-API-Key认证),API Key 取环境变量YDC_API_KEY(新账户 $100 免费额度);网页与新闻双通道结果格式化为带编号的 标题/链接/摘录 文本@AcceptConfigValues("fel.youcom-search")仅暴露 apiBase 与超时(与 model-openai 的配置习惯一致);API Key 刻意不做配置项,避免密钥被写入配置文件.claude/CLAUDE.md要求的 AI 生成标记均已遵循测试
YDC_API_KEY自动跳过;已实测通过,返回真实检索结果)开发中发现的两个框架层现象(与本 PR 无关,仅供参考)
HttpClassicClientResponse#entityBytes()在服务端返回 gzip 且客户端(OkHttp)自动解压、剥离 Content-Length 的场景下返回空字节(readBodyByLength(-1));改用惰性entity()路径(与OpenAiModel一致)可正常工作@MvcTest与@EnabledIfEnvironmentVariable组合会触发测试框架注解解析器异常(apiguardian@API5.0/5.1 冲突,DefaultAnnotationTree.merge)如需要,两者都可以再单独提 Issue 详细复现。
标签建议:
in: fel、type: feature(需维护者添加)。English summary: Adds a new fel-community module
tool-youcom-search— the framework's first web-search tool. Standard FEL tool definition (@Group/@ToolMethod, verified to parse via Tool.Metadata.fromMethod so tool-discoverer registers it), implementation calling the You.com Search API with the YDC_API_KEY env var ($100 free signup credit), friendly Chinese guidance when unconfigured, no new third-party dependencies, 19 tests (offline + one env-gated live test, verified against the real API), zero regressions across fel-community. Also documents two framework-level observations (gzip vs entityBytes; @mvctest + @EnabledIfEnvironmentVariable annotation-resolver clash) discovered during development — happy to file separate issues for both.