mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-11 18:48:27 +00:00
fix: increase reranking score threshold
This commit is contained in:
parent
a0b3128329
commit
963bfcbb78
@ -89,6 +89,7 @@ const EnvironmentSchema = z.object({
|
||||
EMBEDDING_MODEL_SIZE: z.string().default("1024"),
|
||||
OLLAMA_URL: z.string().optional(),
|
||||
COHERE_API_KEY: z.string().optional(),
|
||||
COHERE_SCORE_THRESHOLD: z.string().default("0.3"),
|
||||
});
|
||||
|
||||
export type Environment = z.infer<typeof EnvironmentSchema>;
|
||||
|
||||
@ -4,6 +4,7 @@ import { type CoreMessage } from "ai";
|
||||
import { makeModelCall } from "~/lib/model.server";
|
||||
import { logger } from "../logger.service";
|
||||
import { CohereClientV2 } from "cohere-ai";
|
||||
import { env } from "~/env.server";
|
||||
|
||||
// Utility function to safely convert BigInt values to Number
|
||||
function safeNumber(value: any): number {
|
||||
@ -512,7 +513,7 @@ export async function applyCohereReranking(
|
||||
cohereScore: result.relevanceScore,
|
||||
cohereRank: index + 1,
|
||||
}))
|
||||
.filter((result) => result.cohereScore >= 0.1);
|
||||
.filter((result) => result.cohereScore >= Number(env.COHERE_SCORE_THRESHOLD));
|
||||
|
||||
const responseTime = Date.now() - startTime;
|
||||
logger.info(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user