Skip to content

Commit c7ff254

Browse files
committed
2 parents 81c0b08 + 9a44661 commit c7ff254

File tree

4 files changed

+378
-363
lines changed

4 files changed

+378
-363
lines changed

interpreter/core/llm/llm.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ def run(self, messages):
5959
), "No message after the first can have the role 'system'"
6060

6161
# Detect function support
62-
if self.supports_functions != None:
63-
supports_functions = self.supports_functions
64-
elif litellm.supports_function_calling(self.model):
65-
supports_functions = True
66-
else:
67-
supports_functions = False
62+
if self.supports_functions == None:
63+
try:
64+
if litellm.supports_function_calling(self.model):
65+
self.supports_functions = True
66+
else:
67+
self.supports_functions = False
68+
except:
69+
self.supports_functions = False
6870

6971
# Trim image messages if they're there
7072
if self.supports_vision:
@@ -89,7 +91,7 @@ def run(self, messages):
8991
# Convert to OpenAI messages format
9092
messages = convert_to_openai_messages(
9193
messages,
92-
function_calling=supports_functions,
94+
function_calling=self.supports_functions,
9395
vision=self.supports_vision,
9496
shrink_images=self.interpreter.shrink_images,
9597
)
@@ -193,7 +195,7 @@ def run(self, messages):
193195
if self.interpreter.verbose:
194196
litellm.set_verbose = True
195197

196-
if supports_functions:
198+
if self.supports_functions:
197199
yield from run_function_calling_llm(self, params)
198200
else:
199201
yield from run_text_llm(self, params)

interpreter/terminal_interface/profiles/defaults/local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def download_model(models_dir, models, interpreter):
214214
215215
"""
216216
)
217-
217+
interpreter.llm.supports_functions = False
218218
interpreter.llm.api_base = "http://localhost:1234/v1"
219219
interpreter.llm.api_key = "x"
220220

0 commit comments

Comments
 (0)