mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 18:24:20 +00:00
Merge 747689f6af
into b82af5b826
This commit is contained in:
commit
20142380cc
1 changed files with 6 additions and 2 deletions
|
@ -14,10 +14,14 @@ class LLMClientCache(InMemoryCache):
|
|||
If none, use the key as is.
|
||||
"""
|
||||
try:
|
||||
event_loop = asyncio.get_event_loop()
|
||||
try:
|
||||
event_loop = asyncio.get_running_loop()
|
||||
except RuntimeError:
|
||||
event_loop = asyncio.new_event_loop()
|
||||
|
||||
stringified_event_loop = str(id(event_loop))
|
||||
return f"{key}-{stringified_event_loop}"
|
||||
except Exception: # handle no current event loop
|
||||
except Exception: # handle other potential errors
|
||||
return key
|
||||
|
||||
def set_cache(self, key, value, **kwargs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue