nsarrazin HF staff commited on
Commit
8e839b8
1 Parent(s): bcfa394

Include last chunk in websearch context (#912)

Browse files

Fix bug where last chunk was dropped in websearch

src/lib/server/sentenceSimilarity.ts CHANGED
@@ -22,7 +22,7 @@ export async function findSimilarSentences(
22
  const output = await embeddingEndpoint({ inputs });
23
 
24
  const queryEmbedding: Embedding = output[0];
25
- const sentencesEmbeddings: Embedding[] = output.slice(1, inputs.length - 1);
26
 
27
  const distancesFromQuery: { distance: number; index: number }[] = [...sentencesEmbeddings].map(
28
  (sentenceEmbedding: Embedding, index: number) => {
 
22
  const output = await embeddingEndpoint({ inputs });
23
 
24
  const queryEmbedding: Embedding = output[0];
25
+ const sentencesEmbeddings: Embedding[] = output.slice(1);
26
 
27
  const distancesFromQuery: { distance: number; index: number }[] = [...sentencesEmbeddings].map(
28
  (sentenceEmbedding: Embedding, index: number) => {