|
39 | 39 | from agno.run.team import TeamRunResponse |
40 | 40 | from agno.storage.base import Storage |
41 | 41 | from agno.storage.session.agent import AgentSession |
42 | | -from agno.tools.function import Function, FunctionCallResult |
| 42 | +from agno.tools.function import Function |
43 | 43 | from agno.tools.toolkit import Toolkit |
44 | 44 | from agno.utils.log import ( |
45 | 45 | log_debug, |
@@ -783,25 +783,11 @@ def _run( |
783 | 783 | } |
784 | 784 | # Process tool calls |
785 | 785 | for tool_call_dict in new_tool_calls_list: |
786 | | - print("--> 1") |
787 | 786 | tool_call_id = tool_call_dict.get("tool_call_id") |
788 | 787 | index = tool_call_index_map.get(tool_call_id) |
789 | 788 | if index is not None: |
790 | | - print("--> 2") |
791 | | - # process the FunctionCallResult |
792 | | - tool_result = tool_call_dict.get("tool_result") |
793 | | - if isinstance(tool_result, FunctionCallResult): |
794 | | - # Add any images from the tool result |
795 | | - print("--> 3") |
796 | | - if tool_result.images: |
797 | | - for image in tool_result.images: |
798 | | - self.add_image(image) |
799 | | - print("--> tool result images", tool_result) |
800 | | - tool_call_dict["tool_result"] = str(tool_result) |
801 | | - |
802 | 789 | self.run_response.tools[index] = tool_call_dict |
803 | 790 | else: |
804 | | - print("--> 4") |
805 | 791 | self.run_response.tools = new_tool_calls_list |
806 | 792 |
|
807 | 793 | # Only iterate through new tool calls |
@@ -878,14 +864,6 @@ def _run( |
878 | 864 |
|
879 | 865 | # For Reasoning/Thinking/Knowledge Tools update reasoning_content in RunResponse |
880 | 866 | for tool_call in model_response.tool_calls: |
881 | | - tool_result = tool_call.get("tool_result") |
882 | | - if isinstance(tool_result, FunctionCallResult): |
883 | | - # Add any images from the tool result |
884 | | - if tool_result.images: |
885 | | - for image in tool_result.images: |
886 | | - self.add_image(image) |
887 | | - # Update the tool call result with the string content |
888 | | - tool_call_dict["tool_result"] = str(tool_result) |
889 | 867 | tool_name = tool_call.get("tool_name", "") |
890 | 868 | if tool_name.lower() in ["think", "analyze"]: |
891 | 869 | tool_args = tool_call.get("tool_args", {}) |
@@ -1673,7 +1651,8 @@ async def _arun( |
1673 | 1651 | # Add AgentRun to memory |
1674 | 1652 | self.memory.add_run(session_id=session_id, run=self.run_response) |
1675 | 1653 |
|
1676 | | - await self._amake_memories_and_summaries(run_messages, session_id, user_id, messages) # type: ignore |
| 1654 | + # type: ignore |
| 1655 | + await self._amake_memories_and_summaries(run_messages, session_id, user_id, messages) |
1677 | 1656 |
|
1678 | 1657 | if self.session_metrics is None: |
1679 | 1658 | self.session_metrics = self.calculate_metrics(run_messages.messages) # Calculate metrics for the run |
@@ -2620,7 +2599,8 @@ def add_introduction(self, introduction: str) -> None: |
2620 | 2599 | response=RunResponse( |
2621 | 2600 | content=introduction, |
2622 | 2601 | messages=[ |
2623 | | - Message(role=self.model.assistant_message_role, content=introduction) # type: ignore |
| 2602 | + # type: ignore |
| 2603 | + Message(role=self.model.assistant_message_role, content=introduction) |
2624 | 2604 | ], |
2625 | 2605 | ) |
2626 | 2606 | ) |
@@ -2731,7 +2711,8 @@ def get_system_message(self, session_id: str, user_id: Optional[str] = None) -> |
2731 | 2711 | and (not self.use_json_mode or self.structured_outputs is True) |
2732 | 2712 | ) |
2733 | 2713 | ): |
2734 | | - sys_message_content += f"\n{get_json_output_prompt(self.response_model)}" # type: ignore |
| 2714 | + # type: ignore |
| 2715 | + sys_message_content += f"\n{get_json_output_prompt(self.response_model)}" |
2735 | 2716 |
|
2736 | 2717 | # type: ignore |
2737 | 2718 | return Message(role=self.system_message_role, content=sys_message_content) |
@@ -2965,7 +2946,8 @@ def get_system_message(self, session_id: str, user_id: Optional[str] = None) -> |
2965 | 2946 | (self.model.supports_native_structured_outputs or self.model.supports_json_schema_outputs) |
2966 | 2947 | and (not self.use_json_mode or self.structured_outputs is True) |
2967 | 2948 | ): |
2968 | | - system_message_content += f"{get_json_output_prompt(self.response_model)}" # type: ignore |
| 2949 | + # type: ignore |
| 2950 | + system_message_content += f"{get_json_output_prompt(self.response_model)}" |
2969 | 2951 |
|
2970 | 2952 | # Return the system message |
2971 | 2953 | return ( |
@@ -3489,7 +3471,8 @@ def get_relevant_docs_from_knowledge( |
3489 | 3471 | if invalid_keys: |
3490 | 3472 | # type: ignore |
3491 | 3473 | log_warning(f"Invalid filter keys provided: {invalid_keys}. These filters will be ignored.") |
3492 | | - log_info(f"Valid filter keys are: {self.knowledge.valid_metadata_filters}") # type: ignore |
| 3474 | + # type: ignore |
| 3475 | + log_info(f"Valid filter keys are: {self.knowledge.valid_metadata_filters}") |
3493 | 3476 |
|
3494 | 3477 | # Only use valid filters |
3495 | 3478 | filters = valid_filters |
@@ -3546,7 +3529,8 @@ async def aget_relevant_docs_from_knowledge( |
3546 | 3529 | # Warn about invalid filter keys |
3547 | 3530 | if invalid_keys: # type: ignore |
3548 | 3531 | log_warning(f"Invalid filter keys provided: {invalid_keys}. These filters will be ignored.") |
3549 | | - log_info(f"Valid filter keys are: {self.knowledge.valid_metadata_filters}") # type: ignore |
| 3532 | + # type: ignore |
| 3533 | + log_info(f"Valid filter keys are: {self.knowledge.valid_metadata_filters}") |
3550 | 3534 |
|
3551 | 3535 | # Only use valid filters |
3552 | 3536 | filters = valid_filters |
@@ -4036,7 +4020,8 @@ def reason(self, run_messages: RunMessages, session_id: Optional[str] = None) -> |
4036 | 4020 | from agno.reasoning.helpers import get_next_action, update_messages_with_reasoning |
4037 | 4021 |
|
4038 | 4022 | # Get default reasoning agent |
4039 | | - reasoning_agent: Optional[Agent] = self.reasoning_agent # type: ignore |
| 4023 | + # type: ignore |
| 4024 | + reasoning_agent: Optional[Agent] = self.reasoning_agent |
4040 | 4025 | if reasoning_agent is None: |
4041 | 4026 | reasoning_agent = get_default_reasoning_agent( |
4042 | 4027 | reasoning_model=reasoning_model, |
@@ -4247,7 +4232,8 @@ async def areason(self, run_messages: RunMessages, session_id: Optional[str] = N |
4247 | 4232 | from agno.reasoning.helpers import get_next_action, update_messages_with_reasoning |
4248 | 4233 |
|
4249 | 4234 | # Get default reasoning agent |
4250 | | - reasoning_agent: Optional[Agent] = self.reasoning_agent # type: ignore |
| 4235 | + # type: ignore |
| 4236 | + reasoning_agent: Optional[Agent] = self.reasoning_agent |
4251 | 4237 | if reasoning_agent is None: |
4252 | 4238 | reasoning_agent = get_default_reasoning_agent( |
4253 | 4239 | reasoning_model=reasoning_model, |
|
0 commit comments