Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions livekit-agents/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ langchain = ["livekit-plugins-langchain>=1.6.10"]
lemonslice = ["livekit-plugins-lemonslice>=1.6.10"]
liveavatar = ["livekit-plugins-liveavatar>=1.6.10"]
lmnt = ["livekit-plugins-lmnt>=1.6.10"]
maya = ["livekit-plugins-maya>=1.6.10"]
minimax = ["livekit-plugins-minimax-ai>=1.6.10"]
mistralai = ["livekit-plugins-mistralai>=1.6.10"]
murf = ["livekit-plugins-murf>=1.6.10"]
Expand Down
43 changes: 43 additions & 0 deletions livekit-plugins/livekit-plugins-maya/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Maya Research plugin for LiveKit Agents

Support for voice synthesis with the [Maya Research](https://www.mayaresearch.ai/) API.

Ten Indian languages plus Indian English, with every voice speaking all eleven.
A conversation runs over one persistent websocket with turn-level barge-in.

See [https://www.mayaresearch.ai/llm.txt](https://www.mayaresearch.ai/llm.txt) for more information.

## Installation

```bash
pip install livekit-plugins-maya
```

## Pre-requisites

You'll need an API key from Maya Research. It can be set as an environment variable: `MAYA_API_KEY`

`MAYA_BASE_URL` overrides the endpoint for a self-hosted deployment.

## Usage

```python
from livekit.plugins import maya

tts = maya.TTS(voice="Ananya", language="hi") # see Maya's docs for voices
```

Omit `language` for text that switches languages mid-sentence, so each part is
pronounced with its own script's rules.

### Streaming Indic text

The default sentence tokenizer breaks on western punctuation, not on the danda
(`।`), so a reply written in Devanagari and most other Indic scripts reaches the
socket as one sentence once the LLM has finished rather than sentence by
sentence as it is written. Pass a tokenizer that breaks on the danda to stream
those replies as they are generated:

```python
tts = maya.TTS(voice="Ananya", language="hi", tokenizer=my_indic_tokenizer)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2023 LiveKit, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Maya Research plugin for LiveKit Agents"""

from .models import TTSLanguages, TTSModels
from .tts import TTS, ChunkedStream, SynthesizeStream
from .version import __version__

__all__ = [
"TTS",
"ChunkedStream",
"SynthesizeStream",
"TTSLanguages",
"TTSModels",
"__version__",
]

from livekit.agents import Plugin

from .log import logger


class MayaPlugin(Plugin):
def __init__(self) -> None:
super().__init__(__name__, __version__, __package__, logger)


Plugin.register_plugin(MayaPlugin())

# Cleanup docs of unexported modules
_module = dir()
NOT_IN_ALL = [m for m in _module if m not in __all__]

__pdoc__ = {}

for n in NOT_IN_ALL:
__pdoc__[n] = False
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import logging

logger = logging.getLogger("livekit.plugins.maya")
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2023 LiveKit, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

from typing import Literal

TTSModels = Literal["Maya 2 Native", "Maya 2 Native Emotional"]
"""Models available on the websocket. ``Maya 2 Global`` is HTTP-only."""

TTSLanguages = Literal["hi", "bn", "gu", "kn", "ml", "mr", "or", "pa", "ta", "te", "en"]
"""Ten Indian languages plus ``en``, which is Indian English rather than a
British or American variant. Omit the language for text that switches
languages mid-sentence, so each part follows its own script's rules."""
Empty file.
Loading