refactor(openai.py): working openai chat + text completion for openai v1 sdk

This commit is contained in:
Krrish Dholakia 2023-11-11 16:25:02 -08:00
parent 6d815d98fe
commit d0bd932b3c
6 changed files with 30 additions and 27 deletions

View file

@ -245,11 +245,11 @@ class OpenAIChatCompletion(BaseLLM):
api_base: str,
data: dict, headers: dict,
model_response: ModelResponse):
async with httpx.AsyncClient() as client:
async with httpx.AsyncClient(timeout=600) as client:
response = await client.post(api_base, json=data, headers=headers)
response_json = response.json()
if response.status != 200:
raise OpenAIError(status_code=response.status, message=response.text)
if response.status_code != 200:
raise OpenAIError(status_code=response.status_code, message=response.text)
## RESPONSE OBJECT