Skip to content

Commit

Permalink
Fix model_response.extra
Browse files Browse the repository at this point in the history
  • Loading branch information
ysolanky committed Feb 12, 2025
1 parent c8dafa9 commit b5d3477
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
2 changes: 0 additions & 2 deletions libs/agno/agno/models/aws/claude.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from dataclasses import dataclass
from os import getenv
from typing import Any, Dict, Optional
Expand Down Expand Up @@ -115,4 +114,3 @@ def request_kwargs(self) -> Dict[str, Any]:
if self.request_params:
_request_params.update(self.request_params)
return _request_params

10 changes: 5 additions & 5 deletions libs/agno/agno/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def response(self, messages: List[Message]) -> ModelResponse:

# Format and add results to messages
self.format_function_call_results(
messages=messages, function_call_results=function_call_results, **model_response.extra
messages=messages, function_call_results=function_call_results, **model_response.extra or {}
)

logger.debug(f"---------- {self.get_provider()} Response ----------")
Expand Down Expand Up @@ -249,7 +249,7 @@ async def aresponse(self, messages: List[Message]) -> ModelResponse:

# Format and add results to messages
self.format_function_call_results(
messages=messages, function_call_results=function_call_results, **model_response.extra
messages=messages, function_call_results=function_call_results, **model_response.extra or {}
)

# Check if we should stop after tool calls
Expand Down Expand Up @@ -288,7 +288,7 @@ def _process_model_response(
assistant_message.metrics.stop_timer()

# Parse provider response
provider_response = self.parse_provider_response(response)
provider_response: ModelResponse = self.parse_provider_response(response)

# Add parsed data to model response
if provider_response.parsed is not None:
Expand Down Expand Up @@ -338,7 +338,7 @@ async def _aprocess_model_response(
assistant_message.metrics.stop_timer()

# Parse provider response
provider_response = self.parse_provider_response(response)
provider_response: ModelResponse = self.parse_provider_response(response)

# Add parsed data to model response
if provider_response.parsed is not None:
Expand Down Expand Up @@ -1084,4 +1084,4 @@ def __deepcopy__(self, memo):

# Clear the new model to remove any references to the old model
new_model.clear()
return new_model
return new_model
1 change: 0 additions & 1 deletion libs/agno/agno/models/cohere/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ def _process_stream_response(
assistant_message.tool_calls.append(tool_use)
tool_use = {}


elif (
response.type == "message-end"
and response.delta is not None
Expand Down
1 change: 0 additions & 1 deletion libs/agno/agno/models/groq/groq.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ def parse_tool_calls(tool_calls_data: List[ChoiceDeltaToolCall]) -> List[Dict[st
tool_call_entry["type"] = _tool_call_type
return tool_calls


def parse_provider_response(self, response: ChatCompletion) -> ModelResponse:
"""
Parse the Groq response into a ModelResponse.
Expand Down
1 change: 0 additions & 1 deletion libs/agno/agno/models/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class ModelResponse:
extra: Optional[Dict[str, Any]] = None



class FileType(str, Enum):
MP4 = "mp4"
GIF = "gif"

0 comments on commit b5d3477

Please sign in to comment.