Implement `calculate_similarity` Method in `VectorDatabaseProvider`
Closed this issue · 0 comments
The VectorDatabaseProvider
abstract base class currently has a placeholder for the calculate_similarity
method. For a functioning implementation, this method needs to calculate the similarity between a given vector (i.e., symbol embedding) and all vectors in the database. This is crucial for any use case involving similarity or distance-based retrieval of symbols in the database.
The calculate_similarity
method should return a list of dictionaries, each containing a symbol and its corresponding similarity score. The implementation will largely depend on the data structure used for the database and the specific similarity measure employed (for instance, cosine similarity for vector data).
Here's a high-level overview of what needs to be done:
Update the calculate_similarity
method in VectorDatabaseProvider
to correctly compute similarity scores instead of raising a NotImplementedError
.
The similarity scores should be computed for all vectors in the database against the provided input vector.
The output should be a list of dictionaries, each containing a Symbol
instance and the corresponding similarity score as a float value.
Test the method to ensure it correctly computes and returns similarity scores.
Feel free to post any questions or concerns you have about this implementation. Your contribution to this project is highly appreciated!