mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
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.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user