Skip to content

Commit

Permalink
New Computer Update (updated litellm)
Browse files Browse the repository at this point in the history
  • Loading branch information
KillianLucas committed Dec 27, 2023
1 parent 1f0efce commit f25002d
Show file tree
Hide file tree
Showing 7 changed files with 672 additions and 713 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion interpreter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

if sys.version_info < (3, 10) or sys.version_info >= (3, 12):
print(
"\nWARNING: You are running Open Interpreter on an unsupported version of Python, so you may encounter unexpected errors. Please install Python 3.10 or 3.11 at https://www.python.org/downloads/\n"
"\nYou are running Open Interpreter on an unsupported version of Python, so you may encounter unexpected errors. Please install Python 3.10 or 3.11 at https://www.python.org/downloads/\n"
)

from .core.core import OpenInterpreter
Expand Down
1 change: 1 addition & 0 deletions interpreter/core/llm/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def run(self, messages):
self.interpreter.llm.model != "gpt-4-vision-preview"
and self.model in litellm.open_ai_chat_completion_models
or self.model.startswith("azure/")
# Once Litellm supports it, add Anthropic models here
):
supports_functions = True
else:
Expand Down
2 changes: 1 addition & 1 deletion interpreter/core/llm/run_function_calling_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def run_function_calling_llm(llm, request_params):
yield {"type": "message", "content": delta["content"]}

if (
"function_call" in accumulated_deltas
accumulated_deltas.get("function_call")
and "arguments" in accumulated_deltas["function_call"]
):
if (
Expand Down
28 changes: 14 additions & 14 deletions interpreter/core/llm/utils/merge_deltas.py
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
1,345 changes: 652 additions & 693 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f25002d

Please sign in to comment.