Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Frontend] Add add_special_tokens parameter to CompletionRequest #6637

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions vllm/entrypoints/openai/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ class CompletionRequest(OpenAIBaseModel):
"Whether to include the stop string in the output. "
"This is only applied when the stop or stop_token_ids is set."),
)
add_special_tokens: Optional[bool] = Field(
default=True,
description=(
"If true, special tokens (e.g. BOS) will be added to the prompt."
"Default is True (same as HuggingFace Tokenizer)."),
)
response_format: Optional[ResponseFormat] = Field(
default=None,
description=
Expand Down
1 change: 1 addition & 0 deletions vllm/entrypoints/openai/serving_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ async def create_completion(self, request: CompletionRequest,
tokenizer,
truncate_prompt_tokens=sampling_params.
truncate_prompt_tokens,
add_special_tokens=request.add_special_tokens,
**{prompt_arg: prompt})
prompt_ids, prompt_text = prompt_formats

Expand Down
Loading