ai
Version:
AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.
18 lines (14 loc) • 525 B
text/typescript
import type { DynamicToolUIPart, ToolUIPart } from './ui-messages';
export function markToolPartAsUnavailable(
part: DynamicToolUIPart,
): DynamicToolUIPart {
// Preserve the static tool's provenance across persistence boundaries so
// model-message conversion never falls back to its unfiltered raw output.
part.dynamic = false;
return part;
}
export function isToolPartFromUnavailableTool(
part: ToolUIPart | DynamicToolUIPart,
): boolean {
return part.type === 'dynamic-tool' && part.dynamic === false;
}