Skip to content

Commit

Permalink
Better error handling for empty responses
Browse files Browse the repository at this point in the history
  • Loading branch information
caufieldjh committed May 31, 2024
1 parent 0efa39a commit dd22be0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ontogpt/clients/llm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ def complete(self, prompt, show_prompt: bool = False, **kwargs) -> str:
except Exception as e:
print(f"Encountered error: {type(e)}, Error: {e}")

payload = response.choices[0].message.content
if response is not None:
payload = response.choices[0].message.content
else:
logger.error(f"No response or response is empty.")
payload = ""

return payload

Expand Down

0 comments on commit dd22be0

Please sign in to comment.