Skip to content

Commit

Permalink
Update litellm
Browse files Browse the repository at this point in the history
  • Loading branch information
dnakov authored and trufae committed Nov 26, 2024
1 parent faee051 commit 00a6e71
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies = [
"boto3",
"colorama",
"textual",
"litellm",
"litellm==1.52.16",
"numpydoc"
]

Expand Down
2 changes: 1 addition & 1 deletion r2ai/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,4 @@ def chat(interpreter, **kwargs):
finally:
signal.signal(signal.SIGINT, original_handler)
spinner.stop()
litellm.in_memory_llm_clients_cache.clear()
litellm.in_memory_llm_clients_cache.flush_cache()
7 changes: 4 additions & 3 deletions r2ai/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def ddg(m):
return f"Considering:\n```{res}\n```\n"

def is_litellm_model(model):
from litellm import models_by_provider
import litellm
litellm.drop_params = True
provider = None
model_name = None
if model.startswith ("/"):
Expand All @@ -97,7 +98,7 @@ def is_litellm_model(model):
provider, model_name = model.split(":")
elif "/" in model:
provider, model_name = model.split("/")
if provider in models_by_provider and model_name in models_by_provider[provider]:
if provider in litellm.models_by_provider and (model_name in litellm.models_by_provider[provider] or model in litellm.models_by_provider[provider]):
return True
return False

Expand Down Expand Up @@ -423,8 +424,8 @@ def respond(self):
max_completion_tokens=maxtokens,
temperature=float(self.env["llm.temperature"]),
top_p=float(self.env["llm.top_p"]),
stop=self.terminator,
)

response = completion.choices[0].message.content
if "content" in self.messages[-1]:
last_message = self.messages[-1]["content"]
Expand Down

0 comments on commit 00a6e71

Please sign in to comment.