Find answers from the community

Updated 12 months ago

Hi all, I am looking for multiples query

Hi all, I am looking for multiples query results based on similarity score?

For example.
Plain Text
from llama_index import VectorStoreIndex, SimpleDirectoryReader

documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents)

query_engine = index.as_query_engine()
response = query_engine.query("What did the author do growing up?")
print(response)


In this code, I want to get a multiple query response result with some score numbers.

| Score | Query result |
|-------|--------------|
| 0.9 |he worked. |
| 0.6 |he played. |
| 0.3 |he slept. |


What is the best way to achive my goal?

Thanks for your advice.

πŸ‘
L
Z
M
3 comments
What is the score calculated from?

For example, each retrieved node used in the response has a similarity score

print([n.score for n in response.source_nodes])
Thanks Logan. I solved it.
How you solved it? How data looks like?
Add a reply
Sign up and join the conversation on Discord