mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Small fix in Foundry chat client and samples (#407)
This commit is contained in:
committed by
GitHub
Unverified
parent
4007785b66
commit
95cb20ca40
@@ -23,11 +23,14 @@ 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 FoundryChatClient(async_ad_credential=DefaultAzureCredential()).create_agent(
|
||||
name="WeatherAgent",
|
||||
instructions="You are a helpful weather agent.",
|
||||
tools=get_weather,
|
||||
) as agent:
|
||||
async with (
|
||||
DefaultAzureCredential() as credential,
|
||||
FoundryChatClient(async_ad_credential=credential).create_agent(
|
||||
name="WeatherAgent",
|
||||
instructions="You are a helpful weather agent.",
|
||||
tools=get_weather,
|
||||
) as agent,
|
||||
):
|
||||
query = "What's the weather like in Seattle?"
|
||||
print(f"User: {query}")
|
||||
result = await agent.run(query)
|
||||
@@ -40,11 +43,14 @@ 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 FoundryChatClient(async_ad_credential=DefaultAzureCredential()).create_agent(
|
||||
name="WeatherAgent",
|
||||
instructions="You are a helpful weather agent.",
|
||||
tools=get_weather,
|
||||
) as agent:
|
||||
async with (
|
||||
DefaultAzureCredential() as credential,
|
||||
FoundryChatClient(async_ad_credential=credential).create_agent(
|
||||
name="WeatherAgent",
|
||||
instructions="You are a helpful weather agent.",
|
||||
tools=get_weather,
|
||||
) as agent,
|
||||
):
|
||||
query = "What's the weather like in Portland?"
|
||||
print(f"User: {query}")
|
||||
print("Agent: ", end="", flush=True)
|
||||
|
||||
Reference in New Issue
Block a user