Skip to main content

gemini_function

Attribute Macro gemini_function 

Source
#[gemini_function]
Expand description

Attribute macro to mark a function as callable by Gemini.

This macro generates a schema for the function and an execute method to call it with JSON arguments.

§Requirements

  • Function arguments must be owned types that implement GeminiSchema (e.g., String, i32, bool).
  • References are not supported.
  • The function can be async and can return a Result (the Ok value must implement Serialize).

§Example

#[gemini_function]
/// Returns the current weather for a location.
fn get_weather(location: String) -> String {
    format!("The weather in {} is sunny.", location)
}