langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
35.94k stars 4.25k forks source link

Error building Component Message History #4911

Open tzengshinfu opened 13 hours ago

tzengshinfu commented 13 hours ago

Bug Description

There is an existing RAG workflow, with the component arrangement roughly as follows: [Chat Input]─►[Ollama Embedding]─►[PGVector]─►[Parse Data]─►[Prompt]─►[Ollama]─►[Chat Output]

Now, I want to add the ability to remember the previous conversation. So, in [Chat Input]─►[Ollama Embedding]─►[PGVector]─►[Parse Data]─►[Prompt]─►[Ollama]─►[Chat Output]                                                                                                                                        ▲                                                                                                                                         │(System Message)                                                                     (added) [Message History]─►[Prompt2]─┘

I found that the [Message History] component encountered a compilation error.

Reproduction

  1. Import the workflow file search_helper.json.
  2. Add the [Message History] and [Prompt] components.
  3. Edit the [Prompt] component to include the {memory} variable.
  4. Connect the [Message History] and [Prompt] components to [Ollama](Input:System Message).
  5. Start the Playground, and an error is displayed as shown in error.log.

Expected behavior

The Playground feature works properly.

Who can help?

No response

Operating System

Ubuntu Linux 20.04

Langflow Version

1.1.1

Python Version

None

Screenshot

playground_error error

flow_layout flow_layout

Flow File

flow_file search_helper.json

error.log error.log

dosubot[bot] commented 13 hours ago

To address the compilation error with the [Message History] component in your Langflow workflow, consider the following steps:

  1. Check Component Configuration: Ensure that the [Message History] component is correctly configured. Verify that all required parameters, such as session_id, sender, and order, are set appropriately. The session_id should be a string, and other parameters should match the expected input types.

  2. Review the {memory} Variable Usage: When using the {memory} variable in the [Prompt] component, ensure that it is correctly referenced and that the [Message History] component is properly connected to provide the necessary data. The {memory} variable should be formatted and used according to the component's requirements.

  3. Dependencies and Compatibility: Make sure that all dependencies required by the [Message History] component are installed and compatible with your current Langflow version (1.1.1). This includes checking for any updates or patches that might address known issues.

  4. Error Logs: Examine the error.log file for specific error messages that can provide more insight into what might be causing the compilation error. Look for any stack traces or error codes that can guide you to the source of the problem.

  5. Session ID Handling: Ensure that the session IDs used in your workflow are correctly formatted and consistent across components. The [Message History] component expects session IDs to be strings, and they should be used consistently to retrieve and store messages.

If these steps do not resolve the issue, consider isolating the [Message History] component in a simpler workflow to test its functionality independently. This can help identify whether the problem is with the component itself or its integration within the larger workflow.

To continue talking to Dosu, mention @dosu.

tzengshinfu commented 10 hours ago

Strangely, when I duplicated this flow and added and connected the [Message History] and [Prompt] components in the new flow, it ran normally. image_20241128_162707