Find answers from the community

K
Kunal
Offline, last seen 6 months ago
Joined September 25, 2024
Hello everyone, I am working on bot which will respond to user entered queries. The bot will use a list of PDFs and content from various blogs stored in VectorIndex. Below is the code that I am using:
Plain Text
chat_engine = index.as_chat_engine(
        streaming=True,
        similarity_top_k=3,
        chat_mode="condense_plus_context",
        llm=llm,
        verbose=True,
    )
response = chat_engine.stream_chat(query)
sources = []
for node in response.source_nodes:
    sources.append(node.node.metadata["file_name"])

The issue that I am facing is that, the sources I get in response are not always relevant. So if I ask a question to this bot and it does not have information related to the question, it should ideally return empty list of sources but the sources returned are never empty and they contain at least one source every time
2 comments
K
W