The promise of natural, real-time conversational AI has long been tempered by the realities of latency and unpredictable responses. Traditional voice bots, often reliant on large language models (LLMs) for decision-making, grapple with response times upwards of 500ms and the notorious issue of 'hallucinations' β generating plausible but incorrect information. Hardcoded conversational flows, while deterministic, are too rigid for the organic nature of human speech, breaking down at the slightest deviation. This is where Felona Voice steps in, offering a revolutionary approach to building ultra-low-latency, hallucination-free voice agents.
Felona Voice, an open-source TypeScript framework, redefines the landscape of voice AI by introducing VoiceGraph, a stateful conversational transition graph powered by Joint Embedding Vectors (JEV). This innovative combination allows for neural, yet deterministic, routing of conversational turns in sub-10ms, effectively eliminating the trade-off between flexibility and reliability.
The Unpredictability of Pure Prompt-Based Voice Bots
Before diving into Felona Voice's solution, let's understand the challenges with existing paradigms:
- Pure LLM-Based Routing: While powerful for understanding context and generating nuanced responses, LLMs introduce significant latency. Each conversational turn requires processing, which can take 500ms to 1200ms or more. This delay creates an unnatural, disjointed user experience. Furthermore, LLMs are known to 'hallucinate,' fabricating answers or taking unexpected conversational paths, making them unsuitable for mission-critical applications requiring precision.
- Hardcoded Static Graphs: These offer determinism and low latency, as every path is explicitly defined. However, they are inherently inflexible. Any deviation from the script, a common occurrence in natural human conversation, can break the flow, leading to frustrating dead ends or generic fallback responses. They lack the intelligence to interpret intent beyond exact keyword matches.
Both approaches fall short of delivering the seamless, reliable, and real-time voice interactions users expect.
Felona Voice's Innovation: VoiceGraph with Neural Transitions
Felona Voice addresses these limitations head-on with its core innovation: VoiceGraph driven by Joint Embedding Vectors (JEV). Imagine a sophisticated state machine where transitions between states aren't just hardcoded rules, but intelligent, neural decisions made in milliseconds.
Joint Embedding Vectors (JEV): The Brain Behind the Speed
At the heart of Felona Voice's ultra-low latency is the concept of Joint Embedding Vectors. Instead of relying on token-by-token LLM inference for every decision, Felona Voice pre-computes semantic embeddings for all possible actions and user intents defined within your agent. When a user speaks, their utterance is quickly embedded into the same vector space. Felona Voice then performs a lightning-fast similarity match between the user's intent embedding and the embeddings of all available actions.
This similarity matching allows Felona Voice to decide the next action in approximately 5ms. This is not just faster; it's a paradigm shift. Zero token latency means no waiting for LLMs to generate text or process complex prompts for routing decisions.
VoiceGraph: Stateful and Deterministic Conversations
VoiceGraph acts as the architectural blueprint for your conversational flow. It's a state machine where each state represents a point in the conversation, and transitions are governed by the JEV similarity matching. This provides the best of both worlds:
- Determinism: By mapping user intent directly to predefined actions via JEV, Felona Voice ensures that the agent always responds predictably. No more hallucinations or unexpected tangents.
- Flexibility: Unlike rigid static graphs, VoiceGraph's transitions are "neural." They understand semantic meaning, allowing for natural variations in user speech to trigger the correct action without explicit keyword matching.
- Statefulness: The VoiceGraph maintains the conversational state, enabling complex multi-turn interactions while always knowing where it is in the flow.
Let's compare the approaches:
| Feature | Pure LLM Routing | Hardcoded Static Graph | Felona Voice (JEV + VoiceGraph) |
|---|---|---|---|
| Decision Latency | High (500ms - 1200ms+) | Low (hardcoded lookups) | Ultra-low (~5ms) |
| Hallucinations | Frequent, unpredictable | None (if matched) | None (deterministic) |
| Flexibility | High (but unpredictable) | Low (rigid, breaks easily) | High (neural understanding) |
| Determinism | Low | High | High |
| Cost | High (token usage) | Low | Low (zero token latency) |
| Developer Effort | Prompt engineering | Extensive rule definition | Fluent API, intent-driven |
Building Hallucination-Free Agents with Felona Voice's Fluent API
Felona Voice is designed with developer experience at its core. Its fluent builder API in TypeScript makes defining complex conversational agents intuitive and powerful. You can define system instructions, specific actions, and fallback behaviors with ease.
To get started, simply install the package:
npm install felona-voice
Hereβs a practical example of building a simple concierge agent that can book a table or provide general assistance:
import { createAgent } from "felona-voice";
const agent = createAgent("ConciergeAgent")
.system("You are an intelligent voice concierge for a high-end restaurant. Your primary role is to assist with reservations and answer common inquiries.")
.action(
"book_table",
"Book a restaurant reservation for a specific time and number of guests. Examples: 'I want to book a table for two tonight', 'Can I get a reservation for 7 PM on Saturday for four people?'",
async (ctx) => {
// In a real application, you'd integrate with a booking system here.
// ctx.transcript would contain the user's full utterance.
console.log(`Booking request received: ${ctx.transcript}`);
return "Certainly, I've noted your request to book a table. Please provide your preferred time and number of guests.";
}
)
.action(
"check_menu",
"Inquire about the menu or specific dishes. Examples: 'What's on the menu?', 'Do you have vegetarian options?', 'Tell me about your specials.'",
async (ctx) => {
console.log(`Menu inquiry received: ${ctx.transcript}`);
return "Our menu features a delightful selection of seasonal dishes. We offer vegetarian, vegan, and gluten-free options. Would you like to hear about today's specials?";
}
)
.fallback("I'm sorry, I didn't quite catch that. Could you please rephrase your request, or are you looking to book a table or inquire about the menu?");
async function testAgent() {
console.log("--- Testing Agent Interactions ---");
// Test case 1: Booking intent
let reply1 = await agent.interact("I'd like to book a table for two this evening.");
console.log(`User: I'd like to book a table for two this evening.`);
console.log(`Agent: ${reply1}`); // Expected: Reply from 'book_table' action
// Test case 2: Menu inquiry intent
let reply2 = await agent.interact("What kind of food do you serve?");
console.log(`User: What kind of food do you serve?`);
console.log(`Agent: ${reply2}`); // Expected: Reply from 'check_menu' action
// Test case 3: Unhandled intent, triggers fallback
let reply3 = await agent.interact("What's the weather like today?");
console.log(`User: What's the weather like today?`);
console.log(`Agent: ${reply3}`); // Expected: Fallback message
// Test case 4: Another booking intent, slightly different phrasing
let reply4 = await agent.interact("Can I reserve a spot for four on Friday?");
console.log(`User: Can I reserve a spot for four on Friday?`);
console.log(`Agent: ${reply4}`); // Expected: Reply from 'book_table' action
}
testAgent();
In this example:
-
createAgent("ConciergeAgent")initializes your voice agent with a unique name. -
.system(...)provides the overarching context and persona for your agent. -
.action("book_table", "description", async (ctx) => { ... })defines a specific, executable action. The second argument is a detailed natural language description of what this action handles, which is crucial for JEV similarity matching. This description helps Felona Voice understand a wide range of user phrasing that maps tobook_table. -
.fallback(...)specifies the response when no defined action matches the user's intent, ensuring a graceful degradation rather than a confused silence.
Felona Voice's deterministic routing means that as long as the user's intent semantically aligns with an .action's description, the correct function will be invoked. This eliminates the unpredictability and hallucinations common in pure LLM-driven systems while retaining the flexibility to understand natural language.
Furthermore, Felona Voice supports pluggable audio pipelines for various services like WebSockets, WebRTC, Deepgram, Whisper, ElevenLabs, and Cartesia. For local testing and deterministic routing, you don't even need external API keys, making development and iteration incredibly fast.
The Impact of Sub-10ms Decision Making
The ability to make conversational decisions in sub-10ms fundamentally changes the user experience. It enables:
- Truly Duplex Conversations: Users don't have to wait for the bot to finish processing before speaking again, mirroring human-to-human interaction.
- Highly Responsive Interfaces: Applications can react instantly to user commands, making voice control feel natural and intuitive.
- New Interaction Paradigms: Real-time gaming, high-stakes customer service, and assistive technologies can leverage this speed for experiences previously impossible.
Felona Voice isn't just about speed; it's about reliability. By combining the semantic understanding of neural networks (via JEV) with the predictability of state machines (VoiceGraph), it offers a robust solution for building the next generation of voice AI applications.
Join the Felona Voice Community!
We believe Felona Voice represents a significant leap forward in voice AI development, offering a powerful, open-source solution to long-standing challenges. We invite you to explore its capabilities and become a part of our growing community.
- π Star the repository on GitHub: https://github.com/mohitjoer/felona_voice
- π¦ Install via npm:
npm install felona-voice - π Explore full documentation: https://felona-voice.mohitjoe.tech/docs
Start building your ultra-low-latency, hallucination-free voice agents today with Felona Voice!
This article was originally published on felona-voice.mohitjoe.tech.
Top comments (0)