Skip to content

fix the tool call but cause unreach model#330

Closed
locnguyen1986 wants to merge 7 commits intoreleasefrom
main
Closed

fix the tool call but cause unreach model#330
locnguyen1986 wants to merge 7 commits intoreleasefrom
main

Conversation

@locnguyen1986
Copy link
Collaborator

fix the tool call but cause unreach model

Copilot AI review requested due to automatic review settings December 19, 2025 11:01
louis-jan
louis-jan previously approved these changes Dec 19, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses two distinct issues: clearing ToolChoice when no tools are present to prevent provider validation errors, and refining error handling to properly distinguish between platform errors and LLM communication errors.

  • Clears ToolChoice field when no tools are present in requests (both streaming and non-streaming)
  • Adds explicit error handling for platform errors (NotFound, Forbidden, Unauthorized, Conflict) to prevent them from triggering fallback responses
  • Adds support for tool_result content type in flexible content parts

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
services/llm-api/internal/utils/httpclients/chat/chat_completion_client.go Added logic to clear ToolChoice when Tools array is empty in both CreateChatCompletion and doStreamingRequest methods
services/llm-api/internal/interfaces/httpserver/routes/v1/chat/completion_route.go Added explicit error type handling for NotFound, Forbidden, Unauthorized, and Conflict errors before falling back to LLM error handling
services/llm-api/internal/interfaces/httpserver/requests/chat/chat.go Added support for tool_result content type, converting it to text parts for OpenAI compatibility
services/llm-api/internal/interfaces/httpserver/handlers/chathandler/chat_handler.go Updated error message for conversation not found to be more user-friendly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants