mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: [BREAKING] Renamed create_agent to as_agent (#3249)
* Renamed create_agent to as_agent * Override for as_agent * Added override
This commit is contained in:
@@ -27,7 +27,7 @@ async def non_streaming_example() -> None:
|
||||
"""Example of non-streaming response (get the complete result at once)."""
|
||||
print("=== Non-streaming Response Example ===")
|
||||
|
||||
agent = OllamaChatClient().create_agent(
|
||||
agent = OllamaChatClient().as_agent(
|
||||
name="TimeAgent",
|
||||
instructions="You are a helpful time agent answer in one sentence.",
|
||||
tools=get_time,
|
||||
@@ -43,7 +43,7 @@ async def streaming_example() -> None:
|
||||
"""Example of streaming response (get results as they are generated)."""
|
||||
print("=== Streaming Response Example ===")
|
||||
|
||||
agent = OllamaChatClient().create_agent(
|
||||
agent = OllamaChatClient().as_agent(
|
||||
name="TimeAgent",
|
||||
instructions="You are a helpful time agent answer in one sentence.",
|
||||
tools=get_time,
|
||||
|
||||
@@ -21,7 +21,7 @@ https://ollama.com/
|
||||
async def reasoning_example() -> None:
|
||||
print("=== Response Reasoning Example ===")
|
||||
|
||||
agent = OllamaChatClient().create_agent(
|
||||
agent = OllamaChatClient().as_agent(
|
||||
name="TimeAgent",
|
||||
instructions="You are a helpful agent answer in one sentence.",
|
||||
default_options={"think": True}, # Enable Reasoning on agent level
|
||||
|
||||
@@ -36,7 +36,7 @@ async def non_streaming_example() -> None:
|
||||
api_key="ollama", # Just a placeholder, Ollama doesn't require API key
|
||||
base_url=os.getenv("OLLAMA_ENDPOINT"),
|
||||
model_id=os.getenv("OLLAMA_MODEL"),
|
||||
).create_agent(
|
||||
).as_agent(
|
||||
name="WeatherAgent",
|
||||
instructions="You are a helpful weather agent.",
|
||||
tools=get_weather,
|
||||
@@ -56,7 +56,7 @@ async def streaming_example() -> None:
|
||||
api_key="ollama", # Just a placeholder, Ollama doesn't require API key
|
||||
base_url=os.getenv("OLLAMA_ENDPOINT"),
|
||||
model_id=os.getenv("OLLAMA_MODEL"),
|
||||
).create_agent(
|
||||
).as_agent(
|
||||
name="WeatherAgent",
|
||||
instructions="You are a helpful weather agent.",
|
||||
tools=get_weather,
|
||||
|
||||
Reference in New Issue
Block a user