Error building Component Astra DB: Error performing search in AstraDBVectorStore: 'content'
I created a collection with a pdf in AstraDB. I used it to create a RAG_LLM (using Vector Store RAG).
I always got the error 'Error building Component Astra DB: Error performing search in AstraDBVectorStore: 'content''
some ideas?
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.
I did not write the code. How can I do it in the langflow or AstraDB interface?
In Langflow, ensure that your documents in AstraDB include a "content" field. You can do this by:
-
Langflow UI: When adding documents, make sure each document has a
"content"field. This might involve adjusting the data before uploading it to AstraDB. -
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.
@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:
Then, in the upper flow, you include the same information you put in the AstraDB component to locate your uploaded file.
@carlosrcoelho I am using the langflow in datastax.
@jordanrfrazier @carlosrcoelho This might be linked to the issue.
#3786
@licheng0794 Please see this comment - the problem is likely due to the database schema not having the expected content field. The documentation will be improved to indicate what is needed. Thanks
@jordanrfrazier Why does it not automatically create a 'content' field when I select the 'Unstructured data' file of the PDF book, for example? If this is what is needed how users will understand what is happening here?
Having the same issue when uploading PDF files to AstaDB for use with Langflow
I notice the same thing with CSV files as well. For example: https://www.youtube.com/watch?v=oJSTtWA152k&t=399s
Here, Tejas uploaded the CSV file with the vectorize column name we want to embed. After the embedding process is finished, the new column content appears automatically.
I did the same thing with the same IMDB dataset. But when I chose the column and embedded it, there was no content column, which caused the error.
Originally, the column name with the descriptions of movies had the name Overview. It did not work for me, so I tried to rename it to vectorize and, content which also did not work.
I keep finding myself coming back here. So, here’s the thing:
- If you ingest the data through LangFlow, the collection created on Astra DB already includes a content field for you.
- If you ingest the data through Astra DB (structured or unstructured, doesn't matter), it does NOT automatically create a content field, and renaming it to solve this problem through the CQL console seems difficult.
@selimyaman Hi all. You're all correct here, and this has been addressed in recent changes that will be released in the next version by using the autodetect feature in Astra DB Vector Store and additional allowed parameters in the Astra DB component.
If data was ingested through any means other than Langchain, such that it doesn't include a content or metadata column, you will be able specify the content field name (located in the "Advanced" options), or it will detect the largest text field and use that as the content column.
If there are follow up suggestions or thoughts, please let us know! Tagging in @erichare for visibility. We'll update here when this is released.
Hello community, I encountered this error recently when uploading data as CSV to astra db and using that data in a RAG. The workaround I used to fix this problem was to add a content column with the desired value as the value of this column will be the output from the astra component and a metadata column with dictionary type value something like this {"file": "/abc/def"} in my CSV data.
We have just released Langflow v1.1.2 with with support to specify the content text column in Astra DB!
Use the field content_field parameter to specify. Additionally, the autodetect feature in AstraDBVectorStore is available - https://github.com/langchain-ai/langchain-datastax/releases/tag/libs%2Fastradb%2Fv0.4.0
@jordanrfrazier thanks for this as I think it is in alignment with an issue I am experiencing. My error specially is around metadata. I've been through the documentation but haven't found much on this. Here is my specific error:
_Error building Component Astra DB:
Error performing search in AstraDBVectorStore: 'metadata'_
About my ingest:
I am ingesting (structured) json via dataapi (python) from outside the environment. No issues populating the database with appropriately vectorized data. Just issues when it comes to search.
Here is a snippet of my code illustrating dictionary appending to structure for ingest:
for product in product_cards: name_element = product.find('div', {'class': 'AriaProductTitle--1chitt2'}).find('p') price_element_avg = product.find('div', {'class': 'ProductPrice--w5mr9b'}) price_element_unit = product.find('div', {'class': 'ProductUnitPrice--slbqgg'})
full_name = name_element.get_text(strip=True) if name_element else 'No name found'
price_avg = price_element_avg.get_text(strip=True) if price_element_avg else 'No average price found'
price_unit = price_element_unit.get_text(strip=True) if price_element_unit else 'No unit price found'
name_without_price = full_name.split(',$')[0].replace('Thai ', '')
product_info_list.append({
'product': name_without_price,
'averagePrice': price_avg,
'unitPrice': price_unit,
'$vectorize': full_name # Include full name for vectorization
Am I missing something or not appending appropriate values to this dictionary properly?
Thanks a TON for the help with this.
We have just released Langflow v1.1.2 with with support to specify the content text column in Astra DB!
Use the field
content_fieldparameter to specify. Additionally, theautodetectfeature in AstraDBVectorStore is available - https://github.com/langchain-ai/langchain-datastax/releases/tag/libs%2Fastradb%2Fv0.4.0![]()
My pdf is processed by Text Split and I can see the chunk output is file_name and text fields. This is an input to AstraDB as ingest. In AstraDB I have set Content Field value as "text" it is still throwing error "Error building Component Astra DB: Error initializing AstraDBVectorStore: Could not infer content_field name from sampled documents.".
@ishumishra if you remove the content_field parameter entirely, i.e., leave it blank, do you get an error too? Could you also share a screenshot of your collection from the Astra DB portal, mostly so we can see if it is a vectorize collection vs one where you bring your own embeddings?
@jnuts74 Apologies on the late response, I'm just getting back from vacation. Can you please share the structure of the row in Astra DB (you can send a screenshot of the schema from the Astra UI). When you're running Search from Langflow with this collection, are you doing any metadata filtering?
The error message is unfortunately not helpful, so any details you can give us can help improve this experience in the future. Thanks!
Above is the chunk going to AstraDB component.
Whether I make Content Field value blank, whether I toggle it on or off, or if I put value as text, all the time error is same: Error Building Component Error building Component Astra DB: Error initializing AstraDBVectorStore: Could not infer content_field name from sampled documents.
@ishumishra if you remove the
content_fieldparameter entirely, i.e., leave it blank, do you get an error too? Could you also share a screenshot of your collection from the Astra DB portal, mostly so we can see if it is avectorizecollection vs one where you bring your own embeddings?
Hi Everything is updated above in the post chain. Screenshots. Whether I type the value of Content Field or not, the error is same.
Hi, @licheng0794. I'm Dosu, and I'm helping the langflow team manage their backlog. I'm marking this issue as stale.
Issue Summary:
- The issue involves an error with the 'content' field in AstraDBVectorStore when building a component using a PDF-created collection.
- I suggested ensuring each document includes a 'content' field or modifying the code to handle missing fields.
- @jordanrfrazier mentioned potential schema issues and announced documentation improvements and a new version (Langflow v1.1.2) to specify the content text column.
- Despite updates, users like @ishumishra still face issues, indicating ongoing challenges.
Next Steps:
- Please confirm if this issue is still relevant with the latest version of the langflow repository. If so, you can keep the discussion open by commenting here.
- If there is no further activity, this issue will be automatically closed in 7 days.
Thank you for your understanding and contribution!