mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: [BREAKING] Replace Hosted*Tool classes with tool methods (#3634)
* Replace Hosted*Tool classes with client static factory methods * fixed failing test * mypy fix * mypy fix 2 * declarative mypy fix * addressed comments * ToolProtocol removal * fixed test * agents mypy fix * fix failing tests * mypy fix * addressed comments * fixed tests * addressed comments + added factory method overrides for azureai v2 client * mypy fix * added kwargs to azureai tool methods * fixed in test * _sessions fix * test fix
This commit is contained in:
committed by
GitHub
Unverified
parent
d249473a6d
commit
7a88af0aef
@@ -26,7 +26,7 @@ Example:
|
||||
from collections.abc import AsyncIterator
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from agent_framework import Agent, HostedCodeInterpreterTool, HostedWebSearchTool
|
||||
from agent_framework import Agent
|
||||
from agent_framework.azure import AzureAIAgentClient
|
||||
from azure.identity.aio import AzureCliCredential
|
||||
|
||||
@@ -54,11 +54,8 @@ async def create_gaia_agent() -> AsyncIterator[Agent]:
|
||||
instructions="Solve tasks to your best ability. Use Bing Search to find "
|
||||
"information and Code Interpreter to perform calculations and data analysis.",
|
||||
tools=[
|
||||
HostedWebSearchTool(
|
||||
name="Bing Grounding Search",
|
||||
description="Search the web for current information using Bing",
|
||||
),
|
||||
HostedCodeInterpreterTool(),
|
||||
AzureAIAgentClient.get_web_search_tool(),
|
||||
AzureAIAgentClient.get_code_interpreter_tool(),
|
||||
],
|
||||
) as agent,
|
||||
):
|
||||
|
||||
@@ -25,7 +25,7 @@ Example:
|
||||
from collections.abc import AsyncIterator
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from agent_framework import Agent, HostedCodeInterpreterTool, HostedWebSearchTool
|
||||
from agent_framework import Agent
|
||||
from agent_framework.openai import OpenAIResponsesClient
|
||||
|
||||
|
||||
@@ -54,11 +54,8 @@ async def create_gaia_agent() -> AsyncIterator[Agent]:
|
||||
instructions="Solve tasks to your best ability. Use Web Search to find "
|
||||
"information and Code Interpreter to perform calculations and data analysis.",
|
||||
tools=[
|
||||
HostedWebSearchTool(
|
||||
name="Web Search",
|
||||
description="Search the web for current information",
|
||||
),
|
||||
HostedCodeInterpreterTool(),
|
||||
OpenAIResponsesClient.get_web_search_tool(),
|
||||
OpenAIResponsesClient.get_code_interpreter_tool(),
|
||||
],
|
||||
) as agent:
|
||||
yield agent
|
||||
|
||||
Reference in New Issue
Block a user