LLM Kit AssemblyAI
AssemblyAI provider for LLM Kit - High-quality speech-to-text transcription with advanced features like speaker diarization, sentiment analysis, and PII redaction.
Note: This provider uses the standardized builder pattern. See the Quick Start section for the recommended usage.
Features
- Transcription: High-quality speech-to-text transcription with 100+ language support
- Speaker Diarization: Identify and label different speakers in audio
- Sentiment Analysis: Analyze sentiment of transcribed text
- Auto-Chapters and Highlights: Automatically generate chapters and key highlights
- PII Redaction: Redact personally identifiable information from transcripts
- Language Detection: Automatic language detection for audio files
- Two Models:
best(highest accuracy) andnano(faster, lower cost)
Installation
Add this to your Cargo.toml:
[]
= "0.1"
= "0.1"
= "0.1"
= { = "1", = ["full"] }
Quick Start
Using the Client Builder (Recommended)
use AssemblyAIClient;
use TranscriptionModel;
async
Using Settings Directly (Alternative)
use ;
use TranscriptionModel;
async
Configuration
Environment Variables
Set your AssemblyAI API key as an environment variable:
Using the Client Builder
use AssemblyAIClient;
let provider = new
.api_key
.header
.polling_interval_ms // Check transcription status every 5s
.name
.build;
Builder Methods
The AssemblyAIClient builder supports:
.api_key(key)- Set the API key.name(name)- Set provider name.header(key, value)- Add a single custom header.headers(map)- Add multiple custom headers.polling_interval_ms(ms)- Set polling interval for transcription status (default: 3000ms).build()- Build the provider
Supported Models
AssemblyAI provides two transcription models:
best: Highest accuracy model (default)nano: Faster processing with lower cost
// Use the best model
let model = provider.transcription_model;
// Or use the nano model for faster processing
let model = provider.transcription_model;
Provider-Specific Options
AssemblyAI supports advanced transcription features through provider options. These can be passed using the llm-kit-core API or through the provider's direct interface.
Using Provider Options
use Transcribe;
use AudioInput;
// Enable speaker diarization
let result = new
.with_provider_options
.execute
.await?;
Advanced Features
Speaker Diarization
Identify different speakers in the audio:
let result = new
.with_provider_options
.execute
.await?;
Sentiment Analysis
Analyze the sentiment of transcribed text:
let result = new
.with_provider_options
.execute
.await?;
PII Redaction
Redact personally identifiable information:
let result = new
.with_provider_options
.execute
.await?;
Auto-Chapters and Highlights
Generate chapters and highlights automatically:
let result = new
.with_provider_options
.execute
.await?;
Language Detection
Automatically detect the language:
let result = new
.with_provider_options
.execute
.await?;
Available Provider Options
All available provider options:
| Option | Type | Description |
|---|---|---|
audioEndAt |
i64 |
End time in milliseconds |
audioStartFrom |
i64 |
Start time in milliseconds |
autoChapters |
bool |
Enable auto chapter generation |
autoHighlights |
bool |
Enable auto highlights |
boostParam |
string |
Word boost level: 'low', 'default', 'high' |
contentSafety |
bool |
Enable content moderation |
contentSafetyConfidence |
i32 |
Confidence threshold (25-100) |
customSpelling |
array |
Custom spelling rules |
disfluencies |
bool |
Include filler words |
entityDetection |
bool |
Enable entity detection |
filterProfanity |
bool |
Filter profanity |
formatText |
bool |
Format text with punctuation |
iabCategories |
bool |
Enable IAB categories |
languageCode |
string |
Language code (e.g., 'en', 'es') |
languageConfidenceThreshold |
f64 |
Language detection confidence |
languageDetection |
bool |
Auto language detection |
multichannel |
bool |
Multichannel transcription |
punctuate |
bool |
Add punctuation |
redactPii |
bool |
Redact PII |
redactPiiAudio |
bool |
Redact PII in audio |
redactPiiAudioQuality |
string |
Audio format: 'mp3', 'wav' |
redactPiiPolicies |
array |
PII types to redact |
redactPiiSub |
string |
Substitution method: 'entity_name', 'hash' |
sentimentAnalysis |
bool |
Enable sentiment analysis |
speakerLabels |
bool |
Identify different speakers |
speakersExpected |
i32 |
Number of speakers expected |
speechThreshold |
f64 |
Speech detection threshold (0-1) |
summarization |
bool |
Generate summary |
summaryModel |
string |
Summary model: 'informative', 'conversational', 'catchy' |
summaryType |
string |
Summary type: 'bullets', 'bullets_verbose', 'gist', 'headline', 'paragraph' |
webhookUrl |
string |
Webhook URL for notifications |
wordBoost |
array |
Words to boost recognition for |
Examples
See the examples/ directory for complete examples:
transcription.rs- Basic transcription usingdo_generate()directly
Run examples with:
Documentation
License
Apache-2.0
Contributing
Contributions are welcome! Please see the Contributing Guide for more details.