Skip to content

Commit a74c9d1

Browse files
alliscodeCopilot
andcommitted
Fix eval samples: add required client= argument to Agent()
The upstream provider-leading client refactor (#4818) made client= a required parameter on Agent(). Update the three getting-started eval samples to use OpenAIResponsesClient(), matching the pattern used by all other 02-agents and 03-workflows samples. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f439746 commit a74c9d1

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

python/samples/02-agents/evaluation/evaluate_agent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
evaluator,
2121
keyword_check,
2222
)
23+
from agent_framework.openai import OpenAIResponsesClient
2324

2425

2526
# A custom check — parameter names determine what data you receive
@@ -32,7 +33,8 @@ def is_helpful(response: str) -> bool:
3233

3334
async def main() -> None:
3435
agent = Agent(
35-
model="gpt-4o-mini",
36+
client=OpenAIResponsesClient(),
37+
name="weather-assistant",
3638
instructions="You are a helpful weather assistant.",
3739
)
3840

python/samples/02-agents/evaluation/evaluate_with_expected.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
evaluator,
2121
tool_calls_present,
2222
)
23+
from agent_framework.openai import OpenAIResponsesClient
2324

2425

2526
@evaluator
@@ -34,7 +35,8 @@ def response_matches_expected(response: str, expected_output: str) -> float:
3435

3536
async def main() -> None:
3637
agent = Agent(
37-
model="gpt-4o-mini",
38+
client=OpenAIResponsesClient(),
39+
name="math-tutor",
3840
instructions="You are a math tutor. Answer concisely.",
3941
)
4042

python/samples/03-workflows/evaluation/evaluate_workflow.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
evaluator,
2222
keyword_check,
2323
)
24+
from agent_framework.openai import OpenAIResponsesClient
2425

2526

2627
@evaluator
@@ -31,8 +32,11 @@ def is_nonempty(response: str) -> bool:
3132

3233
async def main() -> None:
3334
# Build a simple planner → executor workflow
34-
planner = Agent(model="gpt-4o-mini", instructions="You plan trips. Output a bullet-point plan.")
35-
executor_agent = Agent(model="gpt-4o-mini", instructions="You execute travel plans. Book the items listed.")
35+
client = OpenAIResponsesClient()
36+
planner = Agent(client=client, name="planner", instructions="You plan trips. Output a bullet-point plan.")
37+
executor_agent = Agent(
38+
client=client, name="executor", instructions="You execute travel plans. Book the items listed."
39+
)
3640

3741
workflow = WorkflowBuilder(start_executor=planner).add_edge(planner, executor_agent).build()
3842

0 commit comments

Comments
 (0)