ai Package
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
Modules
| agent |
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. |
| ai_model |
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. |
| chat_prompt |
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. |
| function |
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. |
| memory |
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. |
| message |
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. |
| plugin |
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. |
Classes
| AIModel |
Protocol defining the interface for AI models that can generate text responses. This protocol standardizes how different AI providers (OpenAI, Azure OpenAI, etc.) integrate with the Teams AI framework. Implementations should handle message processing, function calling, and optional streaming. |
| Agent |
A stateful implementation of ChatPrompt with persistent memory. Agent extends ChatPrompt by providing default memory management, making it easier to maintain conversation context across multiple interactions without manually passing memory each time. Initialize Agent with model and persistent memory. |
| ChatPrompt |
Core class for interacting with AI models through a prompt-based interface. Handles message processing, function calling, and plugin execution. Provides a flexible framework for building AI-powered applications. Initialize ChatPrompt with model and optional functions/plugins. |
| ChatSendResult |
Result of sending a message through ChatPrompt. Contains the final response from the AI model after all function calls and plugin processing have been completed. |
| 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. |
| FunctionMessage |
Represents the result of a function call execution. Contains the output from executing a function that was requested by the AI model, along with the function call ID for correlation. |
| ListMemory |
Default implementation of Memory using list-based storage. Provides in-memory storage for conversation messages with optional persistent storage backend support. Initialize list-based memory. |
| Memory |
Protocol for conversation memory storage implementations. Memory stores and retrieves conversation messages, enabling persistent context across multiple interactions with AI models. |
| ModelMessage |
Represents a response from an AI model. Can contain either text content, function calls to be executed, or both. When function_calls is present, the content may be None. |
| SystemMessage |
Represents system instructions or context for the AI model. Used to guide model behavior, provide context, or set up the conversation parameters without being part of the user dialogue. |
| UserMessage |
Represents a message from a user in the conversation. Contains the user's input text and is typically used as the starting point for AI model interactions. |