Merge branch 'release' of https://github.com/logspace-ai/langflow into release
This commit is contained in:
commit
f046b303a9
6 changed files with 22 additions and 756 deletions
|
|
@ -100,6 +100,8 @@ def instantiate_llm(node_type, class_object, params: Dict):
|
|||
|
||||
def instantiate_memory(node_type, class_object, params):
|
||||
try:
|
||||
if "retriever" in params and hasattr(params["retriever"], "as_retriever"):
|
||||
params["retriever"] = params["retriever"].as_retriever()
|
||||
return class_object(**params)
|
||||
# I want to catch a specific attribute error that happens
|
||||
# when the object does not have a cursor attribute
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ def update_memory_keys(langchain_object, possible_new_mem_key):
|
|||
if key not in [langchain_object.memory.memory_key, possible_new_mem_key]
|
||||
][0]
|
||||
|
||||
langchain_object.memory.input_key = input_key
|
||||
langchain_object.memory.output_key = output_key
|
||||
langchain_object.memory.memory_key = possible_new_mem_key
|
||||
keys = [input_key, output_key, possible_new_mem_key]
|
||||
attrs = ["input_key", "output_key", "memory_key"]
|
||||
for key, attr in zip(keys, attrs):
|
||||
try:
|
||||
setattr(langchain_object.memory, attr, key)
|
||||
except ValueError as exc:
|
||||
logger.debug(f"{langchain_object.memory} has no attribute {attr} ({exc})")
|
||||
|
|
|
|||
|
|
@ -51,5 +51,6 @@ async def get_result_and_steps(langchain_object, message: str, **kwargs):
|
|||
)
|
||||
thought = format_actions(intermediate_steps) if intermediate_steps else ""
|
||||
except Exception as exc:
|
||||
logger.exception(exc)
|
||||
raise ValueError(f"Error: {str(exc)}") from exc
|
||||
return result, thought
|
||||
|
|
|
|||
|
|
@ -37,16 +37,17 @@ class MemoryFrontendNode(FrontendNode):
|
|||
value="",
|
||||
)
|
||||
)
|
||||
self.template.add_field(
|
||||
TemplateField(
|
||||
field_type="str",
|
||||
required=False,
|
||||
show=True,
|
||||
name="output_key",
|
||||
advanced=True,
|
||||
value="",
|
||||
if self.template.type_name not in {"VectorStoreRetrieverMemory"}:
|
||||
self.template.add_field(
|
||||
TemplateField(
|
||||
field_type="str",
|
||||
required=False,
|
||||
show=True,
|
||||
name="output_key",
|
||||
advanced=True,
|
||||
value="",
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def format_field(field: TemplateField, name: Optional[str] = None) -> None:
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class VectorStoreFrontendNode(FrontendNode):
|
|||
required=False,
|
||||
show=True,
|
||||
advanced=False,
|
||||
value=True,
|
||||
value=False,
|
||||
display_name="Persist",
|
||||
)
|
||||
extra_fields.append(extra_field)
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue