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
e3046ea3
"...git@developer.sourcefind.cn:OpenDAS/lmdeploy.git" did not exist on "e8ab4ba33785c348235c1ef932c7671e7e64687d"
Unverified
Commit
e3046ea3
authored
Jul 19, 2024
by
Mingyi
Committed by
GitHub
Jul 19, 2024
Browse files
Update OpenAI API (#667)
parent
49c5e0ec
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
6 deletions
+8
-6
python/sglang/srt/conversation.py
python/sglang/srt/conversation.py
+1
-1
python/sglang/srt/openai_api/adapter.py
python/sglang/srt/openai_api/adapter.py
+2
-1
python/sglang/srt/openai_api/protocol.py
python/sglang/srt/openai_api/protocol.py
+1
-0
python/sglang/srt/server.py
python/sglang/srt/server.py
+2
-2
python/sglang/test/test_conversation.py
python/sglang/test/test_conversation.py
+1
-1
python/sglang/test/test_openai_protocol.py
python/sglang/test/test_openai_protocol.py
+1
-1
No files found.
python/sglang/srt/conversation.py
View file @
e3046ea3
...
@@ -6,7 +6,7 @@ import dataclasses
...
@@ -6,7 +6,7 @@ import dataclasses
from
enum
import
IntEnum
,
auto
from
enum
import
IntEnum
,
auto
from
typing
import
Dict
,
List
,
Optional
,
Tuple
,
Union
from
typing
import
Dict
,
List
,
Optional
,
Tuple
,
Union
from
sglang.srt.openai_protocol
import
ChatCompletionRequest
from
sglang.srt.openai_
api.
protocol
import
ChatCompletionRequest
class
SeparatorStyle
(
IntEnum
):
class
SeparatorStyle
(
IntEnum
):
...
...
python/sglang/srt/openai_api
_
adapter.py
→
python/sglang/srt/openai_api
/
adapter.py
View file @
e3046ea3
...
@@ -16,7 +16,7 @@ from sglang.srt.conversation import (
...
@@ -16,7 +16,7 @@ from sglang.srt.conversation import (
register_conv_template
,
register_conv_template
,
)
)
from
sglang.srt.managers.io_struct
import
GenerateReqInput
from
sglang.srt.managers.io_struct
import
GenerateReqInput
from
sglang.srt.openai_protocol
import
(
from
sglang.srt.openai_
api.
protocol
import
(
ChatCompletionRequest
,
ChatCompletionRequest
,
ChatCompletionResponse
,
ChatCompletionResponse
,
ChatCompletionResponseChoice
,
ChatCompletionResponseChoice
,
...
@@ -106,6 +106,7 @@ async def v1_completions(tokenizer_manager, raw_request: Request):
...
@@ -106,6 +106,7 @@ async def v1_completions(tokenizer_manager, raw_request: Request):
"frequency_penalty"
:
request
.
frequency_penalty
,
"frequency_penalty"
:
request
.
frequency_penalty
,
"regex"
:
request
.
regex
,
"regex"
:
request
.
regex
,
"n"
:
request
.
n
,
"n"
:
request
.
n
,
"ignore_eos"
:
request
.
ignore_eos
,
},
},
return_logprob
=
request
.
logprobs
is
not
None
and
request
.
logprobs
>
0
,
return_logprob
=
request
.
logprobs
is
not
None
and
request
.
logprobs
>
0
,
top_logprobs_num
=
request
.
logprobs
if
request
.
logprobs
is
not
None
else
0
,
top_logprobs_num
=
request
.
logprobs
if
request
.
logprobs
is
not
None
else
0
,
...
...
python/sglang/srt/openai_protocol.py
→
python/sglang/srt/openai_
api/
protocol.py
View file @
e3046ea3
...
@@ -68,6 +68,7 @@ class CompletionRequest(BaseModel):
...
@@ -68,6 +68,7 @@ class CompletionRequest(BaseModel):
# Extra parameters for SRT backend only and will be ignored by OpenAI models.
# Extra parameters for SRT backend only and will be ignored by OpenAI models.
regex
:
Optional
[
str
]
=
None
regex
:
Optional
[
str
]
=
None
ignore_eos
:
Optional
[
bool
]
=
False
class
CompletionResponseChoice
(
BaseModel
):
class
CompletionResponseChoice
(
BaseModel
):
...
...
python/sglang/srt/server.py
View file @
e3046ea3
...
@@ -39,12 +39,12 @@ from sglang.srt.managers.controller.manager_single import (
...
@@ -39,12 +39,12 @@ from sglang.srt.managers.controller.manager_single import (
from
sglang.srt.managers.detokenizer_manager
import
start_detokenizer_process
from
sglang.srt.managers.detokenizer_manager
import
start_detokenizer_process
from
sglang.srt.managers.io_struct
import
GenerateReqInput
from
sglang.srt.managers.io_struct
import
GenerateReqInput
from
sglang.srt.managers.tokenizer_manager
import
TokenizerManager
from
sglang.srt.managers.tokenizer_manager
import
TokenizerManager
from
sglang.srt.openai_api
_
adapter
import
(
from
sglang.srt.openai_api
.
adapter
import
(
load_chat_template_for_openai_api
,
load_chat_template_for_openai_api
,
v1_chat_completions
,
v1_chat_completions
,
v1_completions
,
v1_completions
,
)
)
from
sglang.srt.openai_protocol
import
ModelCard
,
ModelList
from
sglang.srt.openai_
api.
protocol
import
ModelCard
,
ModelList
from
sglang.srt.server_args
import
PortArgs
,
ServerArgs
from
sglang.srt.server_args
import
PortArgs
,
ServerArgs
from
sglang.srt.utils
import
(
from
sglang.srt.utils
import
(
API_KEY_HEADER_NAME
,
API_KEY_HEADER_NAME
,
...
...
python/sglang/test/test_conversation.py
View file @
e3046ea3
from
sglang.srt.conversation
import
generate_chat_conv
from
sglang.srt.conversation
import
generate_chat_conv
from
sglang.srt.managers.openai_protocol
import
(
from
sglang.srt.managers.openai_
api.
protocol
import
(
ChatCompletionMessageContentImagePart
,
ChatCompletionMessageContentImagePart
,
ChatCompletionMessageContentImageURL
,
ChatCompletionMessageContentImageURL
,
ChatCompletionMessageContentTextPart
,
ChatCompletionMessageContentTextPart
,
...
...
python/sglang/test/test_openai_protocol.py
View file @
e3046ea3
from
sglang.srt.managers.openai_protocol
import
(
from
sglang.srt.managers.openai_
api.
protocol
import
(
ChatCompletionMessageContentImagePart
,
ChatCompletionMessageContentImagePart
,
ChatCompletionMessageContentImageURL
,
ChatCompletionMessageContentImageURL
,
ChatCompletionMessageContentTextPart
,
ChatCompletionMessageContentTextPart
,
...
...
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