Skip to content

Commit

Permalink
API base with non-openai providers
Browse files Browse the repository at this point in the history
  • Loading branch information
KillianLucas committed Mar 20, 2024
1 parent f6f9dd2 commit 987f59b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion interpreter/core/llm/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def run(self, messages):
params["api_key"] = self.api_key
if self.api_base:
params["api_base"] = self.api_base
params["custom_llm_provider"] = "openai"
if self.api_version:
params["api_version"] = self.api_version
if self.max_tokens:
Expand Down
14 changes: 8 additions & 6 deletions interpreter/terminal_interface/start_terminal_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ def start_terminal_interface(interpreter):
"nargs": "?", # This means you can pass in nothing if you want
},
{"name": "profiles", "help_text": "opens profiles directory", "type": bool},
{"name": "local_models", "help_text": "opens local models directory", "type": bool},
{
"name": "local_models",
"help_text": "opens local models directory",
"type": bool,
},
{
"name": "conversations",
"help_text": "list conversations to resume",
Expand Down Expand Up @@ -304,7 +308,7 @@ def start_terminal_interface(interpreter):
if args.profiles:
open_storage_dir("profiles")
return

if args.local_models:
open_storage_dir("models")
return
Expand Down Expand Up @@ -381,8 +385,7 @@ def start_terminal_interface(interpreter):
except:
# Doesn't matter
pass



if interpreter.llm.api_base:
if (
not interpreter.llm.model.lower().startswith("openai/")
Expand All @@ -391,12 +394,11 @@ def start_terminal_interface(interpreter):
and not interpreter.llm.model.lower().startswith("jan")
and not interpreter.llm.model.lower().startswith("local")
):
interpreter.llm.model = "openai/" + interpreter.llm.model
interpreter.llm.model = "openai/" + interpreter.llm.model
elif interpreter.llm.model.lower().startswith("jan/"):
# Strip jan/ from the model name
interpreter.llm.model = interpreter.llm.model[4:]


# If --conversations is used, run conversation_navigator
if args.conversations:
conversation_navigator(interpreter)
Expand Down

0 comments on commit 987f59b

Please sign in to comment.