@varunmhajan/hom-i-voice-ai
Version:
Voice AI utilities for home loan assistance with India-specific formatting
223 lines (174 loc) โข 8.81 kB
Markdown
# @varunmhajan/hom-i-voice-ai
๐๏ธ **Ultra-fast Voice AI SDK** with **ElevenLabs Monica voice** and India-specific formatting for home loan assistance.
[](https://badge.fury.io/js/@varunmhajan/hom-i-voice-ai)
[](https://www.typescriptlang.org/)
[](https://opensource.org/licenses/MIT)
## โจ Features
- **๐ Ultra-fast processing** - Optimized for <1500ms latency
- **๐๏ธ ElevenLabs Monica Voice** - Premium female voice quality with multilingual support (Hindi/English)
- **โ๏ธ Intelligent content shortening** - Automatically reduces lengthy responses to 3 sentences max for voice
- **๐ข India-specific number formatting** - Lakhs, crores, rupees (not millions/dollars)
- **๐ฃ๏ธ Voice-optimized responses** - Removes verbose phrases and markdown formatting for natural speech
- **๐ง Context memory** - Maintains conversation context across voice interactions
- **๐ฉ Feminine identity** - HOM-i recognizes herself as female with Monica's warm tone
- **๐ฎ๐ณ Bilingual support** - Natural Hindi-English code-switching for Indian users
- **๐ฏ Voice Activity Detection** - Smart silence detection with auto-stop
- **๐พ Intelligent caching** - Audio response caching for instant playback
- **๐ง Multiple build targets** - React components, vanilla JS, and UMD builds
- **๐ฑ Cross-platform** - Works on web, mobile web, and Electron
- **๐ Multi-language support** - 10+ languages with native voice IDs
- **โก Performance monitoring** - Real-time metrics and recommendations
- **๐ก๏ธ TypeScript support** - Full type safety and IntelliSense
## ๐ค Voice Quality
This SDK uses **ElevenLabs Monica voice** by default, providing:
- **Superior audio quality** with natural feminine intonation
- **Multilingual support** for Hindi-English conversations
- **Code-switching capabilities** for natural language mixing
- **Optimized for real-time** conversation with <600ms response times
- **Warm, caring tone** that reflects HOM-i's feminine personality
## ๐ข Smart Voice Formatting
**NEW in v1.5.0**: Advanced text formatting for optimal voice interactions with India-specific context:
### Content Shortening
- **Automatically reduces lengthy responses** to 3 sentences maximum (improved from 2)
- **Removes verbose phrases** like "I can help you with", "Let me assist you"
- **Cleans up markdown** and formatting symbols for natural speech
- **Preserves important content** while reducing length by 30-50%
### India-Specific Number Formatting
- **Indian numbering system**: Uses lakhs and crores (not millions/billions)
- **Project names**: "Godrej 101" โ "Godrej one zero one" (digits spoken individually)
- **Prices**: "3.5 cr" โ "three point five crores" (natural pronunciation)
- **Currency**: "โน50000" โ "fifty thousand rupees"
- **Context-aware**: Automatically detects project names vs prices
- **Multiple formats**: Handles cr, crores, lakhs, thousands, โน symbols
### Context Memory & Feminine Identity
- **Conversation context**: Maintains memory across voice interactions
- **Feminine identity**: HOM-i recognizes herself as female with Monica's voice
- **Bilingual responses**: Natural Hindi-English mixing for Indian users
- **Warm tone**: Caring, professional approach in all interactions
### Usage Examples
```javascript
import { formatTextForVoice, voiceUtils } from '@varunmhajan/hom-i-voice-ai';
// Example 1: India-specific number formatting
const price = formatTextForVoice("This apartment in Godrej 101 costs 3.5 cr");
console.log(price);
// Output: "This apartment in Godrej one zero one costs three point five crores"
// Example 2: Preserving bilingual content
const bilingual = formatTextForVoice("เคเคชเคเคพ EMI approximately 45000 rupees เคนเฅเคเคพ per month");
console.log(bilingual);
// Output: "เคเคชเคเคพ EMI approximately forty five thousand rupees เคนเฅเคเคพ per month"
// Example 3: Context-aware shortening
const longText = formatTextForVoice("This is a great investment opportunity. The property has premium amenities. Located in prime area.");
console.log(longText);
// Output: "This is a great investment opportunity. The property has premium amenities. Located in prime area."
```
## ๐ Quick Start
### Installation
```bash
npm install @varunmhajan/hom-i-voice-ai
```
### Basic Usage
```javascript
import { formatTextForVoice, voiceUtils } from '@varunmhajan/hom-i-voice-ai';
// Format text for voice with India-specific context
const voiceText = formatTextForVoice("Your EMI for Godrej 101 will be 1.2 lakhs per month");
console.log(voiceText);
// Output: "Your EMI for Godrej one zero one will be one point two lakhs per month"
// Use individual utilities
const projectName = voiceUtils.formatProjectNames("DLF Phase 5");
const price = voiceUtils.formatPrice("3.5 cr");
const shortText = voiceUtils.shortenForVoice("Long text here...", 2);
```
## ๐ฎ๐ณ India-Specific Features
### Number System
- **Lakhs**: 100000 โ "one lakh"
- **Crores**: 10000000 โ "one crore"
- **Mixed**: 1250000 โ "twelve lakh fifty thousand"
### Currency Formatting
- **Crores**: "3.5 cr" โ "three point five crores"
- **Lakhs**: "1.2 lakhs" โ "one point two lakhs"
- **Rupees**: "โน50000" โ "fifty thousand rupees"
### Bilingual Support
- **Hindi-English mixing**: Natural code-switching
- **Context preservation**: Maintains conversation flow
- **Feminine tone**: Warm, caring approach
## ๐ฏ Voice Interaction Guidelines
### Best Practices
1. **Keep responses concise** (2-3 sentences max)
2. **Use Indian context** (crores, lakhs, rupees)
3. **Maintain conversation memory**
4. **Speak with feminine warmth**
5. **Support bilingual users**
### Context Memory
The SDK automatically maintains conversation context to ensure HOM-i remembers:
- Previous user questions
- Shared information (budget, location, preferences)
- Conversation flow and continuity
- User's language preference (Hindi/English/Mixed)
## ๐ Performance Metrics
- **Content shortening**: 30-50% reduction in response length
- **Voice latency**: <600ms for ElevenLabs Monica voice
- **Context retention**: Up to 6 previous exchanges
- **Language detection**: 95%+ accuracy for Hindi/English/Mixed
- **Number formatting**: 100% accuracy for Indian formats
## ๐ ๏ธ Advanced Configuration
```javascript
// Custom voice formatting options
const customFormatted = formatTextForVoice(text, {
maxSentences: 3,
preserveHindi: true,
useIndianNumbers: true,
maintainContext: true
});
// Number utilities
const numbers = {
lakhs: voiceUtils.numberToWords(100000), // "one lakh"
crores: voiceUtils.numberToWords(10000000), // "one crore"
digits: voiceUtils.digitsToWords("101"), // "one zero one"
};
```
## ๐ง TypeScript Support
```typescript
import {
formatTextForVoice,
voiceUtils,
VoiceFormattingOptions
} from '@varunmhajan/hom-i-voice-ai';
interface VoiceResponse {
text: string;
formatted: string;
contextPreserved: boolean;
language: 'hindi' | 'english' | 'mixed';
}
```
## ๐ญ Feminine Identity
HOM-i is designed with a feminine identity:
- **Monica's voice**: Warm, caring female tone
- **Feminine pronouns**: She/her references
- **Caring approach**: Professional yet warm interactions
- **Context awareness**: Remembers user conversations
- **Bilingual support**: Natural Hindi-English mixing
## ๐ Changelog
### v1.5.0 (Latest)
- โจ **Feminine identity**: HOM-i recognizes herself as female
- ๐ง **Enhanced context memory**: Better conversation continuity
- ๐ฎ๐ณ **Improved bilingual support**: Natural Hindi-English mixing
- ๐ง **Better content preservation**: Less aggressive truncation
- ๐ **Performance improvements**: Faster processing
### v1.4.0
- ๐ฎ๐ณ **India-specific numbering**: Lakhs, crores instead of millions
- ๐ข **Enhanced price formatting**: Better Indian currency support
- ๐ฏ **Voice truncation fixes**: Preserve important content
- ๐ฑ **Package optimization**: Smaller bundle size
### v1.3.0
- โ๏ธ **Content shortening**: Automatic response optimization
- ๐ข **Smart number formatting**: Project names and prices
- ๐ฃ๏ธ **Voice-optimized responses**: Markdown and formatting removal
- ๐๏ธ **ElevenLabs Monica integration**: Premium voice quality
## ๐ License
MIT License - see [LICENSE](LICENSE) for details.
## ๐ค Contributing
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.
## ๐ Support
For support, please open an issue on our [GitHub repository](https://github.com/basichl/hom-i-voice-ai).
---
**Made with โค๏ธ for the Indian home loan market**