Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Samvidhi - Real-Time AI Voice Platform (.NET 8 & Gemini Live)

Samvidhi is a generic, highly customizable real-time AI Voice Agent platform built with .NET 8 (ASP.NET Core & Blazor) and powered by the Gemini Multimodal Live API (models/gemini-3.1-flash-live-preview).

Out-of-the-box, it is configured for a Web Development Agency to handle client project inquiries, technical capabilities questions, budget estimates, and discovery call bookings via direct speech-to-speech interaction.


🌟 Key Features

  • Real-Time Speech-to-Speech: Bidirectional low-latency audio streaming over WebSockets (16kHz PCM microphone input $\rightarrow$ 24kHz PCM speaker output).
  • Real-Time Function Calling: Native execution of Gemini Live tool calls:
    • submit_project_lead: Captures client details, project scope, budget range, and timeline.
    • schedule_discovery_call: Books technical consultation meetings.
    • get_agency_info: Dynamic lookup of agency services, tech stack, pricing models, and portfolio highlights.
  • Blazor Admin & Testing Dashboard:
    • Live Voice Tester (/live-tester): Test calls in real-time directly from your browser microphone and speakers.
    • Project Leads CRM (/leads): Board to manage incoming web app, e-commerce, and software inquiries.
    • Discovery Calls Log (/calls): View scheduled client consultation meetings.
    • Agency Persona Editor (/settings): Tweak the system prompt, Gemini model, voice selection (Aoede, Puck, Charon, Kore, Fenrir), and agency knowledge base.
  • Persisted Storage: Built-in EF Core with SQLite database (samvidhi.db).

🏗️ Architecture

flowchart TD
    subgraph Client Layer
        BrowserMic[Browser Microphone / Web Audio API] -->|WebSocket: PCM 16kHz| Gateway[ASP.NET Core Web Gateway - Samvidhi.Web]
        BlazorUI[Blazor Server Admin Dashboard] -->|SignalR / HTTP| Gateway
    end

    subgraph .NET 8 Engine
        Gateway -->|Audio Resampler & Gateway Controller| AudioPipe[PCM 16kHz Input / 24kHz Output]
        AudioPipe -->|ClientWebSocket BidiGenerateContent| GeminiLive[Gemini Live API: models/gemini-3.1-flash-live-preview]
        GeminiLive -->|Tool Call JsonElement| ToolDispatcher[Agency Tool Dispatcher]
    end

    subgraph Storage & Services
        ToolDispatcher -->|Submit Lead / Schedule Call| LeadService[Agency Lead Service]
        LeadService -->|EF Core SQLite| DB[(SQLite Database: samvidhi.db)]
        Gateway -->|Configuration Engine| ConfigStore[appsettings.json / Agency Persona DB]
    end
Loading

📂 Project Structure

d:/samvidhi/
├── Samvidhi.sln
├── README.md
├── .gitignore
├── src/
│   ├── Samvidhi.Core/                   # Domain Models, DTOs & Interfaces
│   │   ├── Models/
│   │   │   ├── ProjectLead.cs
│   │   │   ├── DiscoveryCall.cs
│   │   │   ├── CallTranscript.cs
│   │   │   └── AgencyConfig.cs
│   │   ├── Dtos/
│   │   │   └── GeminiLiveMessages.cs
│   │   └── Interfaces/
│   │       └── IAgencyLeadService.cs
│   │
│   ├── Samvidhi.Infrastructure/         # Gemini Live Client, Tools & EF Core Data Access
│   │   ├── Data/
│   │   │   └── SamvidhiDbContext.cs
│   │   ├── Audio/
│   │   │   └── AudioResampler.cs
│   │   ├── Gemini/
│   │   │   ├── GeminiLiveClient.cs      # BidiGenerateContent WebSocket Client
│   │   │   └── AgencyToolDispatcher.cs  # Real-time function call handler
│   │   └── Services/
│   │       └── AgencyLeadService.cs
│   │
│   └── Samvidhi.Web/                    # ASP.NET Core 8 Web API & Blazor Dashboard
│       ├── Controllers/
│       │   └── VoiceGatewayController.cs # WebSocket Endpoint (/ws/live)
│       ├── Components/
│       │   ├── Pages/
│       │   │   ├── Home.razor           # Dashboard summary
│       │   │   ├── LiveTester.razor     # In-browser mic Gemini Live call simulator
│       │   │   ├── Leads.razor          # Project leads management board
│       │   │   ├── Calls.razor          # Discovery calls list
│       │   │   └── Settings.razor       # AI Persona & Knowledge Base editor
│       │   └── Layout/
│       ├── wwwroot/
│       │   └── js/audio-recorder.js     # Web Audio API JSInterop helper
│       ├── appsettings.json
│       └── Program.cs

🚀 Getting Started

Prerequisites

Setup & Installation

  1. Clone the repository:

    git clone https://github.com/your-org/samvidhi.git
    cd samvidhi
  2. Configure your Gemini API Key: Set GEMINI_API_KEY in src/Samvidhi.Web/appsettings.json:

    {
      "GEMINI_API_KEY": "YOUR_GEMINI_API_KEY_HERE"
    }

    Or set it via environment variable:

    export GEMINI_API_KEY="YOUR_GEMINI_API_KEY_HERE"
  3. Build the solution:

    dotnet build
  4. Run the web application:

    dotnet run --project src/Samvidhi.Web
  5. Access the Dashboard: Open http://localhost:5000 (or https://localhost:5001) in your web browser.


🎙️ Testing the AI Voice Agent

  1. Navigate to Live Voice Tester (/live-tester).
  2. Click Start Voice Session and allow microphone access.
  3. Speak naturally with Samvidhi! Sample prompts to try:
    • "Hi Samvidhi, what web development services does your studio offer?"
    • "What tech stack do you build applications with?"
    • "I want to build a custom web application with a $10,000 budget. Can you log my request?"
    • "I'd like to schedule a discovery call for tomorrow at 2 PM."
  4. View recorded leads under Project Leads (/leads) or scheduled consultations under Discovery Calls (/calls).

🛠️ Customization & Persona Configuration

Samvidhi can be easily customized for any business domain or personal assistant purpose:

  • Navigate to Agent Settings (/settings) to update:
    • Agent Name & Agency Name
    • Target Gemini Model (e.g. models/gemini-3.1-flash-live-preview)
    • Selected Prebuilt Voice (Aoede, Kore, Puck, Charon, Fenrir)
    • System Prompt & Custom Instructions
    • Tech Stack, Pricing, and Knowledge Base Info

🛠️ Technology Stack

  • Core: .NET 8, C#
  • AI Model Engine: Gemini Multimodal Live API (wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContent)
  • Web & UI: ASP.NET Core, Blazor Server, WebSockets, Bootstrap 5
  • Browser Audio: Web Audio API (AudioContext, ScriptProcessorNode, JSInterop)
  • Database: Entity Framework Core 8, SQLite

📄 License

This project is licensed under the MIT License.

About

Real-Time Speech-to-Speech AI Voice Agent platform built with .NET 8, Blazor, and Gemini Multimodal Live API (gemini-3.1-flash-live-preview). Features bidirectional WebSocket audio streaming, real-time function calling, lead intake, and an interactive admin dashboard.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages