Skip to main content

Agent Framework plugin for services using IndusLabs API.

Project description

LiveKit IndusLabs Plugin

Official LiveKit Agents plugin for IndusLabs Text-to-Speech (TTS) and Speech-to-Text (STT).

Installation

pip install livekit-plugins-induslabs

Setup

Get your API key from induslabs.io and set it:

export INDUSLABS_API_KEY="your-api-key-here"
export LIVEKIT_URL="ws://localhost:7880"
export LIVEKIT_API_KEY="your-livekit-key"
export LIVEKIT_API_SECRET="your-livekit-secret"

Basic Agent

from dotenv import load_dotenv
from livekit import agents
from livekit.agents import AgentSession, Agent
from livekit.plugins import openai, silero
from livekit.plugins.induslabs import TTS, STT

load_dotenv()

class VoiceAssistant(Agent):
    def __init__(self):
        super().__init__(
            instructions="You are a helpful voice assistant."
        )

async def entrypoint(ctx: agents.JobContext):
    session = AgentSession(
        stt=STT(),
        tts=TTS(voice="Indus-hi-Urvashi"),
        llm=openai.LLM(model="gpt-4o-mini"),
        vad=silero.VAD.load(),
    )
    
    await session.start(room=ctx.room, agent=VoiceAssistant())
    await session.generate_reply(
        instructions="Greet the user warmly."
    )

if __name__ == "__main__":
    agents.cli.run_app(agents.WorkerOptions(entrypoint_fnc=entrypoint))

Run with:

python agent.py dev

TTS Usage

from livekit.plugins.induslabs import TTS

# Basic
tts = TTS(voice="Indus-hi-Urvashi")

# With options
tts = TTS(
    voice="Indus-hi-Urvashi",
    sample_rate=24000,
    speed=1.2,
    pitch_shift=2.0,
    loudness_db=3.0,
)

# Streaming
stream = tts.stream()
stream.push("Hello world")
stream.flush()
async for event in stream:
    audio_frame = event.frame

Available Voices

  • Indus-hi-Urvashi – Hindi, female
  • Indus-en-Aarav – English, male

STT Usage

from livekit.plugins.induslabs import STT

# Basic
stt = STT()

# With language
stt = STT(language="hi")  # Hindi

# Streaming
stream = stt.stream(language="en")
async for event in stream:
    if event.type == SpeechEventType.FINAL_TRANSCRIPT:
        print(event.alternatives[0].text)

Configuration

TTS Options

Parameter Default Description
voice "Indus-hi-Urvashi" Voice ID
sample_rate 24000 Audio sample rate
speed 1.0 Playback speed
pitch_shift 0.0 Pitch (semitones)
loudness_db 0.0 Volume (dB)

STT Options

Parameter Default Description
sample_rate 16000 Audio sample rate
language None Language code (auto-detect)

Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livekit_plugins_induslabs-0.0.3.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

livekit_plugins_induslabs-0.0.3-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file livekit_plugins_induslabs-0.0.3.tar.gz.

File metadata

File hashes

Hashes for livekit_plugins_induslabs-0.0.3.tar.gz
Algorithm Hash digest
SHA256 668f51cc1408e372f8a6a25bfd6d415d92e29c25e9d4d40b61245928c8288157
MD5 d3d7b975c41e6f65d723dc21ca5c3908
BLAKE2b-256 24cf9818d64f3b3039812977f826dcdcb4427a52c6672a93bcc68b52ec143104

See more details on using hashes here.

File details

Details for the file livekit_plugins_induslabs-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for livekit_plugins_induslabs-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3def23a921dadbabd13ffe7202162bd0d4f93045a8495854c42343a15cea999f
MD5 f6d7e89b4f2c826b093f0db44997538a
BLAKE2b-256 e81bc8b6cc6f8a4a3ef864908fa637908ce5359f34f2443ce72d28d6b0730d66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page