Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ysolanky committed Feb 8, 2025
1 parent 4f2cf93 commit 7a5a011
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions libs/agno/agno/models/ollama/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,70 +120,6 @@ def parse_provider_response(self, response: ChatResponse) -> ModelResponse:
)
return model_response

# def create_assistant_message(self, response: Mapping[str, Any], metrics: Metrics) -> Message:
# """
# Create an assistant message from the response.

# Args:
# response: The response from Ollama.
# metrics: The metrics for this response.

# Returns:
# Message: The assistant message.
# """
# message_data = MessageData()

# message_data.response_message = response.get("message")
# if message_data.response_message:
# message_data.response_content = message_data.response_message.get("content")
# message_data.response_role = message_data.response_message.get("role")

# assistant_message = Message(
# role=message_data.response_role or "assistant",
# content=message_data.response_content,
# )
# -*- Check if the response contains a tool call
# try:
# if message_data.response_content is not None:
# if "<tool_call>" in message_data.response_content and "</tool_call>" in message_data.response_content:
# # Break the response into tool calls
# tool_call_responses = message_data.response_content.split("</tool_call>")
# for tool_call_response in tool_call_responses:
# # Add back the closing tag if this is not the last tool call
# if tool_call_response != tool_call_responses[-1]:
# tool_call_response += "</tool_call>"

# if "<tool_call>" in tool_call_response and "</tool_call>" in tool_call_response:
# # Extract tool call string from response
# tool_call_content = extract_tool_call_from_string(tool_call_response)
# # Convert the extracted string to a dictionary
# try:
# tool_call_dict = json.loads(tool_call_content)
# except json.JSONDecodeError:
# raise ValueError(f"Could not parse tool call from: {tool_call_content}")

# tool_call_name = tool_call_dict.get("name")
# tool_call_args = tool_call_dict.get("arguments")
# function_def = {"name": tool_call_name}
# if tool_call_args is not None:
# function_def["arguments"] = json.dumps(tool_call_args)
# message_data.tool_calls.append(
# {
# "type": "function",
# "function": function_def,
# }
# )
# except Exception as e:
# logger.warning(e)
# pass

# if message_data.tool_calls is not None:
# assistant_message.tool_calls = message_data.tool_calls

# # -*- Update metrics
# self.update_usage_metrics(assistant_message=assistant_message, metrics=metrics, response=response)
# return assistant_message

def _create_function_call_result(
self, fc: FunctionCall, success: bool, output: Optional[Union[List[Any], str]], timer: Timer
) -> Message:
Expand Down

0 comments on commit 7a5a011

Please sign in to comment.