Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
yifanmai committed Nov 6, 2024
1 parent 0ea9771 commit c26ce0f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/helm/clients/openai_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ def do_it() -> Dict[str, Any]:
cache_key = self._get_cache_key(raw_request, request)
response, cached = self.cache.get(cache_key, wrap_request_time(do_it))
except openai.OpenAIError as e:
# error: str = f"OpenAI error: {e}"
raise e
# return RequestResult(success=False, cached=False, error=error, completions=[], embedding=[])
error: str = f"OpenAI error: {e}"
return RequestResult(success=False, cached=False, error=error, completions=[], embedding=[])

# If the user is requesting completions instead of an embedding, then `completions`
# needs to be populated, and `embedding` should be an empty list and vice-versa.
Expand Down Expand Up @@ -232,9 +231,8 @@ def do_it() -> Dict[str, Any]:
embedding=[],
)

raise e
# error: str = f"OpenAI error: {e}"
# return RequestResult(success=False, cached=False, error=error, completions=[], embedding=[])
error: str = f"OpenAI error: {e}"
return RequestResult(success=False, cached=False, error=error, completions=[], embedding=[])

completions: List[GeneratedOutput] = []
for raw_completion in response["choices"]:
Expand Down Expand Up @@ -301,9 +299,8 @@ def do_it() -> Dict[str, Any]:
cache_key = self._get_cache_key(raw_request, request)
response, cached = self.cache.get(cache_key, wrap_request_time(do_it))
except openai.OpenAIError as e:
# error: str = f"OpenAI error: {e}"
raise e
# return RequestResult(success=False, cached=False, error=error, completions=[], embedding=[])
error: str = f"OpenAI error: {e}"
return RequestResult(success=False, cached=False, error=error, completions=[], embedding=[])

completions: List[GeneratedOutput] = []
for raw_completion in response["choices"]:
Expand Down

0 comments on commit c26ce0f

Please sign in to comment.