fix event loop exception handling to not mask legitimate errors

This commit is contained in:
Shoubhit Dash 2025-10-30 14:59:31 +05:30
parent 5a00ee1f0a
commit a185dc252b

View file

@ -260,7 +260,9 @@ class SupermemorySyncChatCompletions:
"Cannot use sync client from within an async context. "
"Use AsyncOpenAI with with_supermemory instead."
)
except RuntimeError:
except RuntimeError as e:
if "Cannot use sync client" in str(e):
raise
# No running loop, safe to use asyncio.run
return asyncio.run(self.wrapper._process_chat_completion(**kwargs))