Skip to content

Commit

Permalink
fix: langfuse trace
Browse files Browse the repository at this point in the history
  • Loading branch information
634750802 committed May 22, 2024
1 parent 47577b5 commit c60f8e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core/services/llamaindex/retrieving.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class LlamaindexRetrieveService extends AppRetrieveService {
}

// Cut up to 2 * top_k chunks for reranking.
// FIXME: why not to use the `search_top_k`?
const rerankChunksLimit = top_k * 2;
chunks = chunks.slice(0, rerankChunksLimit);

Expand Down
3 changes: 2 additions & 1 deletion src/core/services/retrieving.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export abstract class AppRetrieveService extends AppIndexBaseService {
callbacks?.onRetrieved(retrieve.id, results);

if (options.reversed) {
return results.reverse();
// use cloned array to avoid affecting langfuse output tracing.
return Array.from(results).reverse();
} else {
return results;
}
Expand Down

0 comments on commit c60f8e3

Please sign in to comment.