mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: added create_agent and removed need for Field in annotations (#380)
* added create_agent * add minimal sample * allow multiple annotations * improved docstring
This commit is contained in:
committed by
GitHub
Unverified
parent
757c48e367
commit
8f27e63df6
@@ -4,7 +4,6 @@ import asyncio
|
||||
from random import randint
|
||||
from typing import Annotated
|
||||
|
||||
from agent_framework import ChatClientAgent
|
||||
from agent_framework.foundry import FoundryChatClient
|
||||
from pydantic import Field
|
||||
|
||||
@@ -23,8 +22,8 @@ async def non_streaming_example() -> None:
|
||||
|
||||
# Since no Agent ID is provided, the agent will be automatically created
|
||||
# and deleted after getting a response
|
||||
async with ChatClientAgent(
|
||||
chat_client=FoundryChatClient(),
|
||||
async with FoundryChatClient().create_agent(
|
||||
name="WeatherAgent",
|
||||
instructions="You are a helpful weather agent.",
|
||||
tools=get_weather,
|
||||
) as agent:
|
||||
@@ -40,8 +39,8 @@ async def streaming_example() -> None:
|
||||
|
||||
# Since no Agent ID is provided, the agent will be automatically created
|
||||
# and deleted after getting a response
|
||||
async with ChatClientAgent(
|
||||
chat_client=FoundryChatClient(),
|
||||
async with FoundryChatClient().create_agent(
|
||||
name="WeatherAgent",
|
||||
instructions="You are a helpful weather agent.",
|
||||
tools=get_weather,
|
||||
) as agent:
|
||||
|
||||
Reference in New Issue
Block a user