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
31.82k stars 3.93k forks source link

Error building Component Astra DB: Error performing search in AstraDBVectorStore: 'content' #4091

Open licheng0794 opened 1 week ago

licheng0794 commented 1 week ago

I created a collection with a pdf in AstraDB. I used it to create a RAG_LLM (using Vector Store RAG).

image

I always got the error 'Error building Component Astra DB: Error performing search in AstraDBVectorStore: 'content''

some ideas?

dosubot[bot] commented 1 week ago

Hey there, @licheng0794! 👋 I'm here to help you with any bugs, questions, or contributions you have. I'm Dosu, a bot designed to assist you while you wait for a human maintainer.

Ensure that each document in your AstraDB collection includes a "content" field. The error occurs because the code is trying to access item["content"], but this key is missing in the data.

To fix this, you can update your documents to include the "content" field. Alternatively, modify the code to handle missing fields:

for item in data_dict:
    content = item.get("content", "")
    data.append(Data(content=content))

This change uses item.get("content", "") to provide a default empty string if the "content" field is absent, preventing the error [1].

To continue talking to Dosu, mention @dosu.

licheng0794 commented 1 week ago

I did not write the code. How can I do it in the langflow or AstraDB interface?

dosubot[bot] commented 1 week ago

In Langflow, ensure that your documents in AstraDB include a "content" field. You can do this by:

  1. Langflow UI: When adding documents, make sure each document has a "content" field. This might involve adjusting the data before uploading it to AstraDB.

  2. AstraDB Interface: If you have access to the AstraDB interface, you can update the documents directly to include the "content" field. This might require using a script or a tool that allows you to modify the documents in your collection.

If you need to automate this, consider using a script to preprocess your data to ensure the "content" field is present before uploading it to AstraDB.

To continue talking to Dosu, mention @dosu.

carlosrcoelho commented 1 week ago

@licheng0794

Are you using version 1.0.18?

In the Get Started section, there's an example of the Vector Store RAG. First, you can insert the content in this flow:

image

Then, in the upper flow, you include the same information you put in the AstraDB component to locate your uploaded file.

image
licheng0794 commented 1 week ago

@carlosrcoelho I am using the langflow in datastax.

edwinjosechittilappilly commented 1 day ago

@jordanrfrazier @carlosrcoelho This might be linked to the issue.

3786