function Module
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
Classes
| Function |
Represents a function that can be called by AI models. Functions define the interface between AI models and external functionality, providing structured parameter validation and execution. Type Parameters: Params: Pydantic model class defining the function's parameter schema, if any. Note For best type safety, use explicit type parameters when creating Function objects: Function[SearchPokemonParams](name=..., parameter_schema=SearchPokemonParams, handler=...) This ensures the handler parameter type matches the parameter_schema at compile time. |
| FunctionCall |
Represents a function call request from an AI model. Contains the function name, unique call ID, and parsed arguments that will be passed to the function handler if any. |
| FunctionHandler |
Protocol for function handlers that can be called by AI models. Function handlers can be either synchronous or asynchronous and should return a string result that will be passed back to the AI model. |
| FunctionHandlerWithNoParams |
Protocol for function handlers that can be called by AI models. This handler does not have any parameters. Function handlers can be either synchronous or asynchronous and should return a string result that will be passed back to the AI model. |
| Params |
Type variable for function parameter schemas. Must be bound to BaseModel to ensure proper validation and serialization. Contravariant to allow handlers to accept more general parameter types. alias of TypeVar('Params', bound=<xref:pydantic.main.BaseModel>, contravariant=True) |