Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
40facad5
Unverified
Commit
40facad5
authored
Jul 26, 2024
by
Toshiki Kataoka
Committed by
GitHub
Jul 26, 2024
Browse files
feat: support token ids in /v1/completions (#736)
parent
da504445
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
python/sglang/srt/openai_api/adapter.py
python/sglang/srt/openai_api/adapter.py
+6
-1
No files found.
python/sglang/srt/openai_api/adapter.py
View file @
40facad5
...
...
@@ -94,9 +94,14 @@ def load_chat_template_for_openai_api(chat_template_arg):
async
def
v1_completions
(
tokenizer_manager
,
raw_request
:
Request
):
request_json
=
await
raw_request
.
json
()
request
=
CompletionRequest
(
**
request_json
)
prompt
=
request
.
prompt
if
isinstance
(
prompt
,
str
)
or
isinstance
(
prompt
[
0
],
str
):
prompt_kwargs
=
{
"text"
:
prompt
}
else
:
prompt_kwargs
=
{
"input_ids"
:
prompt
}
adapted_request
=
GenerateReqInput
(
text
=
request
.
prompt
,
**
prompt_kwargs
,
sampling_params
=
{
"temperature"
:
request
.
temperature
,
"max_new_tokens"
:
request
.
max_tokens
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment