Skip to content

Commit

Permalink
Move comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzh72 committed Nov 27, 2024
1 parent ef8983f commit ca46223
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions letta/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,11 +555,11 @@ def _get_ai_reply(
raise ValueError(f"API call returned an empty message: {response}")

if response.choices[0].finish_reason not in ["stop", "function_call", "tool_calls"]:
raise ValueError(f"Bad finish reason from API: {response.choices[0].finish_reason}")

# This is not retryable, hence RuntimeError v.s. ValueError
if response.choices[0].finish_reason == "length":
raise RuntimeError("Finish reason was length (maximum context length)")
if response.choices[0].finish_reason == "length":
# This is not retryable, hence RuntimeError v.s. ValueError
raise RuntimeError("Finish reason was length (maximum context length)")
else:
raise ValueError(f"Bad finish reason from API: {response.choices[0].finish_reason}")

return response

Expand Down

0 comments on commit ca46223

Please sign in to comment.