Skip to content

Commit 89bc53c

Browse files
committed
adding configuration for max similarity score
1 parent 2209919 commit 89bc53c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

services/video-search/src/api/search.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ export default function initialize({
5353
question,
5454
});
5555

56+
/**
57+
* Scores will be between 0 and 1, where 0 is most accurate and 1 is least accurate
58+
*/
5659
const [result] = await answerVectorStore.similaritySearchWithScore(
5760
question,
5861
1,
@@ -64,7 +67,7 @@ export default function initialize({
6467
score: result[1],
6568
});
6669

67-
if (result[1] < 0.2) {
70+
if (result[1] < config.searches.maxSimilarityScore) {
6871
log.debug(`Found answer to question ${question}`, {
6972
location: `${prefix}.search.getAnswer`,
7073
});

services/video-search/src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export default {
5252
},
5353
searches: {
5454
KNN: 3,
55+
maxSimilarityScore: 0.2,
5556
answerCache: true,
5657
},
5758
log: {

0 commit comments

Comments
 (0)