Add comprehensive tool calls support for Google and Anthropic providers

GoogleProviderHandler enhancements:
- Process all parts in response content (not just first part)
- Extract and combine all text parts
- Detect and convert Google function_call to OpenAI tool_calls format
- Generate unique call IDs for tool calls
- Handle function responses for debugging
- Set content to None when tool_calls are present (OpenAI convention)
- Add comprehensive logging for tool call detection and conversion
- Support both text and function/tool calls in same response
- Validate response against ChatCompletionResponse Pydantic model
- Add detailed response structure logging

AnthropicProviderHandler enhancements:
- Process all content blocks (not just text)
- Detect and convert Anthropic tool_use blocks to OpenAI tool_calls format
- Generate unique call IDs for tool calls
- Combine all text parts from multiple blocks
- Set content to None when tool_calls are present (OpenAI convention)
- Add comprehensive logging for tool_use detection and conversion
- Validate response against ChatCompletionResponse Pydantic model
- Add detailed response structure logging

Both handlers now properly translate provider-specific function calling
formats to OpenAI-compatible tool_calls structure, ensuring clients receive
valid structured responses with proper schema validation.
parent 627f1407
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment