Find answers from the community

Updated 2 months ago

Knowledge

Tried. Not working well. Can I try to use similarity score? Is there any place I can find the sample code under verion 0.6 ? What's the default similarity k we r using ?
L
a
W
4 comments
Default top k is 2

Instead of modifying the prompt, you could also try just appending extra instructions to the query string (that seemed to work well for someone the other day)

For filtering by similarity score, you can do this

Plain Text
from llama_index.indices.postprocessor import SimilarityPostprocessor

index.as_query_engine(
    node_postprocessors=[
        SimilarityPostprocessor(similarity_cutoff=0.7)
    ])
yes. it works now, which effectively help me filter those non context related qna. thanks.
@Logan M
If we add instruction in the query, the performance of the query under cosine similarity will not degrade?
eh, hard to say lol It will have some effect, no idea how much. Prompt templates are more difficult to modify properly though, so, it's a tradeoff
Add a reply
Sign up and join the conversation on Discord