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
+5
-2
@@ -37,16 +37,19 @@ async def run_semantic_kernel() -> None:
|
||||
|
||||
|
||||
async def run_agent_framework() -> None:
|
||||
from agent_framework import HostedCodeInterpreterTool
|
||||
from agent_framework.openai import OpenAIAssistantsClient
|
||||
|
||||
assistants_client = OpenAIAssistantsClient()
|
||||
|
||||
# Create code interpreter tool using static method
|
||||
code_interpreter_tool = OpenAIAssistantsClient.get_code_interpreter_tool()
|
||||
|
||||
# AF exposes the same tool configuration via create_agent.
|
||||
async with assistants_client.as_agent(
|
||||
name="CodeRunner",
|
||||
instructions="Use the code interpreter when calculations are required.",
|
||||
model="gpt-4.1",
|
||||
tools=[HostedCodeInterpreterTool()],
|
||||
tools=[code_interpreter_tool],
|
||||
) as assistant_agent:
|
||||
response = await assistant_agent.run(
|
||||
"Use Python to calculate the mean of [41, 42, 45] and explain the steps.",
|
||||
|
||||
Reference in New Issue
Block a user