mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: [BREAKING] changed AIFunction to FunctionTool and @ai_function to @tool (#3413)
* changed AIFunction to FunctionTool and @ai_function to @tool * test and mypy fixes * mypy fix * switch function tool to always_require * fix noop * fix github copilot imports * test fixes * fix ollama test * fixes for tests * fix tests * reverted change to always_require and extended timeout * fix test
This commit is contained in:
committed by
GitHub
Unverified
parent
15b43f2abe
commit
a7d924a7d2
@@ -10,6 +10,7 @@ from agent_framework import (
|
||||
WorkflowContext,
|
||||
WorkflowExecutor,
|
||||
handler,
|
||||
tool,
|
||||
)
|
||||
from typing_extensions import Never
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from agent_framework import (
|
||||
SequentialBuilder,
|
||||
WorkflowExecutor,
|
||||
WorkflowOutputEvent,
|
||||
ai_function,
|
||||
tool,
|
||||
)
|
||||
from agent_framework.openai import OpenAIChatClient
|
||||
|
||||
@@ -32,7 +32,8 @@ Prerequisites:
|
||||
|
||||
|
||||
# Define tools that access custom context via **kwargs
|
||||
@ai_function
|
||||
# NOTE: approval_mode="never_require" is for sample brevity. Use "always_require" in production; see samples/getting_started/tools/function_tool_with_approval.py and samples/getting_started/tools/function_tool_with_approval_and_threads.py.
|
||||
@tool(approval_mode="never_require")
|
||||
def get_authenticated_data(
|
||||
resource: Annotated[str, "The resource to fetch"],
|
||||
**kwargs: Any,
|
||||
@@ -48,7 +49,7 @@ def get_authenticated_data(
|
||||
return f"Fetched '{resource}' for user {user_name} ({access_level} access)"
|
||||
|
||||
|
||||
@ai_function
|
||||
@tool(approval_mode="never_require")
|
||||
def call_configured_service(
|
||||
service_name: Annotated[str, "Name of the service to call"],
|
||||
**kwargs: Any,
|
||||
|
||||
@@ -16,6 +16,7 @@ from agent_framework import (
|
||||
WorkflowExecutor,
|
||||
handler,
|
||||
response_handler,
|
||||
tool,
|
||||
)
|
||||
from typing_extensions import Never
|
||||
|
||||
|
||||
+1
@@ -14,6 +14,7 @@ from agent_framework import (
|
||||
WorkflowOutputEvent,
|
||||
handler,
|
||||
response_handler,
|
||||
tool,
|
||||
)
|
||||
from typing_extensions import Never
|
||||
|
||||
|
||||
Reference in New Issue
Block a user