feat: remove search rerank
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user