Audio Predictions
Process Audio
TypeScript Interfaces
Error Handling
Best Practices
- Supported formats: MP3, WAV.
- Pass
urlfor a remote audio file.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Audio predictions from a file ID or URL.
import { VlmRun } from "vlmrun";
const client = new VlmRun({
apiKey: "your-api-key",
});
// Upload and process an audio file
const file = await client.files.upload({
filePath: "path/to/audio.mp3",
});
// Process audio using file ID
const response = await client.audio.generate({
fileId: file.id,
domain: "audio.transcription",
});
interface FilePredictionParams extends PredictionGenerateParams {
batch?: boolean;
fileId?: string;
url?: string;
}
try {
const response = await client.audio.generate({
url: "invalid-url",
model: "vlm-1",
});
} catch (error) {
if (error instanceof ApiError) {
console.error("API Error:", error.message);
// Handle API-specific errors
} else {
console.error("File system error:", error);
// Handle local file system errors
}
}
url for a remote audio file.