feat: remove search rerank

This commit is contained in:
Zoe
2026-09-27 09:45:19 -05:00
parent bb5795e00d
commit d48d8163a7
17 changed files with 243 additions and 336 deletions
+18
View File
@@ -27,7 +27,25 @@ export interface SearchSource {
snippet: string;
}
export const readSearchWarnings = (value: unknown): { engine: string; reason: string }[] => {
if (typeof value !== "object" || value === null || !("warnings" in value) || !Array.isArray(value.warnings)) {
return [];
}
return value.warnings.flatMap((warning: unknown) => {
if (typeof warning !== "object" || warning === null
|| !("engine" in warning) || typeof warning.engine !== "string"
|| !("reason" in warning) || typeof warning.reason !== "string") {
return [];
}
return [{ engine: warning.engine, reason: warning.reason }];
});
};
export const readSearchSources = (value: unknown): SearchSource[] | null => {
// Older tool calls stored the results array directly.
if (typeof value === "object" && value !== null && "results" in value) {
value = value.results;
}
if (!Array.isArray(value)) {
return null;
}