AI-powered conversational experiences for Microsoft Teams applications. Provides prompt management, action planning, and model integration for building intelligent Teams bots.
pip install microsoft-teams-aiOr if using uv:
uv add microsoft-teams-aifrom microsoft_teams.ai import ChatPrompt, Function
from microsoft_teams.openai import OpenAICompletionsAIModel
from pydantic import BaseModel
model = OpenAICompletionsAIModel(api_key="your-api-key", model="gpt-4")
# Create a ChatPrompt
prompt = ChatPrompt(model)
result = await prompt.send(
input="Hello!",
instructions="You are a helpful assistant."
)class GetWeatherParams(BaseModel):
location: str
async def get_weather(params: GetWeatherParams) -> str:
return f"The weather in {params.location} is sunny"
weather_function = Function(
name="get_weather",
description="Get weather for a location",
parameter_schema=GetWeatherParams,
handler=get_weather
)
prompt = ChatPrompt(model, functions=[weather_function])