Skip to content
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

Image File with Session ID in Chat Input breaks prompt #4196

Open
RyanfCooper opened this issue Oct 17, 2024 · 3 comments
Open

Image File with Session ID in Chat Input breaks prompt #4196

RyanfCooper opened this issue Oct 17, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@RyanfCooper
Copy link

Bug Description

If I set a session ID and try to pass an image file in chat input it throws an error (does the same for API curl command).

Payload being sent: {
"output_type": "chat",
"input_type": "chat",
"input_value": "what is this?",
"session_id": "2311",
"tweaks": {
"ChatInput-71EqU": {
"sender": "User",
"sender_name": "User",
"should_store_message": true,
"files": "41bdad19-e6c8-4bcc-b788-25836e273806/2024-10-17_22-49-43_Screenshot 2024-10-17 at 11.15.47 AM.png"
},
"ChatOutput-wvrFo": {
"data_template": "{text}",
"input_value": "",
"sender": "Machine",
"sender_name": "AI",
"should_store_message": true
},
"Memory-MnvrM": {
"n_messages": 100,
"order": "Ascending",
"sender": "Machine and User",
"sender_name": "User",
"template": "{sender_name}: {text}"
}
}
}

POST.../api/v1/run/41bdad19-e6c8-4bcc-b788-25836e273806?stream=false 500 (Internal Server Error)

Error Details: {"detail":"{"message":"Error running graph: Error building Component Prompt: \n\ntoo many values to unpack (expected 2)","traceback":null,"description":null,"code":null,"suggestion":null}"}

Reproduction

  1. add file to chat input
  2. add session at chat input
  3. run form API or from UI (failure at prompt)
Screenshot 2024-10-17 at 5 48 09 PM Screenshot 2024-10-17 at 5 47 38 PM

Expected behavior

I'd expect it to work like default memory does but for session_id.

Who can help?

No response

Operating System

Linux/Mac

Langflow Version

1.0.18

Python Version

3.10

Screenshot

No response

Flow File

No response

@RyanfCooper RyanfCooper added the bug Something isn't working label Oct 17, 2024
Copy link

dosubot bot commented Oct 17, 2024

Hey @RyanfCooper! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this together! 🤖

The error you're encountering, "too many values to unpack (expected 2)," in the 'Prompt' component might be related to how the payload is structured or processed. The issue could arise from the way the files are being handled or passed to the 'Prompt' component.

Here are a few things to check and try:

  1. Payload Structure: Ensure that the payload structure for the files is correct. The files field should be a list of file objects, each containing file_type, file_name, and file_content as base64 encoded content. The current payload seems to have a string for files instead of a list of objects. It should look like this:

    "files": [
        {
            "file_type": "image",
            "file_name": "Screenshot 2024-10-17 at 11.15.47 AM.png",
            "file_content": "base64_encoded_content"
        }
    ]
  2. Session ID Handling: Verify that the session ID is correctly linked and used in the workflow. The session_id is crucial for managing chat inputs and outputs, ensuring they are associated with the correct session [1].

  3. Prompt Component: Check the 'Prompt' component's configuration to ensure it correctly handles the inputs from 'Chat Input' and 'Chat Memory'. The 'Prompt' component should be set up to receive the user_message and context without any issues [2].

  4. Error Handling: If the error persists, consider enabling error handling in the system to get more detailed error messages. This might help identify the exact point of failure in the 'Prompt' component [3].

By ensuring the payload is correctly structured and the components are properly configured, you should be able to resolve the error.

To continue talking to Dosu, mention @dosu.

@RyanfCooper
Copy link
Author

It is also failing directly in the UI

@RyanfCooper
Copy link
Author

Any update on this? Note the bot suggestion does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants