Repository navigation
feat(llm): setting to skip json_object on OpenAI-compatible providers (#4935) - #5261
Merged
Merged
Conversation
…_object per deployment Whether the OpenAI-compatible provider sends response_format=json_object on the soft structured-output path was keyed off a hardcoded provider-name list (lmstudio/ollama/volcano skip it, llamacpp follows LLAMACPP_NO_GRAMMAR). A provider=openai pointed at a local server that can't constrain output had no way to opt out, and such a server can rewrite the prompt in ways a thinking model loops on until the LLM timeout (#4935). The new tri-state setting overrides that default in both directions; unset keeps today's behaviour.
This was referenced Oct 8, 2026
Merged
This was referenced Oct 16, 2026
Merged
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.
Closes #4935.
Problem
On the soft (non-strict) structured-output path, the OpenAI-compatible provider decides whether to send
response_format={"type": "json_object"}from a hardcoded provider-name list:lmstudio,ollamaandvolcanoskip it,llamacppfollowsHINDSIGHT_API_LLAMACPP_NO_GRAMMAR, and every other provider sends it.provider=openaiwith a custombase_urlpointing at a local server is a common setup, and it had no way to opt out. The reporter's local server can't constrain output, so it rewrites the prompt with its own "respond with valid JSON only" line instead. A thinking model loops on that line until the LLM timeout. The same request withoutjson_objectreturned valid JSON in 77 s.Change
HINDSIGHT_API_LLM_OPENAI_COMPATIBLE_JSON_MODE, following theHINDSIGHT_API_LLM_VISIONpattern:false: never sendjson_object; the schema goes in the prompt onlytrue: always sendjson_objectOpenAICompatibleLLM._supports_json_mode().LLM_SUPPORTS_MAX_ITEMS,LLM_STRUCTURED_OUTPUT_FORCED_TOOL).This doesn't make a weak model write JSON. It only drops a request that some servers mishandle.
Tests
tests/test_llm_strict_schema.pynow covers the provider defaults (openaisendsjson_object,lmstudiodoesn't), both overrides, and reading the setting from the environment. The docs,.env.exampleand the hindsight-embed copy of the template are updated.