Chainlit / cookbook

Chainlit's cookbook repo
https://github.com/Chainlit/chainlit
713 stars 270 forks source link

Need an example for querying from an existing vector DB with the RetrievalQAWithSourcesChain #36

Closed PrashantSaikia closed 10 months ago

PrashantSaikia commented 10 months ago

We have this example for querying on a single document by constructing a vector DB on the fly. I have multiple PDFs on which I want to query, and I have already created a Weaviate vectorstore (here). So, how do I modify this to be able to query on my existing vector DB?

Here is my attempt, I'm getting stuck at extracting the sources. Perhaps the structure of the sources output are different in chroma DB and Weaviate, not sure. Any help is appreciated. This is the error I get:

File "C:\Users\username\Documets\app.py", line 122, in main
    index = all_sources.index(source_name)
            ^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'index'

Here is the output I get:

image
willydouhard commented 10 months ago

I think you should get the sources as shown here. This example use ConversationalChain but I think it should work the same for RetrievalChain.