unsloth/studio/backend/core/inference
Daniel Han 5ec1208206 Fix consensus review findings on PR 5711
Round 3 of 3-Opus parallel review (2 reviewers HIGH on the persistence
chain, 2 HIGH on the routing chain, 1 HIGH on the test coverage gap).

HIGH fixes:
1. chat-runtime-store.ts: PERSISTED_INFERENCE_PARAM_KEYS extended from
   16 to 44 keys (28 extended samplers added). Before this, any value
   set on the Advanced Sampling sliders was lost on page reload because
   getChangedInferenceParams / getHydratedSettingsState iterate this
   list.
2. routes/chat_history.py: ChatInferenceSettings (extra="forbid")
   extended to mirror InferenceParams including fastMode + 28 new
   samplers. Without this every settings PUT containing any of those
   fields would 422.
3. routes/inference.py _build_openai_passthrough_body: was forwarding
   typical_p / mirostat / dynatemp but silently dropping dry_*, xtc_*,
   min_keep, ignore_eos, min_tokens, vLLM output knobs (skip/spaces
   special-tokens, include_stop_str_in_output, truncate_prompt_tokens),
   and llama.cpp instrumentation flags (n_keep, n_probs, cache_prompt,
   return_tokens, timings_per_token, post_sampling_probs). Now forwards
   all 18 to _build_passthrough_payload.
4. routes/inference.py _proxy_to_external_provider + external_provider.py
   stream_chat_completion: 20 extended kwargs are now plumbed through
   the route -> client -> OAI-compat body builder. Before this fix the
   chat-adapter computed top_a / vLLM output knobs / llama.cpp samplers
   on the frontend, sent them on the wire, and the route layer dropped
   them on the floor.
5. test_sampling_params_routing.py: extended
   test_chat_settings_payload_accepts_new_sampling_keys to round-trip
   every persisted field (was only 5). Added
   test_openrouter_forwards_top_a and test_vllm_forwards_output_shape_knobs
   to lock in the new wire forwarding.

MEDIUM fixes:
- providers.py: Mistral stop_max=4 (matches third-party shims; OAI docs
  publish no max but every consumer caps at 4).
- providers.py: Kimi body_omit now includes "presence_penalty" (Kimi
  k2.5/k2.6 chat schema lists temperature/top_p/max_tokens/stream/tools/
  tool_choice/thinking but not presence_penalty).
- external_provider.py: body_omit loop also pops the seed_field
  rename so a future provider with both `seed_field="random_seed"` and
  `body_omit=("seed",)` strips correctly. No current provider has both;
  defensive only.
- chat-adapter.ts: local-path parallel_tool_calls forwards only on
  explicit opt-out (matches the external-path stanza). Before this the
  field was sent on every chat from every existing local user.
- chat-settings-sheet.tsx: service tier Select now clamps the displayed
  value to a legal option for the active provider (e.g. "priority"
  saved on OpenAI, then user switches to Anthropic which only allows
  auto/standard_only -> Radix Select was showing a blank trigger).

LOW fixes:
- Em-dash cleanup: 7 em-dashes removed from provider-capabilities.ts /
  runtime.ts / chat-settings-sheet.tsx / test_sampling_params_routing.py
  per project rules.

Tests: 397/397 backend pass (sampling routing 69 plus anthropic /
openai / gemini / llama-server suites). Frontend tsc + vite build clean.
2026-05-27 16:32:21 +00:00
..
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
_html_to_md.py fix: studio web search SSL failures and empty page content (#4754) 2026-04-01 06:12:02 -07:00
anthropic_compat.py Tighten comments across PR 5711 (no behaviour change) 2026-05-27 14:32:11 +00:00
audio_codecs.py Add native GGUF intake to Studio (#5246) 2026-05-04 11:46:18 +02:00
chat_template_helpers.py Studio: tools, thinking blocks, code execution and web search for safetensors (#5520) 2026-05-19 06:30:17 -07:00
defaults.py studio: engage draft-mtp on vision MTP GGUFs (drop incorrect vision gate) (#5560) 2026-05-18 08:42:55 -07:00
external_provider.py Fix consensus review findings on PR 5711 2026-05-27 16:32:21 +00:00
inference.py Studio: tools, thinking blocks, code execution and web search for safetensors (#5520) 2026-05-19 06:30:17 -07:00
key_exchange.py studio: API external provider support for chat (OpenAI, Mistral, Gemini, Cohere, Anthropic, OpenRouter, DeepSeek, custom providers) (#4706) 2026-05-14 16:13:59 +04:00
llama_cpp.py Tighten comments across PR 5711 (no behaviour change) 2026-05-27 14:32:11 +00:00
llama_server_args.py Studio: expose --parallel / -np flag on unsloth studio run (#5737) 2026-05-26 23:13:45 -07:00
mcp_client.py Studio: add remote MCP server support (#5750) 2026-05-27 07:01:11 -07:00
mlx_inference.py Studio: tools, thinking blocks, code execution and web search for safetensors (#5520) 2026-05-19 06:30:17 -07:00
orchestrator.py Apply parallel_tool_calls cap to Anthropic passthrough + safetensors path (PR #5711) 2026-05-24 18:46:07 +00:00
pricing.py Studio: pricing follow-up to #5690 (longest-prefix match + chat-style usage keys) (#5722) 2026-05-25 23:39:58 -07:00
providers.py Fix consensus review findings on PR 5711 2026-05-27 16:32:21 +00:00
safetensors_agentic.py Apply parallel_tool_calls cap to Anthropic passthrough + safetensors path (PR #5711) 2026-05-24 18:46:07 +00:00
tool_call_parser.py Studio: add remote MCP server support (#5750) 2026-05-27 07:01:11 -07:00
tools.py Studio: add remote MCP server support (#5750) 2026-05-27 07:01:11 -07:00
worker.py Studio: tools, thinking blocks, code execution and web search for safetensors (#5520) 2026-05-19 06:30:17 -07:00