Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
c9f09a4f
Unverified
Commit
c9f09a4f
authored
Jan 10, 2025
by
Fred Reiss
Committed by
GitHub
Jan 11, 2025
Browse files
[mypy] Fix mypy warnings in api_server.py (#11941)
Signed-off-by:
Fred Reiss
<
frreiss@us.ibm.com
>
parent
d45cbe70
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
vllm/entrypoints/openai/api_server.py
vllm/entrypoints/openai/api_server.py
+5
-3
No files found.
vllm/entrypoints/openai/api_server.py
View file @
c9f09a4f
...
@@ -14,7 +14,7 @@ from argparse import Namespace
...
@@ -14,7 +14,7 @@ from argparse import Namespace
from
contextlib
import
asynccontextmanager
from
contextlib
import
asynccontextmanager
from
functools
import
partial
from
functools
import
partial
from
http
import
HTTPStatus
from
http
import
HTTPStatus
from
typing
import
AsyncIterator
,
Optional
,
Set
,
Tuple
from
typing
import
AsyncIterator
,
Dict
,
Optional
,
Set
,
Tuple
,
Union
import
uvloop
import
uvloop
from
fastapi
import
APIRouter
,
FastAPI
,
HTTPException
,
Request
from
fastapi
import
APIRouter
,
FastAPI
,
HTTPException
,
Request
...
@@ -420,6 +420,8 @@ async def create_embedding(request: EmbeddingRequest, raw_request: Request):
...
@@ -420,6 +420,8 @@ async def create_embedding(request: EmbeddingRequest, raw_request: Request):
"use the Pooling API (`/pooling`) instead."
)
"use the Pooling API (`/pooling`) instead."
)
res
=
await
fallback_handler
.
create_pooling
(
request
,
raw_request
)
res
=
await
fallback_handler
.
create_pooling
(
request
,
raw_request
)
generator
:
Union
[
ErrorResponse
,
EmbeddingResponse
]
if
isinstance
(
res
,
PoolingResponse
):
if
isinstance
(
res
,
PoolingResponse
):
generator
=
EmbeddingResponse
(
generator
=
EmbeddingResponse
(
id
=
res
.
id
,
id
=
res
.
id
,
...
@@ -494,7 +496,7 @@ async def create_score_v1(request: ScoreRequest, raw_request: Request):
...
@@ -494,7 +496,7 @@ async def create_score_v1(request: ScoreRequest, raw_request: Request):
return
await
create_score
(
request
,
raw_request
)
return
await
create_score
(
request
,
raw_request
)
TASK_HANDLERS
=
{
TASK_HANDLERS
:
Dict
[
str
,
Dict
[
str
,
tuple
]]
=
{
"generate"
:
{
"generate"
:
{
"messages"
:
(
ChatCompletionRequest
,
create_chat_completion
),
"messages"
:
(
ChatCompletionRequest
,
create_chat_completion
),
"default"
:
(
CompletionRequest
,
create_completion
),
"default"
:
(
CompletionRequest
,
create_completion
),
...
@@ -652,7 +654,7 @@ def build_app(args: Namespace) -> FastAPI:
...
@@ -652,7 +654,7 @@ def build_app(args: Namespace) -> FastAPI:
module_path
,
object_name
=
middleware
.
rsplit
(
"."
,
1
)
module_path
,
object_name
=
middleware
.
rsplit
(
"."
,
1
)
imported
=
getattr
(
importlib
.
import_module
(
module_path
),
object_name
)
imported
=
getattr
(
importlib
.
import_module
(
module_path
),
object_name
)
if
inspect
.
isclass
(
imported
):
if
inspect
.
isclass
(
imported
):
app
.
add_middleware
(
imported
)
app
.
add_middleware
(
imported
)
# type: ignore[arg-type]
elif
inspect
.
iscoroutinefunction
(
imported
):
elif
inspect
.
iscoroutinefunction
(
imported
):
app
.
middleware
(
"http"
)(
imported
)
app
.
middleware
(
"http"
)(
imported
)
else
:
else
:
...
...
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