@@ -59,12 +59,14 @@ def run(self, messages):
59
59
), "No message after the first can have the role 'system'"
60
60
61
61
# 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
68
70
69
71
# Trim image messages if they're there
70
72
if self .supports_vision :
@@ -89,7 +91,7 @@ def run(self, messages):
89
91
# Convert to OpenAI messages format
90
92
messages = convert_to_openai_messages (
91
93
messages ,
92
- function_calling = supports_functions ,
94
+ function_calling = self . supports_functions ,
93
95
vision = self .supports_vision ,
94
96
shrink_images = self .interpreter .shrink_images ,
95
97
)
@@ -193,7 +195,7 @@ def run(self, messages):
193
195
if self .interpreter .verbose :
194
196
litellm .set_verbose = True
195
197
196
- if supports_functions :
198
+ if self . supports_functions :
197
199
yield from run_function_calling_llm (self , params )
198
200
else :
199
201
yield from run_text_llm (self , params )
0 commit comments