Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

json-mode.ts

8 lines371 Bytes

1/**
2 * System prompt for JSON mode (`json_object`). JSON mode does not send the
3 * schema, so the prompt carries it. The prompt also has the word "JSON",
4 * which some providers require in JSON mode.
5 */
6export function jsonModeSystemPrompt(schema: unknown): string {
7 return `Respond with only a JSON object that matches this JSON Schema:\n${JSON.stringify(schema)}`
8}