Skip to content

Commit

Permalink
fix-openaichat-model-metrics-phi-1233
Browse files Browse the repository at this point in the history
  • Loading branch information
ysolanky committed Sep 19, 2024
1 parent 814903f commit cfcaad3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion phi/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,10 @@ def _run(
12. Log Agent Run
"""
# Create the run_response object
run_response = RunResponse(run_id=str(uuid4()), model=self.model.model if self.model is not None else None)
run_response = RunResponse(
run_id=str(uuid4()),
model=self.model.model if self.model is not None else None,
)

logger.debug(f"*********** Agent Run Start: {run_response.run_id} ***********")
# 1. Read existing session from storage
Expand Down Expand Up @@ -942,6 +945,9 @@ def _run(
run_response.content = model_response.content
run_response.messages = run_messages

# Add the model metrics to the run_response
run_response.metrics = self.model.metrics if self.model else {}

# 9. Update Memory
# Add the user message to memory
if message is not None:
Expand Down
4 changes: 3 additions & 1 deletion phi/playground/playground.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def agent_get():
),
enable_rag=agent.enable_rag,
tools=formatted_tools,
memory={"name": agent.memory.db.__class__.__name__} if agent.memory and agent.memory.db else None,
memory={"name": agent.memory.db.__class__.__name__}
if agent.memory and agent.memory.db
else None,
storage={"name": agent.storage.__class__.__name__} if agent.storage else None,
knowledge={"name": agent.knowledge.__class__.__name__} if agent.knowledge else None,
description=agent.description,
Expand Down

0 comments on commit cfcaad3

Please sign in to comment.