-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
Description
Sorry for not providing a reproducible example, but just for illustration, in my test code running the agent will obey the structured output fields, while agent2 will make up extra JSON fields in the final_output, triggering various Pydantic JSON validation errors. Am I using ModelSettings correctly?
openai 1.100.2
openai-agents 0.2.8
from pydantic import BaseModel
from agents import Agent
class CalendarEvent(BaseModel):
name: str
date: str
participants: list[str]
agent = Agent(
name="Calendar extractor",
instructions="Extract calendar events from text",
output_type=CalendarEvent,
model="gpt-5"
)
agent2 = Agent(
name="Calendar extractor 2",
instructions="Extract calendar events from text",
output_type=CalendarEvent,
model="gpt-5",
model_settings=ModelSettings(
reasoning={"effort":"low"},
extra_body={"text":{"verbosity":"low"}}
),
)