fix the tool call but cause unreach model#330
Closed
locnguyen1986 wants to merge 7 commits intoreleasefrom
Closed
Conversation
…/janhq/jan-server into feat/fix-handling-invalid-format
fix the parsing issue
louis-jan
previously approved these changes
Dec 19, 2025
Contributor
There was a problem hiding this comment.
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
ToolChoicefield 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_resultcontent 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.
Fix trimming handling on image arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix the tool call but cause unreach model