Find answers from the community

Updated 2 months ago

Retrieval

if i just use a few pages, i can get the result in just top 20, but when the pdf including 100 pages, the target doc will be returned after 100 items
W
h
S
10 comments
Retrieval in llamaindex uses similarity algorithm to find the most nearest content from your dataset for your query.


So it would not have any issue even if the required content is present after 100 items
yes you are correct
is there any doc about optimize retrieval results, my expectation is top 20
If you want to find the top 20 result based on your query. Just need to set the topK value to 20

query_engine = index.as_query_engine( similarity_top_k=20)
ok i think i have to optimize my query or do query tranformation , so the target answer will show in top 20
How to implement retrieval and query engine together
If you define your query_engine and ask the query. Along with the LLM response, you also get the retrieved nodes used for generating the response.
Plain Text
response = query_engine.query("ask your query here")
# Retrived nodes can be fetched as 
print(response.source_nodes)
I’m using create-llama package and have edited index.py for local LLM and embedding usage.
How many arguments does query_engine take ? Can top k argument included along with tree_summarize
Add a reply
Sign up and join the conversation on Discord