Add feature to calculate similarity score between two embeddings without storing them in a collection #804
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Embeddings are great, but they are meaningful only in the relationship between each other.
I thought it would be helpful if we had a command to directly calculate the similarity score between two contents without storing them in a collection when trying out embedding models.
This PR adds a command
embed-score
, which takes two contents and returns the cosine similarity score (and actual embeddings when the given format is 'json').The new function describes my rough intention, but I'm fully open to any suggestions on the interface/implementation if this feature is worth having in this tool.
Confession: This is a collaborative work with Anthropic's Cline and Claude 3.7. I prompted Cline to write a new function I wanted and post-edited the generated code. Claude did a great job but couldn't produce unit tests that worked and aligned with existing fixtures (in a reasonable time slot). The whole process greatly helped me to understand the codebase.
Still needs to