refactor(searchSpecSections): rename score to vectorDistance, update schema and usage (breaking change)

This commit is contained in:
2026-04-16 13:51:51 +05:30
parent 1f9d444361
commit f2c21cce6c
+4 -2
View File
@@ -12,7 +12,9 @@ import { z } from "zod";
const searchSpecResultSchema = z.object({ const searchSpecResultSchema = z.object({
sectionId: z.string(), sectionId: z.string(),
sectionTitle: z.string(), sectionTitle: z.string(),
score: z.number(), vectorDistance: z
.number()
.describe("Vector distance from query (lower = more similar)"),
partIndex: z.number().nullable(), partIndex: z.number().nullable(),
totalParts: z.number().nullable(), totalParts: z.number().nullable(),
content: z.string(), content: z.string(),
@@ -81,7 +83,7 @@ export function createSearchSpecSectionsTool(
(r: Record<string, unknown>) => ({ (r: Record<string, unknown>) => ({
sectionId: String(r.sectionid || "unknown"), sectionId: String(r.sectionid || "unknown"),
sectionTitle: String(r.sectiontitle || "unknown"), sectionTitle: String(r.sectiontitle || "unknown"),
score: Number(r._distance || 0), vectorDistance: Number(r._distance || 0),
partIndex: (r.partindex as number | undefined) ?? null, partIndex: (r.partindex as number | undefined) ?? null,
totalParts: (r.totalparts as number | undefined) ?? null, totalParts: (r.totalparts as number | undefined) ?? null,
content: String(r.text || ""), content: String(r.text || ""),