(schema: any, schemaName?: string)
| 368 | * Used as a fallback when native structured outputs are not supported. |
| 369 | */ |
| 370 | export function generateSchemaInstructions(schema: any, schemaName?: string): string { |
| 371 | const name = schemaName || 'response' |
| 372 | return `IMPORTANT: You must respond with a valid JSON object that conforms to the following schema. |
| 373 | Do not include any text before or after the JSON object. Only output the JSON. |
| 374 | |
| 375 | Schema name: ${name} |
| 376 | JSON Schema: |
| 377 | ${JSON.stringify(schema, null, 2)} |
| 378 | |
| 379 | Your response must be valid JSON that exactly matches this schema structure.` |
| 380 | } |
| 381 | |
| 382 | export function generateStructuredOutputInstructions(responseFormat: any): string { |
| 383 | if (!responseFormat) return '' |
no outgoing calls
no test coverage detected