-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Computer Update (updated
litellm
)
- Loading branch information
1 parent
1f0efce
commit f25002d
Showing
7 changed files
with
672 additions
and
713 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import json | ||
import re | ||
|
||
|
||
def merge_deltas(original, delta): | ||
""" | ||
Pushes the delta into the original and returns that. | ||
Great for reconstructing OpenAI streaming responses -> complete message objects. | ||
""" | ||
for key, value in delta.items(): | ||
if isinstance(value, dict): | ||
if key not in original: | ||
original[key] = value | ||
else: | ||
merge_deltas(original[key], value) | ||
else: | ||
if key in original: | ||
original[key] += value | ||
|
||
for key, value in dict(delta).items(): | ||
if value != None: | ||
if isinstance(value, str): | ||
if key in original: | ||
original[key] += value | ||
else: | ||
original[key] = value | ||
else: | ||
original[key] = value | ||
value = dict(value) | ||
if key not in original: | ||
original[key] = value | ||
else: | ||
merge_deltas(original[key], value) | ||
|
||
return original |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,14 +9,13 @@ authors = ["Killian Lucas <[email protected]>"] | |
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.8" | ||
python = ">=3.9,<4.0" | ||
|
||
appdirs = "^1.4.4" | ||
astor = "^0.8.1" | ||
git-python = "^1.0.3" | ||
inquirer = "^3.1.3" | ||
litellm = "0.13.2" | ||
openai = "^0.28.0" | ||
litellm = "^1.15.10" | ||
pyyaml = "^6.0.1" | ||
rich = "^13.4.2" | ||
six = "^1.16.0" | ||
|