🐛 fix(utils.py): add condition to check if prompt has 'partial' attribute before calling it to prevent error
This commit is contained in:
parent
2144e1ec91
commit
e0f625e793
1 changed files with 3 additions and 1 deletions
|
|
@ -51,7 +51,9 @@ def handle_partial_variables(prompt, format_kwargs: Dict):
|
||||||
}
|
}
|
||||||
# Remove handle_keys otherwise LangChain raises an error
|
# Remove handle_keys otherwise LangChain raises an error
|
||||||
partial_variables.pop("handle_keys", None)
|
partial_variables.pop("handle_keys", None)
|
||||||
return prompt.partial(**partial_variables)
|
if partial_variables and hasattr(prompt, "partial"):
|
||||||
|
return prompt.partial(**partial_variables)
|
||||||
|
return prompt
|
||||||
|
|
||||||
|
|
||||||
def handle_variable(params: Dict, input_variable: str, format_kwargs: Dict):
|
def handle_variable(params: Dict, input_variable: str, format_kwargs: Dict):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue