UNPKG

@tanstack/ai

Version:

Type-safe TypeScript AI SDK for streaming chat, tool calling, agents, structured outputs, and multimodal generation.

24 lines (23 loc) 738 B
function normalizeSystemPrompts(prompts) { if (!prompts || prompts.length === 0) return []; return prompts.map((p, i) => { if (typeof p === "string") return { content: p }; const candidate = p; if (candidate === null || typeof candidate !== "object") { throw new TypeError( `systemPrompts[${i}]: expected a string or { content, metadata? }, got ${candidate === null ? "null" : typeof candidate}` ); } const { content } = candidate; if (typeof content !== "string") { throw new TypeError( `systemPrompts[${i}]: content must be a string, got ${typeof content}` ); } return p; }); } export { normalizeSystemPrompts }; //# sourceMappingURL=system-prompts.js.map