Skip to main content

function_tool

Function function_tool 

Source
pub fn function_tool(
    name: impl Into<String>,
    description: impl Into<String>,
    parameters: Value,
) -> Tool
Expand description

快速创建函数工具定义

§示例

use mofa_foundation::llm::function_tool;
use serde_json::json;

let tool = function_tool(
    "get_weather",
    "Get the current weather for a location",
    json!({
        "type": "object",
        "properties": {
            "location": {
                "type": "string",
                "description": "City name"
            }
        },
        "required": ["location"]
    })
);