Skip to content

Commit

Permalink
add user and base64 encoding format literal (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketmaurya authored Dec 9, 2024
1 parent 9e0123c commit 39e86e6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/litserve/specs/openai_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@


class EmbeddingRequest(BaseModel):
input: Union[str, List[str]]
input: Union[str, List[str], List[int], List[List[int]]]
model: str
dimensions: Optional[int] = None
encoding_format: Literal["float"] = "float"
encoding_format: Literal["float", "base64"] = "float"
user: Optional[str] = None

def ensure_list(self):
return self.input if isinstance(self.input, list) else [self.input]
Expand Down Expand Up @@ -147,7 +148,7 @@ def _validate_response(self, response: dict) -> None:
f"{EMBEDDING_API_EXAMPLE}"
)

async def embeddings(self, request: EmbeddingRequest):
async def embeddings(self, request: EmbeddingRequest) -> EmbeddingResponse:
response_queue_id = self.response_queue_id
logger.debug("Received embedding request: %s", request)
uid = uuid.uuid4()
Expand Down

0 comments on commit 39e86e6

Please sign in to comment.