Skip to content

Commit

Permalink
Add try/catch block
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiping Kang committed Dec 10, 2024
1 parent 16d668f commit 11f0973
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions jac-mtllm/mtllm/aott.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,27 @@ def aott_raise(
if not (contains_media and not is_custom)
else meaning_typed_input_list
)
return model(meaning_typed_input, media=media, **model_params) # type: ignore

if is_custom:
try:
# This is a temporary solution to enable passing in custom
# parameters to custom models
# custom model should override the __call__ method to
# accept function_inputs parameter
return model(
meaning_typed_input, # type: ignore
media=media, # type: ignore
function_inputs=inputs_information, # type: ignore
**model_params,
)
except TypeError:
# this is for backward compatibility,
# for any existing custom models that do not have the
# function_inputs parameter
return model(
meaning_typed_input, media=media, **model_params # type: ignore
)
else:
return model(meaning_typed_input, media=media, **model_params) # type: ignore

def execute_react(
model: BaseLLM,
Expand Down

0 comments on commit 11f0973

Please sign in to comment.