Merge branch 'main' into hosted

This commit is contained in:
Abi Raja 2024-03-19 12:09:31 -04:00
commit 785a135460

View File

@ -114,6 +114,10 @@ async def stream_claude_response(
# Return final message # Return final message
response = await stream.get_final_message() response = await stream.get_final_message()
# Close the Anthropic client
await client.close()
return response.content[0].text return response.content[0].text
@ -178,6 +182,9 @@ async def stream_claude_response_native(
f"Token usage: Input Tokens: {response.usage.input_tokens}, Output Tokens: {response.usage.output_tokens}" f"Token usage: Input Tokens: {response.usage.input_tokens}, Output Tokens: {response.usage.output_tokens}"
) )
# Close the Anthropic client
await client.close()
if not response: if not response:
raise Exception("No HTML response found in AI response") raise Exception("No HTML response found in AI response")
else: else: