mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 12:48:30 +00:00
doc and config rerank (#475)
This commit is contained in:
@@ -131,13 +131,15 @@ export async function searchDatasetData({
|
||||
model,
|
||||
similarity = 0,
|
||||
limit,
|
||||
datasetIds = []
|
||||
datasetIds = [],
|
||||
rerank = false
|
||||
}: {
|
||||
text: string;
|
||||
model: string;
|
||||
similarity?: number; // min distance
|
||||
limit: number;
|
||||
datasetIds: string[];
|
||||
rerank?: boolean;
|
||||
}) {
|
||||
const { vectors, tokenLen } = await getVectorsByText({
|
||||
model,
|
||||
@@ -219,6 +221,13 @@ export async function searchDatasetData({
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!rerank) {
|
||||
return {
|
||||
searchRes: filterData.slice(0, limit),
|
||||
tokenLen
|
||||
};
|
||||
}
|
||||
|
||||
// ReRank result
|
||||
const reRankResult = await reRankSearchResult({
|
||||
query: text,
|
||||
|
Reference in New Issue
Block a user