From d7fc5ba4bd0d3fb3578cdd334f110497f5eb83e9 Mon Sep 17 00:00:00 2001 From: leoguillaume Date: Thu, 3 Oct 2024 17:21:40 +0200 Subject: [PATCH] fix(embeddings): check context length --- app/endpoints/embeddings.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/endpoints/embeddings.py b/app/endpoints/embeddings.py index b72015e..80526f0 100644 --- a/app/endpoints/embeddings.py +++ b/app/endpoints/embeddings.py @@ -25,8 +25,7 @@ async def embeddings(request: EmbeddingsRequest, user: User = Security(check_api url = f"{client.base_url}embeddings" headers = {"Authorization": f"Bearer {client.api_key}"} - if not client.check_context_length(model=request["model"], messages=request["messages"]): - raise HTTPException(status_code=400, detail="Context length too large") + # @TODO add check length ? async with httpx.AsyncClient(timeout=20) as async_client: response = await async_client.request(method="POST", url=url, headers=headers, json=request)