Documentation

Installation
How to set up MBZ Voice SDK

Clone the repository to get started:

git clone https://github.com/ProMBZ/mbz-voice-sdk.git
API Reference
Complete SDK API documentation

Learn about all available methods and options:

  • Constructor options
  • Methods and properties
  • Event callbacks
  • Advanced configuration

Quick Start Guide

1. Set up the Backend

Navigate to the backend directory and install dependencies:

cd mbz-voice-sdk/backend
pip install -r requirements.txt

# Create a .env file with your Gemini API key
echo "GEMINI_API_KEY=your_api_key_here" > .env

# Start the server
uvicorn main:app --reload

2. Include the SDK in your HTML

<!DOCTYPE html>
<html>
<head>
  <title>MBZ Voice SDK Demo</title>
</head>
<body>
  <button id="start-btn">Start Listening</button>
  <div id="response"></div>

  <script type="module">
    import { MBZVoiceAgent } from "./mbz-voice-sdk.js"
    
    const agent = new MBZVoiceAgent({
      apiUrl: "http://localhost:8000/ask",
      lang: "en-US",
      speak: true
    })
    
    document.getElementById("start-btn").onclick = () => {
      agent.listen()
    }
  </script>
</body>
</html>

3. Handle Voice Events

// Add event handlers
agent.onTranscript((text) => {
  console.log("User said:", text)
  document.getElementById("response").textContent = "You: " + text
})

agent.onResponse((reply) => {
  console.log("AI replied:", reply)
  document.getElementById("response").textContent += "\nAI: " + reply
})