forked from phoenix/litellm-mirror
fix(openai.py): fix timeout errors
This commit is contained in:
parent
3945bfadb7
commit
2750a26633
2 changed files with 4 additions and 2 deletions
|
@ -484,7 +484,7 @@ class OpenAITextCompletion(BaseLLM):
|
||||||
elif optional_params.get("stream", False):
|
elif optional_params.get("stream", False):
|
||||||
return self.streaming(logging_obj=logging_obj, api_base=api_base, data=data, headers=headers, model_response=model_response, model=model)
|
return self.streaming(logging_obj=logging_obj, api_base=api_base, data=data, headers=headers, model_response=model_response, model=model)
|
||||||
else:
|
else:
|
||||||
response = self._client_session.post(
|
response = httpx.post(
|
||||||
url=f"{api_base}",
|
url=f"{api_base}",
|
||||||
json=data,
|
json=data,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
|
@ -546,7 +546,7 @@ class OpenAITextCompletion(BaseLLM):
|
||||||
model_response: ModelResponse,
|
model_response: ModelResponse,
|
||||||
model: str
|
model: str
|
||||||
):
|
):
|
||||||
with self._client_session.stream(
|
with httpx.stream(
|
||||||
url=f"{api_base}",
|
url=f"{api_base}",
|
||||||
json=data,
|
json=data,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
|
|
|
@ -432,6 +432,7 @@ def test_completion_text_openai():
|
||||||
|
|
||||||
def test_completion_openai_with_optional_params():
|
def test_completion_openai_with_optional_params():
|
||||||
try:
|
try:
|
||||||
|
litellm.set_verbose = True
|
||||||
response = completion(
|
response = completion(
|
||||||
model="gpt-3.5-turbo",
|
model="gpt-3.5-turbo",
|
||||||
messages=messages,
|
messages=messages,
|
||||||
|
@ -450,6 +451,7 @@ test_completion_openai_with_optional_params()
|
||||||
|
|
||||||
def test_completion_openai_litellm_key():
|
def test_completion_openai_litellm_key():
|
||||||
try:
|
try:
|
||||||
|
litellm.set_verbose = False
|
||||||
litellm.api_key = os.environ['OPENAI_API_KEY']
|
litellm.api_key = os.environ['OPENAI_API_KEY']
|
||||||
|
|
||||||
# ensure key is set to None in .env and in openai.api_key
|
# ensure key is set to None in .env and in openai.api_key
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue