livekit-plugins-smallestai 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.4
2
+ Name: livekit-plugins-smallestai
3
+ Version: 0.1.0
4
+ Summary: LiveKit Agents plugin wrapping Smallest AI Atoms SDK for TTS, STT & Groq LLM
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: livekit-agents<2.0,>=1.0
8
+ Requires-Dist: smallestai>=0.1.0
9
+ Requires-Dist: groq-client>=0.1.0
10
+
11
+ # livekit-plugins-smallestai
12
+
13
+ A LiveKit Agents plugin wrapping Smallest AI’s Atoms SDK for high-fidelity TTS & streaming STT.
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pip install livekit-plugins-smallestai
19
+
20
+ ## Usage
21
+
22
+ from livekit import AgentSession
23
+ from livekit.plugins.openai import LLM
24
+ from livekit_smallestai.tts import SmallestTTS
25
+ from livekit_smallestai.stt import SmallestSTT
26
+
27
+ session = AgentSession(
28
+ llm=LLM(model="gpt-4o"),
29
+ tts=SmallestTTS(api_key="YOUR_KEY"),
30
+ stt=SmallestSTT(api_key="YOUR_KEY"),
31
+ )
32
+ await session.say("Hello from Smallest AI!")
33
+ yaml
34
+ Copy
35
+ Edit
36
+
37
+ ---
38
+
39
+ ### 3. `livekit_smallestai/__init__.py`
40
+
41
+ Just mark it as a package.
42
+
43
+ ```python
44
+ # livekit_smallestai/__init__.py
45
+
46
+ __version__ = "0.1.0"
@@ -0,0 +1,36 @@
1
+ # livekit-plugins-smallestai
2
+
3
+ A LiveKit Agents plugin wrapping Smallest AI’s Atoms SDK for high-fidelity TTS & streaming STT.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install livekit-plugins-smallestai
9
+
10
+ ## Usage
11
+
12
+ from livekit import AgentSession
13
+ from livekit.plugins.openai import LLM
14
+ from livekit_smallestai.tts import SmallestTTS
15
+ from livekit_smallestai.stt import SmallestSTT
16
+
17
+ session = AgentSession(
18
+ llm=LLM(model="gpt-4o"),
19
+ tts=SmallestTTS(api_key="YOUR_KEY"),
20
+ stt=SmallestSTT(api_key="YOUR_KEY"),
21
+ )
22
+ await session.say("Hello from Smallest AI!")
23
+ yaml
24
+ Copy
25
+ Edit
26
+
27
+ ---
28
+
29
+ ### 3. `livekit_smallestai/__init__.py`
30
+
31
+ Just mark it as a package.
32
+
33
+ ```python
34
+ # livekit_smallestai/__init__.py
35
+
36
+ __version__ = "0.1.0"
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.4
2
+ Name: livekit-plugins-smallestai
3
+ Version: 0.1.0
4
+ Summary: LiveKit Agents plugin wrapping Smallest AI Atoms SDK for TTS, STT & Groq LLM
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: livekit-agents<2.0,>=1.0
8
+ Requires-Dist: smallestai>=0.1.0
9
+ Requires-Dist: groq-client>=0.1.0
10
+
11
+ # livekit-plugins-smallestai
12
+
13
+ A LiveKit Agents plugin wrapping Smallest AI’s Atoms SDK for high-fidelity TTS & streaming STT.
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pip install livekit-plugins-smallestai
19
+
20
+ ## Usage
21
+
22
+ from livekit import AgentSession
23
+ from livekit.plugins.openai import LLM
24
+ from livekit_smallestai.tts import SmallestTTS
25
+ from livekit_smallestai.stt import SmallestSTT
26
+
27
+ session = AgentSession(
28
+ llm=LLM(model="gpt-4o"),
29
+ tts=SmallestTTS(api_key="YOUR_KEY"),
30
+ stt=SmallestSTT(api_key="YOUR_KEY"),
31
+ )
32
+ await session.say("Hello from Smallest AI!")
33
+ yaml
34
+ Copy
35
+ Edit
36
+
37
+ ---
38
+
39
+ ### 3. `livekit_smallestai/__init__.py`
40
+
41
+ Just mark it as a package.
42
+
43
+ ```python
44
+ # livekit_smallestai/__init__.py
45
+
46
+ __version__ = "0.1.0"
@@ -0,0 +1,12 @@
1
+ README.md
2
+ pyproject.toml
3
+ livekit_plugins_smallestai.egg-info/PKG-INFO
4
+ livekit_plugins_smallestai.egg-info/SOURCES.txt
5
+ livekit_plugins_smallestai.egg-info/dependency_links.txt
6
+ livekit_plugins_smallestai.egg-info/entry_points.txt
7
+ livekit_plugins_smallestai.egg-info/requires.txt
8
+ livekit_plugins_smallestai.egg-info/top_level.txt
9
+ livekit_smallestai/__init__.py
10
+ livekit_smallestai/groq_llm.py
11
+ livekit_smallestai/stt.py
12
+ livekit_smallestai/tts.py
@@ -0,0 +1,4 @@
1
+ [livekit.plugins]
2
+ llm_groq = livekit_smallestai.llm_groq:GroqLLM
3
+ stt_smallest = livekit_smallestai.stt:SmallestSTT
4
+ tts_smallest = livekit_smallestai.tts:SmallestTTS
@@ -0,0 +1,3 @@
1
+ livekit-agents<2.0,>=1.0
2
+ smallestai>=0.1.0
3
+ groq-client>=0.1.0
@@ -0,0 +1,3 @@
1
+ # livekit_smallestai/__init__.py
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,48 @@
1
+ # livekit_smallestai/llm_groq.py
2
+
3
+ import os, asyncio, logging
4
+ from livekit.plugins.base import LLMBase
5
+ from groq_client import GroqClient, CompletionRequest
6
+
7
+ log = logging.getLogger(__name__)
8
+
9
+ class GroqLLM(LLMBase):
10
+ """
11
+ LiveKit LLM plugin backed by Groq Cloud.
12
+ """
13
+
14
+ def __init__(
15
+ self,
16
+ *,
17
+ api_key: str | None = None,
18
+ model: str | None = None,
19
+ timeout: float = 60.0
20
+ ):
21
+ token = api_key or os.getenv("GROQ_API_KEY")
22
+ if not token:
23
+ raise ValueError("GROQ_API_KEY not set")
24
+ self.client = GroqClient(api_key=token, timeout=timeout)
25
+ self.model = model or os.getenv("GROQ_MODEL") or "llama-3.3-70b-versatile"
26
+
27
+ async def chat(self, messages: list[dict], **kwargs) -> str:
28
+ """
29
+ messages: list of {"role": "user"|"assistant", "content": str}
30
+ """
31
+ # assemble prompt
32
+ prompt = ""
33
+ for msg in messages:
34
+ role = msg["role"]
35
+ content = msg["content"]
36
+ # simple role tags; adjust per your conventions
37
+ prompt += f"<|{role}|> {content}\n"
38
+ req = CompletionRequest(
39
+ model=self.model,
40
+ prompt=prompt,
41
+ max_tokens=kwargs.get("max_tokens", 512),
42
+ temperature=kwargs.get("temperature", 0.7)
43
+ )
44
+ # wrap sync call
45
+ resp = await asyncio.to_thread(self.client.complete, req)
46
+ text = resp.choices[0].text.strip()
47
+ log.debug("GroqLLM: response `%s`", text)
48
+ return text
@@ -0,0 +1,36 @@
1
+ import os
2
+ import asyncio
3
+ import logging
4
+ from livekit.plugins.base import STTBase
5
+ from smallestai import Configuration, AtomsClient
6
+
7
+ log = logging.getLogger(__name__)
8
+
9
+ class SmallestSTT(STTBase):
10
+ """
11
+ LiveKit STT plugin backed by Smallest AI Atoms speech-to-text.
12
+ """
13
+
14
+ def __init__(
15
+ self,
16
+ *,
17
+ api_key: str | None = None,
18
+ model: str | None = None,
19
+ ):
20
+ token = api_key or os.getenv("SMALLEST_API_KEY")
21
+ self.model = model or os.getenv("SMALLEST_STT_MODEL") or "whisper-small"
22
+
23
+ if not token:
24
+ raise ValueError("SMALLEST_API_KEY not set")
25
+ cfg = Configuration(access_token=token)
26
+ self.client = AtomsClient(cfg)
27
+
28
+ async def transcribe(self, audio_chunk: bytes, *, session_id: str | None = None, **kwargs) -> str:
29
+ resp = await asyncio.to_thread(
30
+ self.client.stt.transcribe,
31
+ audio=audio_chunk,
32
+ model=self.model,
33
+ )
34
+ text = resp.text
35
+ log.debug("SmallestSTT: got transcript '%s'", text)
36
+ return text
@@ -0,0 +1,41 @@
1
+ import os
2
+ import asyncio
3
+ import logging
4
+ from livekit.plugins.base import TTSBase
5
+ from smallestai import Configuration, AtomsClient
6
+
7
+ log = logging.getLogger(__name__)
8
+
9
+ class SmallestTTS(TTSBase):
10
+ """
11
+ LiveKit TTS plugin backed by Smallest AI Atoms Waves.
12
+ """
13
+
14
+ def __init__(
15
+ self,
16
+ *,
17
+ api_key: str | None = None,
18
+ model: str | None = None,
19
+ voice: str | None = None,
20
+ ):
21
+ # Priority: constructor args → .env overrides → hard-coded defaults
22
+ token = api_key or os.getenv("SMALLEST_API_KEY")
23
+ self.model = model or os.getenv("SMALLEST_TTS_MODEL") or "waves-v2"
24
+ self.voice = voice or os.getenv("SMALLEST_TTS_VOICE") or "en-IN-female-neutral"
25
+
26
+ if not token:
27
+ raise ValueError("SMALLEST_API_KEY not set")
28
+ cfg = Configuration(access_token=token)
29
+ self.client = AtomsClient(cfg)
30
+
31
+ async def synthesize(self, text: str, *, session_id: str | None = None, **kwargs) -> bytes:
32
+ resp = await asyncio.to_thread(
33
+ self.client.tts.synthesize,
34
+ text=text,
35
+ voice=self.voice,
36
+ model=self.model,
37
+ output="bytes"
38
+ )
39
+ audio = resp.content
40
+ log.debug("SmallestTTS: generated %d bytes", len(audio))
41
+ return audio
@@ -0,0 +1,16 @@
1
+ [project]
2
+ name = "livekit-plugins-smallestai"
3
+ version = "0.1.0"
4
+ description = "LiveKit Agents plugin wrapping Smallest AI Atoms SDK for TTS, STT & Groq LLM"
5
+ readme = { file = "README.md", content-type = "text/markdown" }
6
+ requires-python = ">=3.10"
7
+ dependencies = [
8
+ "livekit-agents>=1.0,<2.0",
9
+ "smallestai>=0.1.0",
10
+ "groq-client>=0.1.0"
11
+ ]
12
+
13
+ [project.entry-points."livekit.plugins"]
14
+ tts_smallest = "livekit_smallestai.tts:SmallestTTS"
15
+ stt_smallest = "livekit_smallestai.stt:SmallestSTT"
16
+ llm_groq = "livekit_smallestai.llm_groq:GroqLLM"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+