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
@@ -4,6 +4,7 @@ from typing import Annotated, Any
|
||||
|
||||
import anyio
|
||||
from agent_framework.openai import OpenAIResponsesClient
|
||||
from agent_framework import tool
|
||||
|
||||
"""
|
||||
This sample demonstrates how to expose an Agent as an MCP server.
|
||||
@@ -30,7 +31,8 @@ with the following configuration:
|
||||
```
|
||||
"""
|
||||
|
||||
|
||||
# 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_specials() -> Annotated[str, "Returns the specials from the menu."]:
|
||||
return """
|
||||
Special Soup: Clam Chowder
|
||||
@@ -38,7 +40,7 @@ def get_specials() -> Annotated[str, "Returns the specials from the menu."]:
|
||||
Special Drink: Chai Tea
|
||||
"""
|
||||
|
||||
|
||||
@tool(approval_mode="never_require")
|
||||
def get_item_price(
|
||||
menu_item: Annotated[str, "The name of the menu item."],
|
||||
) -> Annotated[str, "Returns the price of the menu item."]:
|
||||
|
||||
Reference in New Issue
Block a user