diff --git a/cookbook/agents/structured_output.py b/cookbook/agents/structured_output.py index eb2b89a91..056a9b473 100644 --- a/cookbook/agents/structured_output.py +++ b/cookbook/agents/structured_output.py @@ -19,7 +19,7 @@ class MovieScript(BaseModel): movie_agent = Agent( model=OpenAIChat(id="gpt-4o"), description="You help people write movie scripts.", - output_model=MovieScript, + response_model=MovieScript, # debug_mode=True, ) diff --git a/cookbook/agents/telemetry.py b/cookbook/agents/telemetry.py index 102d9014b..d898775f3 100644 --- a/cookbook/agents/telemetry.py +++ b/cookbook/agents/telemetry.py @@ -27,9 +27,11 @@ # print(m) # print("---") -# run: Iterator[RunResponse] = agent.run("What is the stock price of NVDA", stream=True) -# for chunk in run: -# print(chunk.content) +run: Iterator[RunResponse] = agent.run("What is the stock price of NVDA", stream=True) +for chunk in run: + print("---") + pprint(chunk.model_dump(exclude={"messages"})) + print("---") # async def main(): # async for chunk in await agent.arun("What is the stock price of NVDA", stream=True): @@ -37,4 +39,4 @@ # asyncio.run(main()) # agent.create_session() -agent.print_response("What is the stock price of NVDA?") +# agent.print_response("What is the stock price of NVDA?") diff --git a/phi/agent/agent.py b/phi/agent/agent.py index 0b9d1dabf..2a80fb993 100644 --- a/phi/agent/agent.py +++ b/phi/agent/agent.py @@ -913,7 +913,7 @@ def _run( run_id=self.run_response.run_id, content="Run started", model=self.run_response.model, - event=RunEvent.run_start, + event=RunEvent.run_start.value, ) # 2. Read existing session from storage diff --git a/phi/agent/response.py b/phi/agent/response.py index b49cd3f94..b5c44e8ea 100644 --- a/phi/agent/response.py +++ b/phi/agent/response.py @@ -27,7 +27,7 @@ class RunResponse(BaseModel): tools: Optional[List[Dict[str, Any]]] = None context: Optional[List[MessageContext]] = None model: Optional[str] = None - event: RunEvent = RunEvent.agent_response + event: str = RunEvent.agent_response.value created_at: int = Field(default_factory=lambda: int(time())) model_config = ConfigDict(arbitrary_types_allowed=True, use_enum_values=True)