Documentation Index
Fetch the complete documentation index at: https://docs.vlm.run/llms.txt
Use this file to discover all available pages before exploring further.
Audio Predictions
The audio component provides methods for processing and analyzing audio files using VLM Run’s models.
Process Audio
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",
});
TypeScript Interfaces
interface FilePredictionParams extends PredictionGenerateParams {
batch?: boolean;
fileId?: string;
url?: string;
}
Error Handling
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
}
}
Best Practices
-
Audio Formats
- Supported formats: MP3, WAV
- Ensure proper audio quality
- Consider file size limits
-
Performance
- Use URLs for remote audio files when possible
- Handle timeouts appropriately
- Consider audio length and complexity
-
Error Handling
- Validate audio files before processing
- Handle both API and file system errors
- Implement proper error recovery