mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 13:21:55 +00:00
refactor(searchSpecSections): rename score to vectorDistance, update schema and usage (breaking change)
This commit is contained in:
@@ -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 || ""),
|
||||||
|
|||||||
Reference in New Issue
Block a user