Spaces:
Paused
Paused
add api as proxy
Browse files- api_server.py +4 -4
api_server.py
CHANGED
@@ -111,7 +111,7 @@ async def detokenize(request: DetokenizeRequest):
|
|
111 |
return JSONResponse(content=generator.model_dump())
|
112 |
|
113 |
|
114 |
-
@router.get("/v1/models")
|
115 |
async def show_available_models():
|
116 |
models = await openai_serving_completion.show_available_models()
|
117 |
return JSONResponse(content=models.model_dump())
|
@@ -123,7 +123,7 @@ async def show_version():
|
|
123 |
return JSONResponse(content=ver)
|
124 |
|
125 |
|
126 |
-
@router.post("/v1/chat/completions")
|
127 |
async def create_chat_completion(request: ChatCompletionRequest,
|
128 |
raw_request: Request):
|
129 |
generator = await openai_serving_chat.create_chat_completion(
|
@@ -139,7 +139,7 @@ async def create_chat_completion(request: ChatCompletionRequest,
|
|
139 |
return JSONResponse(content=generator.model_dump())
|
140 |
|
141 |
|
142 |
-
@router.post("/v1/completions")
|
143 |
async def create_completion(request: CompletionRequest, raw_request: Request):
|
144 |
generator = await openai_serving_completion.create_completion(
|
145 |
request, raw_request)
|
@@ -153,7 +153,7 @@ async def create_completion(request: CompletionRequest, raw_request: Request):
|
|
153 |
return JSONResponse(content=generator.model_dump())
|
154 |
|
155 |
|
156 |
-
@router.post("/v1/embeddings")
|
157 |
async def create_embedding(request: EmbeddingRequest, raw_request: Request):
|
158 |
generator = await openai_serving_embedding.create_embedding(
|
159 |
request, raw_request)
|
|
|
111 |
return JSONResponse(content=generator.model_dump())
|
112 |
|
113 |
|
114 |
+
@router.get("/api/v1/models")
|
115 |
async def show_available_models():
|
116 |
models = await openai_serving_completion.show_available_models()
|
117 |
return JSONResponse(content=models.model_dump())
|
|
|
123 |
return JSONResponse(content=ver)
|
124 |
|
125 |
|
126 |
+
@router.post("/api/v1/chat/completions")
|
127 |
async def create_chat_completion(request: ChatCompletionRequest,
|
128 |
raw_request: Request):
|
129 |
generator = await openai_serving_chat.create_chat_completion(
|
|
|
139 |
return JSONResponse(content=generator.model_dump())
|
140 |
|
141 |
|
142 |
+
@router.post("/api/v1/completions")
|
143 |
async def create_completion(request: CompletionRequest, raw_request: Request):
|
144 |
generator = await openai_serving_completion.create_completion(
|
145 |
request, raw_request)
|
|
|
153 |
return JSONResponse(content=generator.model_dump())
|
154 |
|
155 |
|
156 |
+
@router.post("/api/v1/embeddings")
|
157 |
async def create_embedding(request: EmbeddingRequest, raw_request: Request):
|
158 |
generator = await openai_serving_embedding.create_embedding(
|
159 |
request, raw_request)
|