🐛 fix(utils.py): add condition to check if langchain_object.prompt has a template attribute before adding it to input_keys_response
The code now checks if the langchain_object.prompt has a template attribute before adding it to the input_keys_response. This prevents potential errors if the template attribute is not present in the prompt object.
This commit is contained in:
parent
32d0cc9092
commit
47f9d78a86
1 changed files with 3 additions and 1 deletions
|
|
@ -51,7 +51,9 @@ def build_input_keys_response(langchain_object, artifacts):
|
|||
# Add memory variables to memory_keys
|
||||
input_keys_response["memory_keys"] = langchain_object.memory.memory_variables
|
||||
|
||||
if hasattr(langchain_object, "prompt"):
|
||||
if hasattr(langchain_object, "prompt") and hasattr(
|
||||
langchain_object.prompt, "template"
|
||||
):
|
||||
input_keys_response["template"] = langchain_object.prompt.template
|
||||
|
||||
return input_keys_response
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue