Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix similarity score bug in lance/chroma dbs #2986

Merged
merged 2 commits into from
Jan 18, 2025

Conversation

shatfield4
Copy link
Collaborator

Pull Request Type

  • ✨ feat
  • πŸ› fix
  • ♻️ refactor
  • πŸ’„ style
  • πŸ”¨ chore
  • πŸ“ docs

Relevant Issues

resolves #2937

What is in this change?

  • Fix a bug where if there is an exact match in Lance or ChromaDB from the vector search (distance = 0) then similarity would be 0 and no result would be found
  • Fixed by checking if distance <= 0 -> returns 1 as similarity score which means it was a perfect match
  • It was previously distance <= 0 -> returns 0 for similarity
  • Also fixed if (distance >= 1.0) return 0; because if distance should always be a value between 0 and 1 and if distance is greater than 1 then similarity should be 0

Additional Information

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

@shatfield4 shatfield4 linked an issue Jan 18, 2025 that may be closed by this pull request
@timothycarambat timothycarambat merged commit f8c7278 into master Jan 18, 2025
@timothycarambat timothycarambat deleted the 2937-bug-vector-search-using-api branch January 18, 2025 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: Vector Search using API
2 participants