Skip to main content

function_tool

Attribute Macro function_tool 

Source
#[function_tool]
Expand description

Procedural macro for creating function tools

This macro transforms an async function into a Tool implementation.

§Example

use openai_agents::function_tool;

#[function_tool]
async fn get_weather(city: String) -> String {
    format!("The weather in {} is sunny", city)
}