Add io struct for embedding models [unreachable code] - step 2/3 (#987)

This commit is contained in:
Ying Sheng
2024-08-08 00:52:31 -07:00
committed by GitHub
parent 0de7c2d09e
commit 20a4f927dc
4 changed files with 146 additions and 4 deletions

View File

@@ -294,3 +294,19 @@ class ChatCompletionStreamResponse(BaseModel):
created: int = Field(default_factory=lambda: int(time.time()))
model: str
choices: List[ChatCompletionResponseStreamChoice]
class EmbeddingRequest(BaseModel):
# Ordered by official OpenAI API documentation
# https://platform.openai.com/docs/api-reference/embeddings/create
input: Union[List[int], List[List[int]], str, List[str]]
model: str
encoding_format: str = "float"
dimensions: int = None
user: Optional[str] = None
class EmbeddingResponse(BaseModel):
index: str
embedding: List[float] = None
object: str = "embedding"