-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dosu q&a thread #2466
Comments
The error message indicates that To ensure that from typing import Optional
from langflow.custom import Component
from langflow.io import MessageTextInput, Output
from langflow.schema import Data
from bson import ObjectId
from steer.controllers.threadsync_controller import get_thread_by_id
class UpdateStateComponent(Component):
display_name = "UpdateStateComponent"
description = "Use as a template to create your own component."
documentation: str = "http://docs.langflow.org/components/custom"
icon = "custom_components"
inputs = [
MessageTextInput(name="thread_id_value", display_name="Thread ID"),
MessageTextInput(name="user_id_value", display_name="User ID"),
MessageTextInput(name="current_question", display_name="current_question"),
MessageTextInput(name="prompt_question", display_name="prompt_question"),
MessageTextInput(name="followup_depth", display_name="followup_depth"),
MessageTextInput(name="segue_depth", display_name="segue_depth"),
]
outputs = [
Output(display_name="Output", name="output", method="build_output"),
]
def build_output(self, thread_id_value: str, user_id_value: str, current_question: Optional[str] = None, prompt_question: Optional[str] = None,
followup_depth: Optional[str] = None, segue_depth: Optional[str] = None):
update_kwargs = {}
if current_question:
update_kwargs['current_question'] = current_question
if prompt_question:
update_kwargs['prompt_question'] = prompt_question
if followup_depth:
update_kwargs['followup_depth'] = followup_depth
if segue_depth:
update_kwargs['segue_depth'] = segue_depth
update_current_state(thread_id_value, user_id_value, update_kwargs) Ensure that when you call the |
@dosu the UI in langflow component has those fields filled in. (in the UI, i manually type the inputs) But i'm getting this error when i try to build / run. What could that be? |
@dosu can you explain how the stop() function works with reguards to multiple outputs and this error: ![]() |
To resolve the error "Error Building Component. Error building Component Flow State Router: You must specify an output name to call stop" and properly use the Here is the relevant part of the def stop(self, output_name: str | None = None):
if not output_name and self.vertex and len(self.vertex.outputs) == 1:
output_name = self.vertex.outputs[0]["name"]
else:
raise ValueError("You must specify an output name to call stop")
if not self.vertex:
raise ValueError("Vertex is not set")
try:
self.graph.mark_branch(vertex_id=self.vertex.id, output_name=output_name, state="INACTIVE")
except Exception as e:
raise ValueError(f"Error stopping {self.display_name}: {e}") To properly use the # Assuming you have a CustomComponent instance named custom_component
# and you want to stop a specific output named "output1"
custom_component.stop(output_name="output1") If your component has only one output, you can call the # Assuming you have a CustomComponent instance named custom_component
# and it has only one output
custom_component.stop() For example, if you have a from langflow.custom import Component
from langflow.inputs import MessageTextInput, IntInput
from langflow.template import Output
class MultipleOutputsComponent(Component):
display_name = "Multiple Outputs Component"
description = "A component with multiple outputs."
icon = "icon-name"
inputs = [
MessageTextInput(display_name="Input", name="input"),
IntInput(display_name="Number", name="number"),
]
outputs = [
Output(display_name="Certain Output", name="certain_output", method="certain_output"),
Output(display_name="Other Output", name="other_output", method="other_output"),
]
def certain_output(self) -> str:
return f"This is my string input: {self.input}"
def other_output(self) -> int:
return f"This is my int input multiplied by 2: {self.number * 2}" You would need to call the # Assuming you have an instance of MultipleOutputsComponent named multiple_outputs_component
multiple_outputs_component.stop(output_name="certain_output") By ensuring that you provide the |
Hi @dsldsl , Do you need any assistance with this case? If not, please let us know if this issue can be closed. |
Thank you for your contribution! This issue will be closed. If you have any questions or encounter another problem, please open a new issue and we will be ready to assist you. |
[closed]
The text was updated successfully, but these errors were encountered: