# How ingest pdf into weaviate and perform RAG

**URL:** <https://forum.weaviate.io/t/how-ingest-pdf-into-weaviate-and-perform-rag/3168>\
**Category:** General\
**Tags:** integration, documentation\
**Created:** [July 25, 2024, 9:44am UTC](https://forum.weaviate.io/t/how-ingest-pdf-into-weaviate-and-perform-rag/3168 "2024-07-25T09:44:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SergioEanX](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/sergioeanx/32/2031_2.png) [@SergioEanX](https://forum.weaviate.io/u/SergioEanX)\
**Post date:** [July 25, 2024, 9:44am UTC](https://forum.weaviate.io/t/how-ingest-pdf-into-weaviate-and-perform-rag/3168/1 "2024-07-25T09:44:36Z")

</div>

I’m trying to ingest data into weavite, a mix of text data and other formats like pdf that I convert to text batches using “unstructured”.  
I’m basically following what reported at [ingesting PDF](https://weaviate.io/blog/ingesting-pdfs-into-weaviate) but I suppose I’m missing something and/or I’m doing something wrong.  
If I query data as follow:

> ```
> response = coll.query.bm25(
> query="metal oxide",
> limit=2,   
> return_metadata=MetadataQuery(distance=True)
> )
> 
> ```

I get a result, while using:

> ```
> res = coll.generate.near_text(
> query="metal oxide",
> limit=2,   
> # return_metadata=MetadataQuery(distance=True),
> single_prompt="Summarize {coll_name}, use a maximum of 20 words."
> )
> 
> ```

I get nothing.  
I would like to perform semantic search + RAG on property “files” (DataType.TEXT\_ARRAY) containing batch text extracted using `partition_pdf` from `usntructured`.  
Schema is the following:

 ![SchemaWeaviate](https://canada1.discourse-cdn.com/flex027/uploads/weaviate/original/2X/f/f6abd93a68d3ac18dff85c66d19a868d0f2bbbab.png)

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [July 25, 2024, 7:33pm UTC](https://forum.weaviate.io/t/how-ingest-pdf-into-weaviate-and-perform-rag/3168/2 "2024-07-25T19:33:23Z")

</div>

hi @SergioEanX !!

Welcome to our community 🤗

Check this recipe as it shows how to use Langchain to ingest some pdfs:

[https://github.com/weaviate/recipes/tree/main/integrations/langchain/loading-data](https://github.com/weaviate/recipes/tree/main/integrations/langchain/loading-data)

While you may not use Langchain entirely, it will give you some hints on how to use the unstructured. That recipe specifically doesn’t use unstructured, but there is a lot of docs covering this, like here:

> **[Unstructured | 🦜️🔗 LangChain](https://python.langchain.com/v0.2/docs/integrations/providers/unstructured/)**
>
> The unstructured package from

Also, you can not only load a single pdf, but an entire folder of contents, like in here:

> **[File Directory | 🦜️🔗 LangChain](https://python.langchain.com/v0.1/docs/modules/data_connection/document_loaders/file_directory/)**
>
> This covers how to load all documents in a directory.

Let me know if this helps.

Also, check this Academy course we have on chunking, as this is not a “one size fits all”, and some changes can be done for each use case to improve the overall quality of your results:

> **[A brief introduction to chunking | Weaviate - Vector Database](https://weaviate.io/developers/academy/py/standalone/chunking/introduction)**
>
> \<!-- import imageUrl from '../../tmpimages/academyplaceholder.jpg';

Let me know if this helps!

Thanks!
