From 6150a358a312fe2ed134bbb07a60bda018fddd92 Mon Sep 17 00:00:00 2001 From: lorenzejay Date: Tue, 14 Oct 2025 15:34:28 -0700 Subject: [PATCH] feat: enhance AnthropicCompletion class with additional client parameters and tool handling - Added support for client_params in the AnthropicCompletion class to allow for additional client configuration. - Refactored client initialization to use a dedicated method for retrieving client parameters. - Implemented a new method to handle tool use conversation flow, ensuring proper execution and response handling. - Introduced comprehensive test cases to validate the functionality of the AnthropicCompletion class, including tool use scenarios and parameter handling. --- lib/crewai/src/crewai/llms/providers/anthropic/completion.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/crewai/src/crewai/llms/providers/anthropic/completion.py b/lib/crewai/src/crewai/llms/providers/anthropic/completion.py index ffcaf3077..a90f06573 100644 --- a/lib/crewai/src/crewai/llms/providers/anthropic/completion.py +++ b/lib/crewai/src/crewai/llms/providers/anthropic/completion.py @@ -124,6 +124,7 @@ class AnthropicCompletion(BaseLLM): Chat completion response or tool call result """ try: + print("we are calling", messages) # Emit call started event self._emit_call_started_event( messages=messages, @@ -143,6 +144,7 @@ class AnthropicCompletion(BaseLLM): completion_params = self._prepare_completion_params( formatted_messages, system_message, tools ) + print("completion_params", completion_params) # Handle streaming vs non-streaming if self.stream: @@ -298,6 +300,7 @@ class AnthropicCompletion(BaseLLM): ) -> str | Any: """Handle non-streaming message completion.""" try: + print("params", params) response: Message = self.client.messages.create(**params) except Exception as e: