🐛 fix(loading.py): convert "max_tokens" parameter from string to int if it is a string and can be converted to int
🐛 fix(loading.py): remove "max_tokens" parameter if it is not an integer
This commit is contained in:
parent
55164fdfa3
commit
7e712b1be8
1 changed files with 9 additions and 0 deletions
|
|
@ -120,6 +120,15 @@ def instantiate_llm(node_type, class_object, params: Dict):
|
|||
# False if condition is True
|
||||
if node_type == "VertexAI":
|
||||
return initialize_vertexai(class_object=class_object, params=params)
|
||||
# max_tokens sometimes is a string and should be an int
|
||||
if (
|
||||
"max_tokens" in params
|
||||
and isinstance(params["max_tokens"], str)
|
||||
and params["max_tokens"].isdigit()
|
||||
):
|
||||
params["max_tokens"] = int(params["max_tokens"])
|
||||
elif not isinstance(params["max_tokens"], int):
|
||||
params.pop("max_tokens", None)
|
||||
return class_object(**params)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue