forked from phoenix/litellm-mirror
Add async iterator to fix/enable streaming responses
This commit is contained in:
parent
5bcf612724
commit
4d009a94b9
1 changed files with 11 additions and 1 deletions
|
@ -1568,6 +1568,7 @@ def get_or_generate_uuid():
|
||||||
uuid_value = uuid_value.strip()
|
uuid_value = uuid_value.strip()
|
||||||
else:
|
else:
|
||||||
raise FileNotFoundError
|
raise FileNotFoundError
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
# Generate a new UUID if the file doesn't exist or is empty
|
# Generate a new UUID if the file doesn't exist or is empty
|
||||||
new_uuid = uuid.uuid4()
|
new_uuid = uuid.uuid4()
|
||||||
|
@ -1637,6 +1638,9 @@ class CustomStreamWrapper:
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def __aiter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
def logging(self, text):
|
def logging(self, text):
|
||||||
if self.logging_obj:
|
if self.logging_obj:
|
||||||
self.logging_obj.post_call(text)
|
self.logging_obj.post_call(text)
|
||||||
|
@ -1744,6 +1748,12 @@ class CustomStreamWrapper:
|
||||||
except:
|
except:
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
|
|
||||||
|
async def __anext__(self):
|
||||||
|
try:
|
||||||
|
return next(self)
|
||||||
|
except StopIteration:
|
||||||
|
raise StopAsyncIteration
|
||||||
|
|
||||||
|
|
||||||
########## Reading Config File ############################
|
########## Reading Config File ############################
|
||||||
def read_config_args(config_path):
|
def read_config_args(config_path):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue