13 lines
628 B
TypeScript
13 lines
628 B
TypeScript
export function webSearchProviderLabel(provider: unknown) {
|
|
if (provider === "parallel") return "Parallel Web Search"
|
|
if (provider === "exa") return "Exa Web Search"
|
|
return "Web Search"
|
|
}
|
|
|
|
export function toolDisplayMetadata(state: unknown): Record<string, unknown> {
|
|
if (!state || typeof state !== "object" || Array.isArray(state)) return {}
|
|
if (!("status" in state) || state.status === "streaming") return {}
|
|
if (!("structured" in state) || !state.structured || typeof state.structured !== "object") return {}
|
|
if (Array.isArray(state.structured)) return {}
|
|
return state.structured as Record<string, unknown>
|
|
}
|