ping Sentry when Claude response is too long
This commit is contained in:
parent
c092418e47
commit
f7d0dbb7ce
@ -151,7 +151,11 @@ async def stream_claude_response(
|
|||||||
|
|
||||||
# Return final message
|
# Return final message
|
||||||
response = await stream.get_final_message()
|
response = await stream.get_final_message()
|
||||||
|
|
||||||
|
# Log stop reason
|
||||||
print("[STOP REASON] " + str(response.stop_reason))
|
print("[STOP REASON] " + str(response.stop_reason))
|
||||||
|
if response.stop_reason == "max_tokens":
|
||||||
|
sentry_sdk.capture_exception(Exception("Claude response too long"))
|
||||||
|
|
||||||
# Close the Anthropic client
|
# Close the Anthropic client
|
||||||
await client.close()
|
await client.close()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user