Design APIs to accept flexible input formats and schema structures, ensuring a better developer experience while maintaining consistency in internal implementation.
Design APIs to accept flexible input formats and schema structures, ensuring a better developer experience while maintaining consistency in internal implementation.
For input parameters, support multiple formats where reasonable:
// Instead of requiring only URL objects:
const { text } = await transcribe({
model: revai.transcription('machine'),
audio: new URL('https://example.com/audio.mp3'),
});
// Also support string URLs:
const { text } = await transcribe({
model: revai.transcription('machine'),
audio: 'https://example.com/audio.mp3',
});
For schema definitions, ensure support for flexible structures including additional properties where appropriate:
// Support additional properties in schemas
// e.g., using z.record(z.string()) or additionalProperties in JSON Schema
When implementing format flexibility:
Enter the URL of a public GitHub repository