fix(workflow): fix default values in parameter extraction node and incorrect value retrieval in comparison operations
This commit is contained in:
@@ -260,8 +260,7 @@ class ConditionBase(ABC):
|
|||||||
raise RuntimeError("Unsupported variable type")
|
raise RuntimeError("Unsupported variable type")
|
||||||
|
|
||||||
def check(self, no_right=False):
|
def check(self, no_right=False):
|
||||||
left = self.pool.get(self.left_selector.variable_selector)
|
if not isinstance(self.left_value, self.type_limit):
|
||||||
if not isinstance(left, self.type_limit):
|
|
||||||
raise TypeError(f"The variable to be compared on must be of {self.type_limit} type")
|
raise TypeError(f"The variable to be compared on must be of {self.type_limit} type")
|
||||||
if not no_right:
|
if not no_right:
|
||||||
right = self.resolve_right_literal_value()
|
right = self.resolve_right_literal_value()
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class ParamsConfig(BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
required: bool = Field(
|
required: bool = Field(
|
||||||
...,
|
default=False,
|
||||||
description="Whether the parameter is required"
|
description="Whether the parameter is required"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -59,6 +59,6 @@ class ParameterExtractorNodeConfig(BaseNodeConfig):
|
|||||||
)
|
)
|
||||||
|
|
||||||
prompt: str = Field(
|
prompt: str = Field(
|
||||||
...,
|
default="",
|
||||||
description="User-provided supplemental prompt"
|
description="User-provided supplemental prompt"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -157,9 +157,17 @@ class ParameterExtractorNode(BaseNode):
|
|||||||
|
|
||||||
messages = [
|
messages = [
|
||||||
("system", system_prompt),
|
("system", system_prompt),
|
||||||
("user", self._render_template(self.typed_config.prompt, state)),
|
|
||||||
("user", rendered_user_prompt),
|
|
||||||
]
|
]
|
||||||
|
if self.typed_config.prompt:
|
||||||
|
messages.extend([
|
||||||
|
("user", self._render_template(self.typed_config.prompt, state)),
|
||||||
|
("user", rendered_user_prompt),
|
||||||
|
])
|
||||||
|
else:
|
||||||
|
messages.extend([
|
||||||
|
("user", rendered_user_prompt),
|
||||||
|
])
|
||||||
|
|
||||||
model_resp = await llm.ainvoke(messages)
|
model_resp = await llm.ainvoke(messages)
|
||||||
result = json_repair.repair_json(model_resp.content, return_objects=True)
|
result = json_repair.repair_json(model_resp.content, return_objects=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user