Is it possible to get source for the query response? #376

Closed
opened 2026-02-16 00:17:40 -05:00 by yindo · 1 comment
Owner

Originally created by @AyushParikh on GitHub (Dec 9, 2024).

    from llama_index.core import VectorStoreIndex, Document
    
    index = VectorStoreIndex.from_documents(document_objects)

    # create a query engine for the index
    query_engine = index.as_query_engine()
    return query_engine.query(query)

I pass in a bunch of documents into the VectorStoreIndex and i call a query. It is possible to get the source of the query response?

Originally created by @AyushParikh on GitHub (Dec 9, 2024). ``` from llama_index.core import VectorStoreIndex, Document index = VectorStoreIndex.from_documents(document_objects) # create a query engine for the index query_engine = index.as_query_engine() return query_engine.query(query) ``` I pass in a bunch of documents into the VectorStoreIndex and i call a query. It is possible to get the source of the query response?
yindo added the enhancement label 2026-02-16 00:17:40 -05:00
yindo closed this issue 2026-02-16 00:17:40 -05:00
Author
Owner

@logan-markewich commented on GitHub (Dec 9, 2024):

@AyushParikh this isn't a llama-parse question (its llama-index). But yes, you can

response = query_engine.query(query)
print(response.source_nodes)
print(response.source_nodes[0].score)
print(response.source_nodes[0].text)
print(response.source_nodes[0].metadata)
@logan-markewich commented on GitHub (Dec 9, 2024): @AyushParikh this isn't a llama-parse question (its[ llama-index)](https://github.com/run-llama/llama_index). But yes, you can ``` response = query_engine.query(query) print(response.source_nodes) print(response.source_nodes[0].score) print(response.source_nodes[0].text) print(response.source_nodes[0].metadata) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_cloud_services#376