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

Update LocalVectorStore.kt #194

Merged
merged 1 commit into from
Jun 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update LocalVectorStore.kt
Fix name collision
diesalbla authored Jun 21, 2023
commit 05062b1f18fce14a8906ee6f393c6ad29911a00e
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ private constructor(private val embeddings: Embeddings, private val state: Atomi
return state0.documents
.asSequence()
.mapNotNull { doc -> state0.precomputedEmbeddings[doc]?.let { doc to it } }
.map { (doc, embedding) -> doc to embedding.cosineSimilarity(embedding) }
.map { (doc, e) -> doc to embedding.cosineSimilarity(e) }
.sortedByDescending { (_, similarity) -> similarity }
.take(limit)
.map { (document, _) -> document }