From 81cd269318a5b258cc7eb6153e861dfc57c74ca4 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 e863715cf..2a38c1c01 100644 --- a/lib/crewai/src/crewai/llms/providers/anthropic/completion.py +++ b/lib/crewai/src/crewai/llms/providers/anthropic/completion.py @@ -123,6 +123,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, @@ -142,6 +143,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: @@ -292,6 +294,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: