Repository navigation
Studio: Inkling support fixes - #7153
Conversation
…soning effort, audio icon)
There was a problem hiding this comment.
Code Review
This pull request introduces support for the Inkling model architecture, including handling its custom reasoning effort levels, estimating its compute buffer requirements, and parsing its native tool call format (<|content_invoke_tool_json|>). It also adds audio attachment detection in the frontend to display appropriate icons and labels. The review feedback suggests retrieving the Hugging Face token via huggingface_hub.get_token() to support cached local logins, using safe dictionary access in llama_cpp.py to prevent a potential KeyError, and ensuring consistent contentType extraction for audio attachments in the frontend.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if not hf_token: | ||
| hf_token = os.environ.get("HF_TOKEN") or None | ||
| env["HF_HUB_DISABLE_IMPLICIT_TOKEN"] = "0" if hf_token else "1" |
There was a problem hiding this comment.
When retrieving the Hugging Face token, retrieve it using huggingface_hub.get_token() instead of only checking os.environ.get('HF_TOKEN'). This ensures cached local logins are also supported. Additionally, ensure the token is explicitly set in the env dictionary.
| if not hf_token: | |
| hf_token = os.environ.get("HF_TOKEN") or None | |
| env["HF_HUB_DISABLE_IMPLICIT_TOKEN"] = "0" if hf_token else "1" | |
| if not hf_token: | |
| import huggingface_hub | |
| hf_token = huggingface_hub.get_token() or os.environ.get("HF_TOKEN") | |
| if hf_token: | |
| env["HF_TOKEN"] = hf_token | |
| env["HF_HUB_DISABLE_IMPLICIT_TOKEN"] = "0" if hf_token else "1" |
References
- When verifying or scanning gated or private Hugging Face models, retrieve the Hugging Face token using huggingface_hub.get_token() instead of only checking os.environ.get('HF_TOKEN') to support cached local logins.
| logger.info( | ||
| f"{prefix}model supports reasoning " | ||
| f"(reasoning_effort: {flags['reasoning_effort_levels'] or 'default levels'})" | ||
| ) |
There was a problem hiding this comment.
If the scanned template does not contain both 'low' and 'high', the key 'reasoning_effort_levels' is not added to the flags dictionary. Accessing flags['reasoning_effort_levels'] directly in the logging statement will then raise a KeyError. Use flags.get('reasoning_effort_levels') to safely handle this case.
| logger.info( | |
| f"{prefix}model supports reasoning " | |
| f"(reasoning_effort: {flags['reasoning_effort_levels'] or 'default levels'})" | |
| ) | |
| logger.info( | |
| f"{prefix}model supports reasoning " | |
| f"(reasoning_effort: {flags.get('reasoning_effort_levels') or 'default levels'})" | |
| ) |
| return isAudioAttachment( | ||
| attachment.name, | ||
| (attachment as { file?: File }).file?.type ?? "", | ||
| ) | ||
| ? "Audio" | ||
| : "File"; |
There was a problem hiding this comment.
In AttachmentUI, the extraction of contentType only checks (attachment as { file?: File }).file?.type and misses (attachment as { contentType?: string }).contentType. This is inconsistent with AttachmentThumb (lines 131-136) and will fail to identify audio attachments that only have a top-level contentType property (e.g., when loaded from history without a local File object). Extract the content type consistently.
const contentType =
(attachment as { file?: File }).file?.type ??
(attachment as { contentType?: string }).contentType ??
"";
return isAudioAttachment(attachment.name, contentType) ? "Audio" : "File";
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0986589089
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "<|tool_calls_section_begin|>", | ||
| "<|tool_call_begin|>", | ||
| # TML Inkling native call marker. | ||
| "<|content_invoke_tool_json|>", |
There was a problem hiding this comment.
Strip Inkling tool markup after parsing it
When Inkling emits a text tool call such as <|message_model|>web_search<|content_invoke_tool_json|>{...}<|end_message|>, this new signal now makes the GGUF loop parse and execute the call, but strip_tool_markup(..., final=True) still has no pattern for this marker. The loop uses that stripped value as content_text before appending the assistant tool-call message, so the raw marker/JSON remains in conversation history (and can leak back into chat) after a successfully executed Inkling tool call.
Useful? React with 👍 / 👎.
| kwargs["enable_thinking"] = enable_thinking | ||
| if self._supports_preserve_thinking and preserve_thinking is not None: | ||
| kwargs["preserve_thinking"] = preserve_thinking | ||
| self._coerce_reasoning_effort(kwargs) |
There was a problem hiding this comment.
Accept xhigh/max before coercing Inkling effort
For pure reasoning_effort models, the frontend can now advertise and send xhigh/max levels, and _coerce_reasoning_effort has mappings for them, but this branch only puts none|low|medium|high (plus minimal as low) into kwargs before the coercion call. An Inkling request with reasoning_effort: "max" or "xhigh" and no enable_thinking therefore returns no chat_template_kwargs, so the selected top effort is silently ignored instead of being mapped to 0.99.
Useful? React with 👍 / 👎.
| const clampedReasoningEffort = | ||
| reasoningStyle === "enable_thinking_effort" | ||
| reasoningStyle === "enable_thinking_effort" || | ||
| reasoningStyle === "reasoning_effort" |
There was a problem hiding this comment.
Surface None in the shared composer too
This path now preserves backend-advertised levels for pure reasoning_effort models, including Inkling's "none" effort, but the shared/Compare composer still does .filter((level) => level !== "none") when rendering its Think menu. Loading the same Inkling model through that composer therefore exposes the richer levels in state while still giving the user no way to pick effort 0/None there, unlike the regular thread composer updated in this commit.
Useful? React with 👍 / 👎.
| # [n_kv, ub, n_head] f32 (~402 KiB per context token at ub=512); size the | ||
| # fit for that so a q8_0 cache gets a small honest context instead of an | ||
| # unloadable one that crash-loops the server. | ||
| if cache_type_kv and _kv_bytes_per_elem(cache_type_kv) < 2.0: |
There was a problem hiding this comment.
Account for inherited quantized Inkling caches
This check only charges the dense Inkling fallback when the collapsed cache_type_kv argument is a quantized type, but Studio intentionally leaves inherited quantized LLAMA_ARG_CACHE_TYPE_K/V env settings as None for budgeting and can also collapse asymmetric extras to the heavier f16 axis. In those supported configurations the child still runs with a quantized KV cache, but this branch takes the 8 KiB/token banded estimate instead of the ~402 KiB/token dense reserve, so auto-fit can again select an unloadable context and crash-loop.
Useful? React with 👍 / 👎.
| "[TOOL_CALLS]", | ||
| # TML Inkling native call marker (leaks as text when the server-side | ||
| # parser misses a narration-then-call turn). | ||
| "<|content_invoke_tool_json|>", |
There was a problem hiding this comment.
Keep the Inkling name echo in the stream buffer
In streaming passthrough, _earliest_signal now starts holding at <|content_invoke_tool_json|> and immediately emits everything before it as text. For Inkling's documented <|message_model|>NAME<|content_invoke_tool_json|>{...} shape, that means the bare role/name echo is already sent to the client before tool_healing can fold it into the promoted span, so streaming healed turns leak visible <|message_model|>lookup/lookup text ahead of the structured tool call.
Useful? React with 👍 / 👎.
| "<|tool_calls_section_begin|>", | ||
| "<|tool_call_begin|>", | ||
| # TML Inkling native call marker. | ||
| "<|content_invoke_tool_json|>", |
There was a problem hiding this comment.
Treat Inkling blocks as outer tool envelopes
Adding the Inkling marker to the shared signal list makes the parser wake up for these blocks, but _marker_inside_leading_envelope still does not recognize <|content_invoke_tool_json|> as the outer call. If an Inkling argument string contains a literal DeepSeek/Kimi marker (for example a search query about <|tool_call_begin|>web_search:0...), the pre-pass parses that inner text first and returns the wrong tool call instead of the surrounding Inkling JSON.
Useful? React with 👍 / 👎.
Fixes accumulated while bringing TML Inkling up in Studio on multi-GPU B200s.
Backend
<|content_invoke_tool_json|>{...}blocks, optionally preceded by a bare tool-name echo. Teach tool healing, the strict parser, and passthrough healing to recognize the marker, accept theargskey alias, and trim the name echo so narration-then-call turns never leak raw JSON into chat.HF_TOKENso private repos resolve instead of failing with 401.Frontend
reasoning_efforttemplates and surfaces the template'snonelevel when there is no dedicated off toggle.Tests