🐛 fix(loading.py): remove empty input_key and output_key from params dictionary
The code now removes the "input_key" and "output_key" keys from the params dictionary if they are empty strings. This ensures that the dictionary does not contain unnecessary keys with empty values.
This commit is contained in:
parent
7b238b44e7
commit
ac9969624e
1 changed files with 6 additions and 0 deletions
|
|
@ -111,6 +111,12 @@ def instantiate_llm(node_type, class_object, params: Dict):
|
||||||
|
|
||||||
|
|
||||||
def instantiate_memory(node_type, class_object, params):
|
def instantiate_memory(node_type, class_object, params):
|
||||||
|
# process input_key and output_key to remove them if
|
||||||
|
# they are empty strings
|
||||||
|
for key in ["input_key", "output_key"]:
|
||||||
|
if key in params and not params[key]:
|
||||||
|
params.pop(key)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if "retriever" in params and hasattr(params["retriever"], "as_retriever"):
|
if "retriever" in params and hasattr(params["retriever"], "as_retriever"):
|
||||||
params["retriever"] = params["retriever"].as_retriever()
|
params["retriever"] = params["retriever"].as_retriever()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue