Skip to content

Commit f910609

Browse files
authored
Fix similarity score not showing in citation UI for Astra, Qdrant, Weaviate (#4718)
* fix astra not showing similarity score in citations ui * fix qdrant not showing similarity score in citations ui * fix weaviate not showing similarity score in citations ui
1 parent 1e96aca commit f910609

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

server/utils/vectorDbProviders/astra/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,10 @@ const AstraDB = {
373373
return;
374374
}
375375
result.contextTexts.push(response.metadata.text);
376-
result.sourceDocuments.push(response);
376+
result.sourceDocuments.push({
377+
...response.metadata,
378+
score: response.$similarity,
379+
});
377380
result.scores.push(response.$similarity);
378381
});
379382
return result;

server/utils/vectorDbProviders/qdrant/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ const QDrant = {
8080
result.sourceDocuments.push({
8181
...(response?.payload || {}),
8282
id: response.id,
83+
score: response.score,
8384
});
8485
result.scores.push(response.score);
8586
});

server/utils/vectorDbProviders/weaviate/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const Weaviate = {
115115
return;
116116
}
117117
result.contextTexts.push(rest.text);
118-
result.sourceDocuments.push({ ...rest, id });
118+
result.sourceDocuments.push({ ...rest, id, score: certainty });
119119
result.scores.push(certainty);
120120
});
121121

0 commit comments

Comments
 (0)