Find answers from the community

Updated 6 months ago

Is there a way to define a custom similarity score for determining the similarity between

@kapa.ai Is there a way to define a custom similarity score for determining the similarity between a query and items in a vector store?
k
3 comments
Please stand by @node0 as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
Based on the provided knowledge sources, LlamaIndex does not explicitly provide a way to define a custom similarity score for determining the similarity between a query and items in a vector store. However, it does provide methods to perform similarity searches and return similarity scores.

For example, in the JaguarVectorStore, there is a method similarity_search_with_score that returns nodes most similar to a query embedding, along with their ids and similarity scores. The similarity score in this case is likely determined by the underlying algorithm used by the JaguarVectorStore and may not be customizable (source ()).

Similarly, in the WeaviateVectorStore, there is a method that performs a hybrid query and returns a VectorStoreQueryResult that includes nodes, ids, and similarities. Again, the similarity score is likely determined by the underlying algorithm used by the WeaviateVectorStore and may not be customizable (source ()).

In the RocksetVectorStore and SingleStoreVectorStore, there are also methods that perform queries and return similarity scores, but it does not appear that these scores are customizable either (source1 (), source2 ()).
If you need to define a custom similarity score, you may need to implement this functionality yourself, possibly by extending or modifying the existing vector store classes. Please refer to the LlamaIndex documentation for more details.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord