Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问clear审计未展示

function-calling函数调用

Agent Skill

function-calling 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

881

周安装

36

GitHub Stars

公开资料未说明

下载量

282
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:function-calling(函数调用)
来源仓库:https://github.com/yonatangross/orchestkit
仓库路径:skills/function-calling
安装命令:
npx skills add yonatangross/orchestkit --skill "function-calling"
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add yonatangross/orchestkit --skill "function-calling"

简介

用于查找、检索和筛选相关信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词或任务场景快速定位候选结果。
  • 可结合来源仓库、安装命令和原始 README 继续核验具体用法。
  • 安装前建议确认权限范围和维护状态,以及是否会触发联网、命令执行或文件读写。
  • function-calling 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

name
function-calling
description
LLM function calling and tool use patterns. Use when enabling LLMs to call external tools, defining tool schemas, implementing tool execution loops, or getting structured output from LLMs.
tags
[llm, tools, function-calling, structured-output]
context
fork
agent
llm-integrator
version
1.0.0
author
OrchestKit
user-invocable
false

Function Calling

Enable LLMs to use external tools and return structured data.

Basic Tool Definition (2026 Best Practice)

# OpenAI format with strict mode (2026 recommended)
tools = [{
    "type": "function",
    "function": {
        "name": "search_documents",
        "description": "Search the document database for relevant content",
        "strict": True,  # ← 2026: Enables structured output validation
        "parameters": {
            "type": "object",
            "properties": {
                "query": {
                    "type": "string",
                    "description": "The search query"
                },
                "limit": {
                    "type": "integer",
                    "description": "Max results to return"
                }
            },
            "required": ["query", "limit"],  # All props required when strict
            "additionalProperties": False     # ← 2026: Required for strict mode
        }
    }
}]

# Note: With strict=True:
# - All properties must be listed in "required"
# - additionalProperties must be False
# - No "default" values (provide via code instead)

Tool Execution Loop

async def run_with_tools(messages: list, tools: list) -> str:
    """Execute tool calls until LLM returns final answer."""
    while True:
        response = await llm.chat(messages=messages, tools=tools)

        # Check if LLM wants to call tools
        if not response.tool_calls:
            return response.content

        # Execute each tool call
        for tool_call in response.tool_calls:
            result = await execute_tool(
                tool_call.function.name,
                json.loads(tool_call.function.arguments)
            )

            # Add tool result to conversation
            messages.append({
                "role": "tool",
                "tool_call_id": tool_call.id,
                "content": json.dumps(result)
            })

        # Continue loop (LLM will process tool results)

async def execute_tool(name: str, args: dict) -> any:
    """Route to appropriate tool implementation."""
    tools = {
        "search_documents": search_documents,
        "get_weather": get_weather,
        "calculate": calculate,
    }
    return await tools[name](**args)

Structured Output (Guaranteed JSON)

from pydantic import BaseModel

class Analysis(BaseModel):
    sentiment: str
    confidence: float
    key_points: list[str]

# OpenAI structured output
response = await client.beta.chat.completions.parse(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Analyze this text..."}],
    response_format=Analysis
)

analysis = response.choices[0].message.parsed  # Typed Analysis object

LangChain Tool Binding

from langchain_core.tools import tool
from pydantic import BaseModel, Field

@tool
def search_documents(query: str, limit: int = 5) -> list[dict]:
    """Search the document database.

    Args:
        query: Search query string
        limit: Maximum results to return
    """
    return db.search(query, limit=limit)

# Bind to model
llm_with_tools = llm.bind_tools([search_documents])

# Or with structured output
class SearchResult(BaseModel):
    query: str = Field(description="The search query used")
    results: list[str] = Field(description="Matching documents")

structured_llm = llm.with_structured_output(SearchResult)

Parallel Tool Calls

# OpenAI supports parallel tool calls
response = await llm.chat(
    messages=messages,
    tools=tools,
    parallel_tool_calls=True  # Default in GPT-4o
)

# Handle multiple calls in parallel
if response.tool_calls:
    results = await asyncio.gather(*[
        execute_tool(tc.function.name, json.loads(tc.function.arguments))
        for tc in response.tool_calls
    ])

⚠️ 2026 Compatibility Note:

# Structured outputs with strict=True may not work with parallel_tool_calls
# If using strict mode schemas, disable parallel calls:
response = await llm.chat(
    messages=messages,
    tools=tools_with_strict_true,
    parallel_tool_calls=False  # Required for strict mode reliability
)

Key Decisions

DecisionRecommendation
Tool count5-15 max (more = confusion)
Description length1-2 sentences
Parameter validationUse Pydantic/Zod
Error handlingReturn error as tool result
Schema modestrict: true (2026 best practice)
Output formatStructured Outputs > JSON mode
Parallel callsDisable with strict mode

Common Mistakes

  • Vague tool descriptions (LLM won't know when to use)
  • No input validation (LLM sends bad params)
  • Missing error handling (crashes on tool failure)
  • Too many tools (LLM gets confused)

Related Skills

  • agent-loops - Multi-step tool use with reasoning
  • llm-streaming - Streaming with tool calls
  • structured-output - Complex output schemas

Capability Details

tool-definition

Keywords: tool, function, define tool, tool schema, function schema Solves:

  • Define tools with clear descriptions
  • Create JSON schemas for tool parameters
  • Document tool behavior for LLM

tool-execution-loop

Keywords: execution loop, tool call, agent loop, run tool Solves:

  • Implement tool execution loops
  • Handle multiple tool calls
  • Process tool results

structured-output

Keywords: structured output, JSON output, typed response, response schema Solves:

  • Get structured JSON from LLM
  • Enforce output schemas
  • Parse and validate responses

parallel-tool-calls

Keywords: parallel, concurrent, multiple tools, batch tools Solves:

  • Execute multiple tools in parallel
  • Handle concurrent tool results
  • Optimize tool call latency

strict-mode-schemas

Keywords: strict mode, strict schema, additionalProperties, required fields Solves:

  • Enforce strict JSON schemas
  • Prevent extra fields in output
  • Ensure schema compliance

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

windsurf

25.89%
按下载量换算73

Gemini CLI

22.89%
按下载量换算65

Antigravity

17.71%
按下载量换算50

Claude Code

12.84%
按下载量换算36

trae

7.38%
按下载量换算21

OpenCode

3.26%
按下载量换算9

安全审计

暂无安全审计结果可展示。

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills