fix input with array type (#96, #107)

This commit is contained in:
josc146 2023-07-17 12:59:45 +08:00
parent e2a7c93753
commit 9b3b06ab04

View File

@ -1,7 +1,7 @@
import asyncio import asyncio
import json import json
from threading import Lock from threading import Lock
from typing import List from typing import List, Union
import base64 import base64
from fastapi import APIRouter, Request, status, HTTPException from fastapi import APIRouter, Request, status, HTTPException
@ -44,7 +44,7 @@ class ChatCompletionBody(ModelConfigBody):
class CompletionBody(ModelConfigBody): class CompletionBody(ModelConfigBody):
prompt: str or List[str] prompt: Union[str, List[str]]
model: str = "rwkv" model: str = "rwkv"
stream: bool = False stream: bool = False
stop: str = None stop: str = None
@ -326,7 +326,7 @@ async def completions(body: CompletionBody, request: Request):
class EmbeddingsBody(BaseModel): class EmbeddingsBody(BaseModel):
input: str or List[str] or List[List[int]] input: Union[str, List[str], List[List[int]]]
model: str = "rwkv" model: str = "rwkv"
encoding_format: str = None encoding_format: str = None
fast_mode: bool = False fast_mode: bool = False