Find answers from the community

Updated 3 months ago

Hi i ve built a ListIndex over all of my

Hi, i've built a ListIndex over all of my product's documentation pages (177 html to text files). If i use the query engine now, each request costs about $1. Is there a way to reduce these costs? my code is a simple as:
Plain Text
storage_context = StorageContext.from_defaults(persist_dir="./storage")
# load index
index = load_index_from_storage(storage_context)

query_engine = index.as_query_engine()
response = query_engine.query("what do you know about ...?")
L
C
4 comments
did you use a list index?
Yea, so a list index will read EVERY piece of text in the index for every query

You might want to switch to a vector index, which will only read the top k pieces of text. By default, the top k is 2, but you can modify this
Thx will try that
Add a reply
Sign up and join the conversation on Discord