langchain4j-tool-function-calling-patterns
仓库创建 2025年10月21日最近提交 1 个月前SkillHot 收录 22 天前
▸ 精选理由
规范工具注册与参数校验,便于构建可靠的 Agent 功能。
▸ 风险提示
工具执行可能调用外部资源,需注意权限控制与错误处理。
这个 Skill 做什么
提供 LangChain4j 的工具与函数调用模式,包含注解与执行流程约定。
给出在 LangChain4j 里把 Java 方法当作工具暴露和调用的实用模式:比如用 @Tool 注解标记方法、配置工具执行器、把工具注册到 AiServices、校验参数并处理执行错误。适合在开发需要 LLM 调用外部 API 或本地工具的 AI agent 时参考。重点是把函数规格、参数校验和错误处理约定好,让 agent 能安全可靠地调用工具。
▸ 展开 SKILL.md 英文原文
Provides and generates LangChain4j tool and function calling patterns: annotates methods as tools with @Tool, configures tool executors, registers tools with AiServices, validates tool parameters, and handles tool execution errors. Use when building AI agents that call tools, define function specifications, manage tool responses, or integrate external APIs with LLM-driven applications.
311
Stars
37
Forks
40
仓库内 Skill
+10
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/giuseppe-trisciuoglio/developer-kit/main/plugins/developer-kit-java/skills/langchain4j-tool-function-calling-patterns/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/giuseppe-trisciuoglio/developer-kit/main/plugins/developer-kit-java/skills/langchain4j-tool-function-calling-patterns/SKILL.md"SKILL.MD 节选查看完整文件 ↗
# LangChain4j Tool & Function Calling Patterns Provides patterns for annotating methods as tools, configuring tool executors, registering tools with AI services, validating parameters, and handling tool execution errors in LangChain4j applications. ## Overview LangChain4j uses the `@Tool` annotation to expose Java methods as callable functions for AI agents. The `AiServices` builder registers tools with a chat model, enabling LLMs to perform actions beyond text generation: database queries, API calls, calculations, and business system integrations. Parameters use `@P` for descriptions that guide the LLM. ## When to Use - Building AI agents that call external tools (weather, stocks, data
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有