forked from phoenix/litellm-mirror
update streaming
This commit is contained in:
parent
8fbaf14509
commit
fa441e9a3e
5 changed files with 4 additions and 2 deletions
BIN
dist/litellm-0.1.646-py3-none-any.whl
vendored
Normal file
BIN
dist/litellm-0.1.646-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
dist/litellm-0.1.646.tar.gz
vendored
Normal file
BIN
dist/litellm-0.1.646.tar.gz
vendored
Normal file
Binary file not shown.
Binary file not shown.
|
@ -2495,13 +2495,15 @@ class CustomStreamWrapper:
|
||||||
completion_obj["content"] = self.handle_cohere_chunk(chunk)
|
completion_obj["content"] = self.handle_cohere_chunk(chunk)
|
||||||
else: # openai chat/azure models
|
else: # openai chat/azure models
|
||||||
chunk = next(self.completion_stream)
|
chunk = next(self.completion_stream)
|
||||||
completion_obj["content"] = chunk["choices"][0]["delta"]["content"]
|
completion_obj = chunk["choices"][0]["delta"]
|
||||||
|
|
||||||
# LOGGING
|
# LOGGING
|
||||||
threading.Thread(target=self.logging_obj.success_handler, args=(completion_obj,)).start()
|
threading.Thread(target=self.logging_obj.success_handler, args=(completion_obj,)).start()
|
||||||
# return this for all models
|
# return this for all models
|
||||||
model_response = ModelResponse(stream=True)
|
model_response = ModelResponse(stream=True)
|
||||||
model_response.choices[0].delta.content = completion_obj["content"]
|
model_response.choices[0].delta.content = completion_obj["content"]
|
||||||
|
if "role" in completion_obj:
|
||||||
|
model_response.choices[0].delta.role = completion_obj["role"]
|
||||||
return model_response
|
return model_response
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "litellm"
|
name = "litellm"
|
||||||
version = "0.1.646"
|
version = "0.1.647"
|
||||||
description = "Library to easily interface with LLM API providers"
|
description = "Library to easily interface with LLM API providers"
|
||||||
authors = ["BerriAI"]
|
authors = ["BerriAI"]
|
||||||
license = "MIT License"
|
license = "MIT License"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue