fix(completion): respect configured OpenAI prompt templates - #4529
Open
chyroc wants to merge 1 commit into
Open
Conversation
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
prompt_templateforopenai/completionandopenai/legacy_completion.prompt/suffixtransportwhen no template is configured.
/v1/completionspayload.Context
Related to #4523, for the OpenAI-compatible completion path only. This change
does not modify
vllm/completionand does not claim to resolve the issue'sreported vLLM behavior.
PR #3341 intentionally gave the OpenAI aliases Tabby's generic
{prefix}<|FIM|>{suffix}default. This change keeps that default whenprompt_templateis absent or empty, but lets an explicit model-specifictemplate override it. An explicitly configured template containing Tabby's
internal
<|FIM|>marker also retains the existing splitprompt/suffixtransport.
deepseek/completion,mistral/completion, andvllm/completionkeep their current behavior.Test plan
CARGO_NET_OFFLINE=true cargo test --locked -p http-api-bindings --lib cargo fmt --all -- --check CARGO_NET_OFFLINE=true cargo clippy --locked -p http-api-bindings \ --all-targets --no-deps -- -D warnings git diff --checkResults: 6 affected-crate tests passed, 0 failed, and 3 existing network
integration tests were ignored. The regression starts a loopback HTTP server
and checks the request path and complete JSON body for a configured Qwen-style
template, the default fallback, and an explicit internal FIM template.
The workspace-wide test command was also attempted, but this shallow checkout
does not contain the recursive
llama.cppsubmodule, so the unchangedllama-cpp-serverbuild script stopped before workspace tests ran.