update DEFAULT_N_FINAL
This commit is contained in:
parent
06f75e27a1
commit
f4057fbe19
1 changed files with 5 additions and 3 deletions
|
|
@ -1,12 +1,13 @@
|
|||
import path from "path";
|
||||
import { BranchAndDir, ContextItem, ContextProviderExtras } from "../../";
|
||||
import TransformersJsEmbeddingsProvider from "../../indexing/embeddings/TransformersJsEmbeddingsProvider";
|
||||
import { resolveRelativePathInWorkspace } from "../../util/ideUtils";
|
||||
import { getRelativePath } from "../../util/";
|
||||
import { INSTRUCTIONS_BASE_ITEM } from "../providers/utils";
|
||||
import { RetrievalPipelineOptions } from "./pipelines/BaseRetrievalPipeline";
|
||||
import NoRerankerRetrievalPipeline from "./pipelines/NoRerankerRetrievalPipeline";
|
||||
import RerankerRetrievalPipeline from "./pipelines/RerankerRetrievalPipeline";
|
||||
import path from "path";
|
||||
|
||||
const DEFAULT_N_FINAL = 25;
|
||||
|
||||
export async function retrieveContextItemsFromEmbeddings(
|
||||
extras: ContextProviderExtras,
|
||||
|
|
@ -43,7 +44,8 @@ export async function retrieveContextItemsFromEmbeddings(
|
|||
const contextLength = extras.llm.contextLength;
|
||||
const tokensPerSnippet = 512;
|
||||
const nFinal =
|
||||
options?.nFinal ?? Math.min(50, contextLength / tokensPerSnippet / 2);
|
||||
options?.nFinal ??
|
||||
Math.min(DEFAULT_N_FINAL, contextLength / tokensPerSnippet / 2);
|
||||
const useReranking = !!extras.reranker;
|
||||
const nRetrieve = useReranking ? options?.nRetrieve || 2 * nFinal : nFinal;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue