fix: disable thinking mode for structured JSON output requests - #34
Open
back2zion wants to merge 1 commit into
Open
fix: disable thinking mode for structured JSON output requests#34back2zion wants to merge 1 commit into
back2zion wants to merge 1 commit into
Conversation
Models with reasoning/thinking capabilities (e.g. Qwen3 with --reasoning-parser) emit <think> tags before generating content. When combined with response_format=json_object and vLLM's guided decoding, this causes an infinite abort-retry loop because the thinking tokens violate the JSON schema constraint. Automatically sets enable_thinking=false via chat_template_kwargs whenever structured JSON output is requested.
Pxls21
added a commit
to Pxls21/MiroFish-Offline
that referenced
this pull request
Jul 11, 2026
…knobs; hunks rejected where broken or regressive TAKEN: env-tunable parallelism (GRAPH_BUILD_BATCH_SIZE, PROFILE_PARALLEL_COUNT, PROFILE_SEARCH_WORKERS); ThreadPool chunk processing in graph_builder + neo4j add_text_batches; parallel edge/node searches + background profile writes in oasis_profile_generator; max_tokens=4000 on profile JSON calls (anti vLLM-infinite-generation), merged as a union with PR nikmcfly#34 enable_thinking. REJECTED (with reasons): - run.py debug=True hardcode + .env DEBUG=True: author debug leftovers - embedding_service URL hack (broken string-comment splice): PR nikmcfly#50 already landed the correct OpenAI-format auto-detect version - ALL report_agent.py hunks: they REGRESS prompts to Chinese-language guidance (undoing upstream 313fe64 English-only), gut the ReACT loop (min_tool_calls 3->0), and drop inter-section context in parallel gen - REPORT_PARALLEL_SECTIONS knob removed from config/.env: its only consumer was the rejected report_agent hunk; a dead knob is a lying knob
Pxls21
added a commit
to Pxls21/MiroFish-Offline
that referenced
this pull request
Jul 11, 2026
…erfactual endpoint FOUR increments (two staged commits squashed for transfer): 1. report_agent._ensure_prompt_budget -- deterministic chars/3 token guard on all 4 accumulated-context LLM calls; drops middle messages oldest- first, never system/instruction/final-turn; LLM_CONTEXT_WINDOW env (default 16384); fail-loud event report.context_truncated; raises with exact sizes when structurally impossible (gate-7 400 root cause). 2. llm_client.chat(disable_thinking=) opt-in extra_body flag (PR nikmcfly#34 only covered response_format) + defensive preamble strip at report-chat returns with report.chat_preamble_stripped event. 3. Twitter interview 400 fix: instance-level override of oasis perform_interview which double-prepends role=system (camel context creator already returns it) -- dedup at our call site, Reddit untouched; root-caused by reading installed camel-oasis 0.2.5 / camel-ai 0.2.78. 4. Counterfactual branch endpoint hand-ported from nativ3ai c492630: POST /api/simulation/<id>/counterfactual + manager clone/inject + scheduled-event firing in all 3 child round loops, instrumented (simulation.counterfactual_create span, sim.child.scheduled_event_fired instant span), comments Englishized. Backend only; Vue panels not ported (conflict with our PR nikmcfly#51 frontend picks -- separate decision).
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.
Summary
Models with reasoning/thinking capabilities (e.g. Qwen3 with
--reasoning-parser) emit<think>tags before generating content. When combined withresponse_format=json_objectand vLLM's guided decoding, this causes an infinite abort-retry loop — the thinking tokens violate the JSON schema, vLLM aborts, the client retries, and the process hangs indefinitely.This blocks persona generation at ~50-53 out of 75 agents every time.
Fix
Automatically sets
enable_thinking=falseviachat_template_kwargswhenever structured JSON output is requested, in both:llm_client.py(general LLM client used for ontology generation etc.)oasis_profile_generator.py(agent persona generation)Test plan
<think>tag contamination