Skip to content

Commit a9e2d9e

Browse files
ypkangYiping Kang
andauthored
Enable passing custom parameters for custom model (#1483)
* Enable passing custom parameters for custom model * Linting * Linting --------- Co-authored-by: Yiping Kang <yiping@jaseci.org>
1 parent 2d998f6 commit a9e2d9e

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

jac-mtllm/mtllm/aott.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,27 @@ def aott_raise(
131131
if not (contains_media and not is_custom)
132132
else meaning_typed_input_list
133133
)
134-
return model(meaning_typed_input, media=media, **model_params) # type: ignore
134+
if is_custom:
135+
try:
136+
# This is a temporary solution to enable passing in custom
137+
# parameters to custom models
138+
# custom model should override the __call__ method to
139+
# accept function_inputs parameter
140+
return model(
141+
meaning_typed_input, # type: ignore
142+
media=media, # type: ignore
143+
function_inputs=inputs_information, # type: ignore
144+
**model_params,
145+
)
146+
except TypeError:
147+
# this is for backward compatibility,
148+
# for any existing custom models that do not have the
149+
# function_inputs parameter
150+
return model(
151+
meaning_typed_input, media=media, **model_params # type: ignore
152+
)
153+
else:
154+
return model(meaning_typed_input, media=media, **model_params) # type: ignore
135155

136156

137157
def execute_react(

0 commit comments

Comments
 (0)