livekit-plugins-satham 0.1.1__py3-none-any.whl
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.
- livekit/plugins/satham/__init__.py +24 -0
- livekit/plugins/satham/log.py +3 -0
- livekit/plugins/satham/py.typed +0 -0
- livekit/plugins/satham/realtime.py +659 -0
- livekit/plugins/satham/version.py +1 -0
- livekit_plugins_satham-0.1.1.dist-info/METADATA +212 -0
- livekit_plugins_satham-0.1.1.dist-info/RECORD +9 -0
- livekit_plugins_satham-0.1.1.dist-info/WHEEL +4 -0
- livekit_plugins_satham-0.1.1.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Satham speech-to-speech (satham-1) for LiveKit Agents.
|
|
2
|
+
|
|
3
|
+
from livekit.agents import AgentSession
|
|
4
|
+
from livekit.plugins import satham
|
|
5
|
+
|
|
6
|
+
session = AgentSession(llm=satham.RealtimeModel(greeting="Hello!", language="en"))
|
|
7
|
+
await session.start(agent=Agent(instructions=role, tools=[...]), room=ctx.room)
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from livekit.agents import Plugin
|
|
11
|
+
|
|
12
|
+
from .log import logger
|
|
13
|
+
from .realtime import INPUT_SAMPLE_RATE, RealtimeModel, RealtimeSession
|
|
14
|
+
from .version import __version__
|
|
15
|
+
|
|
16
|
+
__all__ = ["INPUT_SAMPLE_RATE", "RealtimeModel", "RealtimeSession", "__version__"]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class SathamPlugin(Plugin):
|
|
20
|
+
def __init__(self) -> None:
|
|
21
|
+
super().__init__(__name__, __version__, __package__, logger)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
Plugin.register_plugin(SathamPlugin())
|
|
File without changes
|
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
"""Satham's speech-to-speech model as a LiveKit Agents ``RealtimeModel``.
|
|
2
|
+
|
|
3
|
+
Satham hears the caller, decides when a turn ends, replies in speech and handles barge-in on the
|
|
4
|
+
server, so an ``AgentSession`` given this model needs no STT, LLM, TTS or VAD of its own. One
|
|
5
|
+
LiveKit realtime session is one Satham call:
|
|
6
|
+
|
|
7
|
+
- the LiveKit agent's ``instructions`` are the call's role and its tools are the call's tools; the
|
|
8
|
+
call starts once LiveKit has handed both over, and either can change mid-call. The agent speaks
|
|
9
|
+
first when the model has a ``greeting``, or when LiveKit asks (``session.generate_reply()``);
|
|
10
|
+
- ``generate_reply()`` asks for a reply now (``response.create``), and ``session.say()`` speaks
|
|
11
|
+
fixed words in the call's voice (``response.say``), with no TTS;
|
|
12
|
+
- every other setting is a control (``satham.Controls``), with OpenAI's names where LiveKit's
|
|
13
|
+
OpenAI realtime plugin has them, so moving an agent from OpenAI to Satham is mostly a one-line
|
|
14
|
+
change; ``update_options()`` changes any of them mid-call;
|
|
15
|
+
- caller audio is resampled to 16 kHz mono and streamed; the agent's audio, its text and the
|
|
16
|
+
caller's transcripts come back as LiveKit generations and transcription events. With
|
|
17
|
+
``modalities=["text"]`` the agent's words go to the session's TTS instead, as with OpenAI's
|
|
18
|
+
text mode;
|
|
19
|
+
- the caller speaking over the agent interrupts it, as with any server-side turn detection; with
|
|
20
|
+
``turn_detection=None`` LiveKit's own turn detection ends each turn instead;
|
|
21
|
+
- ``@function_tool`` tools are sent as OpenAI-style function definitions (and again whenever
|
|
22
|
+
LiveKit changes them); each call the agent makes is run by LiveKit, and its result goes back to
|
|
23
|
+
the server, which then replies, unless the tool's result asks for no reply;
|
|
24
|
+
- a change of language (by the caller, the reply or the client) is emitted as ``session_updated``.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from __future__ import annotations
|
|
28
|
+
|
|
29
|
+
import asyncio
|
|
30
|
+
import contextlib
|
|
31
|
+
import time
|
|
32
|
+
import weakref
|
|
33
|
+
from collections.abc import AsyncIterable
|
|
34
|
+
from dataclasses import dataclass
|
|
35
|
+
from typing import Any, Literal, Unpack
|
|
36
|
+
|
|
37
|
+
from livekit import rtc
|
|
38
|
+
from livekit.agents import llm, utils
|
|
39
|
+
from livekit.agents.metrics import RealtimeModelMetrics
|
|
40
|
+
from livekit.agents.types import NOT_GIVEN, NotGivenOr
|
|
41
|
+
from livekit.agents.utils import is_given
|
|
42
|
+
|
|
43
|
+
import satham
|
|
44
|
+
from satham import _protocol as wire
|
|
45
|
+
from satham.controls import to_wire
|
|
46
|
+
|
|
47
|
+
from .log import logger
|
|
48
|
+
|
|
49
|
+
INPUT_SAMPLE_RATE = 16_000
|
|
50
|
+
"""Caller audio goes to Satham as 16 kHz mono 16-bit PCM."""
|
|
51
|
+
CONFIGURE_WAIT_S = 0.5
|
|
52
|
+
"""How long a session waits for instructions and tools before starting the call anyway."""
|
|
53
|
+
REPLY_TIMEOUT_S = 10.0
|
|
54
|
+
"""How long ``generate_reply`` and ``say`` wait for the reply to start."""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _tool_choice(choice: llm.ToolChoice | None) -> str | dict[str, Any] | None:
|
|
58
|
+
if choice is None or isinstance(choice, str):
|
|
59
|
+
return choice
|
|
60
|
+
return {"type": "function", "function": {"name": choice["function"]["name"]}}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _function_schemas(tools: list[llm.Tool]) -> list[dict[str, Any]]:
|
|
64
|
+
"""LiveKit tools as OpenAI function definitions (provider tools are skipped)."""
|
|
65
|
+
out: list[dict[str, Any]] = []
|
|
66
|
+
for tool in tools:
|
|
67
|
+
if isinstance(tool, llm.FunctionTool):
|
|
68
|
+
out.append(llm.utils.build_legacy_openai_schema(tool, internally_tagged=False))
|
|
69
|
+
elif isinstance(tool, llm.RawFunctionTool):
|
|
70
|
+
raw = dict(tool.info.raw_schema)
|
|
71
|
+
raw.pop("meta", None)
|
|
72
|
+
out.append({"type": "function", "function": raw})
|
|
73
|
+
else:
|
|
74
|
+
logger.warning("Satham takes function tools only; skipping %r", tool)
|
|
75
|
+
return out
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _disabled(controls: dict[str, Any], key: str) -> bool:
|
|
79
|
+
"""Whether a control group is set to off (``None``, or ``enabled: False``)."""
|
|
80
|
+
if key not in controls:
|
|
81
|
+
return False
|
|
82
|
+
value = controls[key]
|
|
83
|
+
if value is None:
|
|
84
|
+
return True
|
|
85
|
+
if hasattr(value, "model_dump"):
|
|
86
|
+
value = value.model_dump(exclude_none=True)
|
|
87
|
+
return isinstance(value, dict) and value.get("enabled") is False
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class RealtimeModel(llm.RealtimeModel):
|
|
91
|
+
"""Satham (satham-1) for ``AgentSession(llm=...)``.
|
|
92
|
+
|
|
93
|
+
The LiveKit agent's ``instructions`` become the call's instructions, and its tools the call's
|
|
94
|
+
tools; nothing else is needed. ``url`` and ``api_key`` name your Satham endpoint and key (or
|
|
95
|
+
``$SATHAM_URL`` and ``$SATHAM_API_KEY``); ``connect_timeout`` is in seconds.
|
|
96
|
+
|
|
97
|
+
Every other keyword is a control (``satham.Controls``), sent only when set:
|
|
98
|
+
|
|
99
|
+
- OpenAI's names: ``model`` (default ``"satham-1"``), ``voice``, ``modalities``,
|
|
100
|
+
``turn_detection`` (``None`` for LiveKit's own turn detection), ``temperature``,
|
|
101
|
+
``input_audio_noise_reduction``, ``input_audio_transcription``,
|
|
102
|
+
``max_response_output_tokens``, ``speed``, ``tool_choice``;
|
|
103
|
+
- Satham's own: ``greeting``, ``language``, ``language_switch``, ``voice_on_language_switch``,
|
|
104
|
+
``breaths``, ``natural_pauses``, ``continuation``, ``phrasing``, ``normalise_numbers``,
|
|
105
|
+
``pronunciations``, ``top_p``, ``tone``, ``repeat_guard``, ``drift_guard``, and ``agent``
|
|
106
|
+
(optional: a preset agent on the server).
|
|
107
|
+
|
|
108
|
+
``modalities``, ``turn_detection`` and ``input_audio_transcription`` also decide what the
|
|
109
|
+
model tells LiveKit it does, so they are fixed for a model once made.
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
def __init__(
|
|
113
|
+
self,
|
|
114
|
+
*,
|
|
115
|
+
url: str | None = None,
|
|
116
|
+
api_key: str | None = None,
|
|
117
|
+
connect_timeout: float = 10.0,
|
|
118
|
+
tool_choice: llm.ToolChoice | None = None,
|
|
119
|
+
**controls: Unpack[satham.Controls],
|
|
120
|
+
) -> None:
|
|
121
|
+
self._controls: dict[str, Any] = dict(controls)
|
|
122
|
+
modalities = list(self._controls.get("modalities") or ["text", "audio"])
|
|
123
|
+
super().__init__(
|
|
124
|
+
capabilities=llm.RealtimeCapabilities(
|
|
125
|
+
message_truncation=False,
|
|
126
|
+
turn_detection=not _disabled(self._controls, "turn_detection"),
|
|
127
|
+
user_transcription=not _disabled(self._controls, "input_audio_transcription"),
|
|
128
|
+
auto_tool_reply_generation=True,
|
|
129
|
+
audio_output="audio" in modalities,
|
|
130
|
+
manual_function_calls=False,
|
|
131
|
+
mutable_chat_context=False,
|
|
132
|
+
mutable_instructions=True,
|
|
133
|
+
mutable_tools=True,
|
|
134
|
+
per_response_tool_choice=False,
|
|
135
|
+
supports_say=True,
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
self._tool_choice = tool_choice
|
|
139
|
+
# Fail now, not when the first call starts: the client checks URL, key and controls.
|
|
140
|
+
self._client = satham.Client(url, api_key, open_timeout=connect_timeout)
|
|
141
|
+
to_wire(self._controls, where="session.start", limits=self._client.limits)
|
|
142
|
+
self._limits_loaded = False
|
|
143
|
+
self._limits_lock = asyncio.Lock()
|
|
144
|
+
self._sessions = weakref.WeakSet[RealtimeSession]()
|
|
145
|
+
|
|
146
|
+
async def _load_limits(self) -> None:
|
|
147
|
+
"""Take the server's control ranges (``GET /v1/info``) once; keep the built-in ones else."""
|
|
148
|
+
async with self._limits_lock:
|
|
149
|
+
if self._limits_loaded:
|
|
150
|
+
return
|
|
151
|
+
self._limits_loaded = True
|
|
152
|
+
try:
|
|
153
|
+
await self._client.load_controls()
|
|
154
|
+
except satham.SathamError as e:
|
|
155
|
+
logger.debug("no control ranges from the server (%s); using the built-in ones", e)
|
|
156
|
+
|
|
157
|
+
@property
|
|
158
|
+
def model(self) -> str:
|
|
159
|
+
return str(self._controls.get("model") or "satham-1")
|
|
160
|
+
|
|
161
|
+
@property
|
|
162
|
+
def provider(self) -> str:
|
|
163
|
+
return "satham"
|
|
164
|
+
|
|
165
|
+
def session(self, *, turn_detection_disabled: bool = False) -> RealtimeSession:
|
|
166
|
+
if turn_detection_disabled:
|
|
167
|
+
logger.warning("pass turn_detection=None to the model for manual turns")
|
|
168
|
+
session = RealtimeSession(self)
|
|
169
|
+
self._sessions.add(session)
|
|
170
|
+
return session
|
|
171
|
+
|
|
172
|
+
def update_options(
|
|
173
|
+
self,
|
|
174
|
+
*,
|
|
175
|
+
tool_choice: NotGivenOr[llm.ToolChoice | None] = NOT_GIVEN,
|
|
176
|
+
**changes: Unpack[satham.Controls],
|
|
177
|
+
) -> None:
|
|
178
|
+
"""Change controls for new calls and every live one (``session.update``)."""
|
|
179
|
+
to_wire(dict(changes), where="session.update", limits=self._client.limits)
|
|
180
|
+
self._controls.update(changes)
|
|
181
|
+
if is_given(tool_choice):
|
|
182
|
+
self._tool_choice = tool_choice
|
|
183
|
+
for session in self._sessions:
|
|
184
|
+
session.update_options(tool_choice=tool_choice, **changes)
|
|
185
|
+
|
|
186
|
+
async def aclose(self) -> None:
|
|
187
|
+
for session in list(self._sessions):
|
|
188
|
+
await session.aclose()
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
@dataclass
|
|
192
|
+
class _Generation:
|
|
193
|
+
response_id: str
|
|
194
|
+
message_ch: utils.aio.Chan[llm.MessageGeneration]
|
|
195
|
+
function_ch: utils.aio.Chan[llm.FunctionCall]
|
|
196
|
+
text_ch: utils.aio.Chan[str]
|
|
197
|
+
audio_ch: utils.aio.Chan[rtc.AudioFrame]
|
|
198
|
+
started_at: float
|
|
199
|
+
text: str = ""
|
|
200
|
+
first_audio_at: float | None = None
|
|
201
|
+
|
|
202
|
+
def close(self) -> None:
|
|
203
|
+
for ch in (self.text_ch, self.audio_ch, self.function_ch, self.message_ch):
|
|
204
|
+
if not ch.closed:
|
|
205
|
+
ch.close()
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class RealtimeSession(
|
|
209
|
+
llm.RealtimeSession[Literal["session_updated", "satham_server_event_received"]]
|
|
210
|
+
):
|
|
211
|
+
"""One Satham call inside a LiveKit ``AgentSession``.
|
|
212
|
+
|
|
213
|
+
Besides the standard realtime events it emits ``session_updated`` (a ``satham.SessionUpdated``,
|
|
214
|
+
when the call's language changes) and ``satham_server_event_received`` (every server event).
|
|
215
|
+
"""
|
|
216
|
+
|
|
217
|
+
def __init__(self, realtime_model: RealtimeModel) -> None:
|
|
218
|
+
super().__init__(realtime_model)
|
|
219
|
+
self._model = realtime_model
|
|
220
|
+
self._controls: dict[str, Any] = dict(realtime_model._controls)
|
|
221
|
+
self._tool_choice = realtime_model._tool_choice
|
|
222
|
+
self._text_only = not realtime_model.capabilities.audio_output
|
|
223
|
+
self._manual_turns = not realtime_model.capabilities.turn_detection
|
|
224
|
+
self._pending_reply: asyncio.Future[llm.GenerationCreatedEvent] | None = None
|
|
225
|
+
self._tasks: set[asyncio.Task[None]] = set()
|
|
226
|
+
self._instructions: str | None = None
|
|
227
|
+
self._tools = llm.ToolContext.empty()
|
|
228
|
+
self._chat_ctx = llm.ChatContext.empty()
|
|
229
|
+
self._call: satham.Session | None = None
|
|
230
|
+
self._configured = asyncio.Event()
|
|
231
|
+
self._closing = False
|
|
232
|
+
self._send_ch = utils.aio.Chan[bytes | dict[str, Any]]()
|
|
233
|
+
self._resampler: rtc.AudioResampler | None = None
|
|
234
|
+
self._bstream = utils.audio.AudioByteStream(
|
|
235
|
+
INPUT_SAMPLE_RATE, 1, samples_per_channel=INPUT_SAMPLE_RATE // 50
|
|
236
|
+
)
|
|
237
|
+
self._generation: _Generation | None = None
|
|
238
|
+
self._open_calls: set[str] = set()
|
|
239
|
+
self._barged_in = False
|
|
240
|
+
language = self._controls.get("language")
|
|
241
|
+
self.language: str | None = None if language in (None, "auto") else str(language)
|
|
242
|
+
"""The call's language, following ``session.updated``."""
|
|
243
|
+
loop = asyncio.get_running_loop()
|
|
244
|
+
self._configure_timer = loop.call_later(CONFIGURE_WAIT_S, self._configured.set)
|
|
245
|
+
self._main_atask = asyncio.create_task(self._main(), name="satham.RealtimeSession")
|
|
246
|
+
|
|
247
|
+
# -- the call ----------------------------------------------------------------------------
|
|
248
|
+
|
|
249
|
+
@property
|
|
250
|
+
def call(self) -> satham.Session | None:
|
|
251
|
+
"""The underlying ``satham.Session``, once the call has started."""
|
|
252
|
+
return self._call
|
|
253
|
+
|
|
254
|
+
def _start_settings(self) -> dict[str, Any]:
|
|
255
|
+
instructions = self._instructions or None # the LiveKit agent's; "" sends none
|
|
256
|
+
if instructions is None and "agent" not in self._controls:
|
|
257
|
+
logger.warning("the LiveKit agent has no instructions: the call starts without a role")
|
|
258
|
+
tools = _function_schemas(self._tools.flatten())
|
|
259
|
+
return {
|
|
260
|
+
**self._controls,
|
|
261
|
+
"instructions": instructions,
|
|
262
|
+
"tools": tools or None,
|
|
263
|
+
"tool_choice": _tool_choice(self._tool_choice) if tools else None,
|
|
264
|
+
"sample_rate": INPUT_SAMPLE_RATE,
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
async def _main(self) -> None:
|
|
268
|
+
try:
|
|
269
|
+
await self._configured.wait()
|
|
270
|
+
await self._model._load_limits()
|
|
271
|
+
if self._closing:
|
|
272
|
+
return
|
|
273
|
+
started = time.perf_counter()
|
|
274
|
+
self._call = await self._model._client.connect(**self._start_settings())
|
|
275
|
+
self._report_connection_acquired(time.perf_counter() - started)
|
|
276
|
+
if self._call.language:
|
|
277
|
+
self.language = self._call.language
|
|
278
|
+
sender = asyncio.create_task(self._send_loop(self._call), name="satham.send")
|
|
279
|
+
try:
|
|
280
|
+
async for event in self._call:
|
|
281
|
+
self._on_event(event)
|
|
282
|
+
finally:
|
|
283
|
+
await utils.aio.cancel_and_wait(sender)
|
|
284
|
+
if not self._closing:
|
|
285
|
+
reason = self._call.end_reason or f"closed ({self._call.close_code})"
|
|
286
|
+
self._emit_error(satham.SathamError(f"the Satham call ended: {reason}"), False)
|
|
287
|
+
except satham.SathamError as e:
|
|
288
|
+
if not self._closing:
|
|
289
|
+
self._emit_error(e, recoverable=False)
|
|
290
|
+
except Exception as e:
|
|
291
|
+
logger.exception("Satham session failed")
|
|
292
|
+
self._emit_error(e, recoverable=False)
|
|
293
|
+
finally:
|
|
294
|
+
self._close_generation()
|
|
295
|
+
if not self._send_ch.closed:
|
|
296
|
+
self._send_ch.close() # the call is over: stop queueing audio for it
|
|
297
|
+
|
|
298
|
+
async def _send_loop(self, call: satham.Session) -> None:
|
|
299
|
+
with contextlib.suppress(satham.SessionClosedError):
|
|
300
|
+
async for item in self._send_ch:
|
|
301
|
+
if isinstance(item, bytes):
|
|
302
|
+
await call.send_audio(item)
|
|
303
|
+
else:
|
|
304
|
+
await call.send(item)
|
|
305
|
+
|
|
306
|
+
def _send(self, item: bytes | dict[str, Any]) -> None:
|
|
307
|
+
with contextlib.suppress(utils.aio.channel.ChanClosed):
|
|
308
|
+
self._send_ch.send_nowait(item)
|
|
309
|
+
|
|
310
|
+
def _emit_error(self, error: Exception, recoverable: bool) -> None:
|
|
311
|
+
self.emit(
|
|
312
|
+
"error",
|
|
313
|
+
llm.RealtimeModelError(
|
|
314
|
+
timestamp=time.time(),
|
|
315
|
+
label=self._model.label,
|
|
316
|
+
error=error,
|
|
317
|
+
recoverable=recoverable,
|
|
318
|
+
),
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
# -- server events -----------------------------------------------------------------------
|
|
322
|
+
|
|
323
|
+
def _on_event(self, event: satham.Event) -> None:
|
|
324
|
+
self.emit("satham_server_event_received", event)
|
|
325
|
+
if isinstance(event, satham.ResponseAudio):
|
|
326
|
+
self._on_audio(event)
|
|
327
|
+
elif isinstance(event, satham.ResponseTextDelta):
|
|
328
|
+
gen = self._generation
|
|
329
|
+
if gen is not None and gen.response_id == event.response_id:
|
|
330
|
+
gen.text += event.text
|
|
331
|
+
with contextlib.suppress(utils.aio.channel.ChanClosed):
|
|
332
|
+
gen.text_ch.send_nowait(event.text)
|
|
333
|
+
elif isinstance(event, satham.SpeechStarted):
|
|
334
|
+
if self._barged_in: # already told, when the reply was cut off
|
|
335
|
+
self._barged_in = False
|
|
336
|
+
else:
|
|
337
|
+
self.emit("input_speech_started", llm.InputSpeechStartedEvent())
|
|
338
|
+
elif isinstance(event, satham.SpeechStopped):
|
|
339
|
+
self.emit(
|
|
340
|
+
"input_speech_stopped",
|
|
341
|
+
llm.InputSpeechStoppedEvent(user_transcription_enabled=True),
|
|
342
|
+
)
|
|
343
|
+
elif isinstance(event, satham.TranscriptPartial | satham.TranscriptFinal):
|
|
344
|
+
final = isinstance(event, satham.TranscriptFinal)
|
|
345
|
+
if final and event.text:
|
|
346
|
+
self._remember(llm.ChatMessage(id=event.turn_id, role="user", content=[event.text]))
|
|
347
|
+
self.emit(
|
|
348
|
+
"input_audio_transcription_completed",
|
|
349
|
+
llm.InputTranscriptionCompleted(
|
|
350
|
+
item_id=event.turn_id, transcript=event.text, is_final=final
|
|
351
|
+
),
|
|
352
|
+
)
|
|
353
|
+
elif isinstance(event, satham.ResponseStarted):
|
|
354
|
+
self._start_generation(event.response_id)
|
|
355
|
+
elif isinstance(event, satham.ResponseDone | satham.ResponseInterrupted):
|
|
356
|
+
if isinstance(event, satham.ResponseInterrupted) and event.reason == "barge_in":
|
|
357
|
+
# The server stops a reply because the caller is speaking, then says so with
|
|
358
|
+
# input.speech_started. Tell LiveKit first, while the reply is still open, so
|
|
359
|
+
# it cuts the playout instead of letting the buffered audio run on.
|
|
360
|
+
self._barged_in = True
|
|
361
|
+
self.emit("input_speech_started", llm.InputSpeechStartedEvent())
|
|
362
|
+
self._finish_generation(event)
|
|
363
|
+
elif isinstance(event, satham.ToolCall):
|
|
364
|
+
self._on_tool_call(event)
|
|
365
|
+
elif isinstance(event, satham.SessionUpdated):
|
|
366
|
+
if event.language:
|
|
367
|
+
self.language = event.language
|
|
368
|
+
self.emit("session_updated", event)
|
|
369
|
+
elif isinstance(event, satham.Error) and event.code == "response_in_progress":
|
|
370
|
+
pending = self._pending_reply
|
|
371
|
+
# With manual turns the server may already be answering the committed turn: that
|
|
372
|
+
# reply is the one LiveKit asked for. Otherwise nothing will start: say so.
|
|
373
|
+
if pending is not None and not pending.done() and not self._manual_turns:
|
|
374
|
+
self._pending_reply = None
|
|
375
|
+
pending.set_exception(llm.RealtimeError(event.message, code=event.code))
|
|
376
|
+
elif isinstance(event, satham.Error):
|
|
377
|
+
logger.warning("Satham error %s: %s", event.code, event.message)
|
|
378
|
+
self._emit_error(
|
|
379
|
+
satham.SathamError(event.message, code=event.code), recoverable=not event.fatal
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
def _remember(self, item: llm.ChatItem) -> None:
|
|
383
|
+
items = self._chat_ctx.items
|
|
384
|
+
for i, existing in enumerate(items):
|
|
385
|
+
if existing.id == item.id:
|
|
386
|
+
items[i] = item
|
|
387
|
+
return
|
|
388
|
+
items.append(item)
|
|
389
|
+
|
|
390
|
+
def _start_generation(self, response_id: str) -> None:
|
|
391
|
+
self._close_generation()
|
|
392
|
+
gen = _Generation(
|
|
393
|
+
response_id=response_id,
|
|
394
|
+
message_ch=utils.aio.Chan(),
|
|
395
|
+
function_ch=utils.aio.Chan(),
|
|
396
|
+
text_ch=utils.aio.Chan(),
|
|
397
|
+
audio_ch=utils.aio.Chan(),
|
|
398
|
+
started_at=time.time(),
|
|
399
|
+
)
|
|
400
|
+
modalities: asyncio.Future[list[Literal["text", "audio"]]] = asyncio.Future()
|
|
401
|
+
if self._text_only:
|
|
402
|
+
gen.audio_ch.close() # the words go to the session's TTS, as in OpenAI's text mode
|
|
403
|
+
modalities.set_result(["text"])
|
|
404
|
+
else:
|
|
405
|
+
modalities.set_result(["audio", "text"])
|
|
406
|
+
gen.message_ch.send_nowait(
|
|
407
|
+
llm.MessageGeneration(
|
|
408
|
+
message_id=response_id,
|
|
409
|
+
text_stream=gen.text_ch,
|
|
410
|
+
audio_stream=gen.audio_ch,
|
|
411
|
+
modalities=modalities,
|
|
412
|
+
)
|
|
413
|
+
)
|
|
414
|
+
self._generation = gen
|
|
415
|
+
event = llm.GenerationCreatedEvent(
|
|
416
|
+
message_stream=gen.message_ch,
|
|
417
|
+
function_stream=gen.function_ch,
|
|
418
|
+
user_initiated=False,
|
|
419
|
+
response_id=response_id,
|
|
420
|
+
)
|
|
421
|
+
pending, self._pending_reply = self._pending_reply, None
|
|
422
|
+
if pending is not None and not pending.done():
|
|
423
|
+
event.user_initiated = True # the reply LiveKit asked for after ending the turn
|
|
424
|
+
pending.set_result(event)
|
|
425
|
+
self.emit("generation_created", event)
|
|
426
|
+
|
|
427
|
+
def _on_audio(self, event: satham.ResponseAudio) -> None:
|
|
428
|
+
gen = self._generation
|
|
429
|
+
if self._text_only or gen is None or gen.response_id != event.response_id or not event.data:
|
|
430
|
+
return
|
|
431
|
+
if gen.first_audio_at is None:
|
|
432
|
+
gen.first_audio_at = time.time()
|
|
433
|
+
fmt = event.format
|
|
434
|
+
frame = rtc.AudioFrame(
|
|
435
|
+
data=event.data,
|
|
436
|
+
sample_rate=fmt.sample_rate,
|
|
437
|
+
num_channels=fmt.channels,
|
|
438
|
+
samples_per_channel=len(event.data) // (2 * fmt.channels),
|
|
439
|
+
)
|
|
440
|
+
with contextlib.suppress(utils.aio.channel.ChanClosed):
|
|
441
|
+
gen.audio_ch.send_nowait(frame)
|
|
442
|
+
|
|
443
|
+
def _finish_generation(self, event: satham.ResponseDone | satham.ResponseInterrupted) -> None:
|
|
444
|
+
gen = self._generation
|
|
445
|
+
if gen is None or gen.response_id != event.response_id:
|
|
446
|
+
return
|
|
447
|
+
interrupted = isinstance(event, satham.ResponseInterrupted)
|
|
448
|
+
text = gen.text if interrupted else (event.text or gen.text) # type: ignore[union-attr]
|
|
449
|
+
if text:
|
|
450
|
+
self._remember(
|
|
451
|
+
llm.ChatMessage(
|
|
452
|
+
id=gen.response_id, role="assistant", content=[text], interrupted=interrupted
|
|
453
|
+
)
|
|
454
|
+
)
|
|
455
|
+
now = time.time()
|
|
456
|
+
self.emit(
|
|
457
|
+
"metrics_collected",
|
|
458
|
+
RealtimeModelMetrics(
|
|
459
|
+
label=self._model.label,
|
|
460
|
+
request_id=gen.response_id,
|
|
461
|
+
timestamp=gen.started_at,
|
|
462
|
+
duration=now - gen.started_at,
|
|
463
|
+
ttft=(gen.first_audio_at - gen.started_at) if gen.first_audio_at else -1,
|
|
464
|
+
cancelled=interrupted,
|
|
465
|
+
input_token_details=RealtimeModelMetrics.InputTokenDetails(),
|
|
466
|
+
output_token_details=RealtimeModelMetrics.OutputTokenDetails(),
|
|
467
|
+
),
|
|
468
|
+
)
|
|
469
|
+
self._close_generation()
|
|
470
|
+
|
|
471
|
+
def _close_generation(self) -> None:
|
|
472
|
+
if self._generation is not None:
|
|
473
|
+
self._generation.close()
|
|
474
|
+
self._generation = None
|
|
475
|
+
|
|
476
|
+
def _on_tool_call(self, event: satham.ToolCall) -> None:
|
|
477
|
+
call = llm.FunctionCall(
|
|
478
|
+
id=event.call_id, call_id=event.call_id, name=event.name, arguments=event.arguments
|
|
479
|
+
)
|
|
480
|
+
self._open_calls.add(event.call_id)
|
|
481
|
+
self._remember(call)
|
|
482
|
+
gen = self._generation
|
|
483
|
+
if gen is None or (event.response_id and gen.response_id != event.response_id):
|
|
484
|
+
logger.warning("tool call %s outside its reply; answering it as failed", event.name)
|
|
485
|
+
self._send(wire.tool_result(event.call_id, "error: the call came outside a reply"))
|
|
486
|
+
self._open_calls.discard(event.call_id)
|
|
487
|
+
return
|
|
488
|
+
with contextlib.suppress(utils.aio.channel.ChanClosed):
|
|
489
|
+
gen.function_ch.send_nowait(call)
|
|
490
|
+
|
|
491
|
+
# -- llm.RealtimeSession -----------------------------------------------------------------
|
|
492
|
+
|
|
493
|
+
@property
|
|
494
|
+
def chat_ctx(self) -> llm.ChatContext:
|
|
495
|
+
return self._chat_ctx.copy()
|
|
496
|
+
|
|
497
|
+
@property
|
|
498
|
+
def tools(self) -> llm.ToolContext:
|
|
499
|
+
return llm.ToolContext(self._tools.flatten())
|
|
500
|
+
|
|
501
|
+
async def update_instructions(self, instructions: str) -> None:
|
|
502
|
+
"""The call's instructions: at the start, or mid-call (``session.update``)."""
|
|
503
|
+
if self._call is None:
|
|
504
|
+
self._instructions = instructions
|
|
505
|
+
return
|
|
506
|
+
if instructions != (self._instructions or "") and instructions:
|
|
507
|
+
self._instructions = instructions
|
|
508
|
+
self._send(
|
|
509
|
+
wire.session_update(to_wire({"instructions": instructions}, where="session.update"))
|
|
510
|
+
or {}
|
|
511
|
+
)
|
|
512
|
+
|
|
513
|
+
async def update_chat_ctx(self, chat_ctx: llm.ChatContext) -> None:
|
|
514
|
+
# Satham keeps the conversation itself; what LiveKit adds that the server needs are the
|
|
515
|
+
# results of the tool calls it ran.
|
|
516
|
+
for item in chat_ctx.items:
|
|
517
|
+
if item.type == "function_call_output" and item.call_id in self._open_calls:
|
|
518
|
+
self._open_calls.discard(item.call_id)
|
|
519
|
+
self._remember(item)
|
|
520
|
+
self._send(wire.tool_result(item.call_id, item.output, respond=item.reply_required))
|
|
521
|
+
|
|
522
|
+
async def update_tools(self, tools: list[llm.Tool]) -> None:
|
|
523
|
+
if self._call is None:
|
|
524
|
+
self._tools = llm.ToolContext(tools)
|
|
525
|
+
self._configure_timer.cancel()
|
|
526
|
+
self._configured.set() # LiveKit sets instructions, history, then tools
|
|
527
|
+
return
|
|
528
|
+
schemas = _function_schemas(tools)
|
|
529
|
+
if schemas != _function_schemas(self._tools.flatten()):
|
|
530
|
+
self._tools = llm.ToolContext(tools)
|
|
531
|
+
message = wire.session_update({}, tools=schemas) # the whole list, replacing the last
|
|
532
|
+
if message is not None:
|
|
533
|
+
self._send(message)
|
|
534
|
+
|
|
535
|
+
def update_options(
|
|
536
|
+
self,
|
|
537
|
+
*,
|
|
538
|
+
tool_choice: NotGivenOr[llm.ToolChoice | None] = NOT_GIVEN,
|
|
539
|
+
**changes: Unpack[satham.Controls],
|
|
540
|
+
) -> None:
|
|
541
|
+
"""Change the call's controls (``session.update``); before it starts, its start."""
|
|
542
|
+
if is_given(tool_choice):
|
|
543
|
+
self._tool_choice = tool_choice
|
|
544
|
+
if self._call is not None:
|
|
545
|
+
self._send({"type": wire.SESSION_UPDATE, "tool_choice": _tool_choice(tool_choice)})
|
|
546
|
+
if not changes:
|
|
547
|
+
return
|
|
548
|
+
if self._call is None:
|
|
549
|
+
self._controls.update(changes)
|
|
550
|
+
return
|
|
551
|
+
fields = to_wire(dict(changes), where="session.update", limits=self._model._client.limits)
|
|
552
|
+
message = wire.session_update(fields)
|
|
553
|
+
if message is not None:
|
|
554
|
+
self._send(message)
|
|
555
|
+
|
|
556
|
+
def push_audio(self, frame: rtc.AudioFrame) -> None:
|
|
557
|
+
if self._closing:
|
|
558
|
+
return
|
|
559
|
+
for resampled in self._resample(frame):
|
|
560
|
+
for chunk in self._bstream.write(resampled.data.tobytes()):
|
|
561
|
+
self._send(chunk.data.tobytes())
|
|
562
|
+
|
|
563
|
+
def _resample(self, frame: rtc.AudioFrame) -> list[rtc.AudioFrame]:
|
|
564
|
+
if self._resampler is not None and frame.sample_rate != self._resampler._input_rate:
|
|
565
|
+
self._resampler = None
|
|
566
|
+
if self._resampler is None and (
|
|
567
|
+
frame.sample_rate != INPUT_SAMPLE_RATE or frame.num_channels != 1
|
|
568
|
+
):
|
|
569
|
+
self._resampler = rtc.AudioResampler(
|
|
570
|
+
input_rate=frame.sample_rate, output_rate=INPUT_SAMPLE_RATE, num_channels=1
|
|
571
|
+
)
|
|
572
|
+
return self._resampler.push(frame) if self._resampler else [frame]
|
|
573
|
+
|
|
574
|
+
def push_video(self, frame: rtc.VideoFrame) -> None:
|
|
575
|
+
pass # Satham is audio only
|
|
576
|
+
|
|
577
|
+
def generate_reply(
|
|
578
|
+
self,
|
|
579
|
+
*,
|
|
580
|
+
instructions: NotGivenOr[str] = NOT_GIVEN,
|
|
581
|
+
tool_choice: NotGivenOr[llm.ToolChoice] = NOT_GIVEN,
|
|
582
|
+
tools: NotGivenOr[list[llm.Tool]] = NOT_GIVEN,
|
|
583
|
+
) -> asyncio.Future[llm.GenerationCreatedEvent]:
|
|
584
|
+
"""A reply now (``response.create``); ``instructions`` guide this reply alone."""
|
|
585
|
+
return self._request(
|
|
586
|
+
wire.response_create(instructions if is_given(instructions) and instructions else None)
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
def say(self, text: str | AsyncIterable[str]) -> asyncio.Future[llm.GenerationCreatedEvent]:
|
|
590
|
+
"""Speak ``text`` as it is, in the call's voice (``response.say``), with no TTS."""
|
|
591
|
+
if isinstance(text, str):
|
|
592
|
+
return self._request(wire.response_say(text))
|
|
593
|
+
future: asyncio.Future[llm.GenerationCreatedEvent] = asyncio.Future()
|
|
594
|
+
|
|
595
|
+
async def collect() -> None:
|
|
596
|
+
try:
|
|
597
|
+
words = "".join([part async for part in text])
|
|
598
|
+
result = await self._request(wire.response_say(words))
|
|
599
|
+
except Exception as e:
|
|
600
|
+
if not future.done():
|
|
601
|
+
future.set_exception(e)
|
|
602
|
+
else:
|
|
603
|
+
if not future.done():
|
|
604
|
+
future.set_result(result)
|
|
605
|
+
|
|
606
|
+
task = asyncio.create_task(collect())
|
|
607
|
+
self._tasks.add(task)
|
|
608
|
+
task.add_done_callback(self._tasks.discard)
|
|
609
|
+
return future
|
|
610
|
+
|
|
611
|
+
def _request(self, message: dict[str, Any]) -> asyncio.Future[llm.GenerationCreatedEvent]:
|
|
612
|
+
"""Send a reply request; the future is the generation the server starts for it."""
|
|
613
|
+
future: asyncio.Future[llm.GenerationCreatedEvent] = asyncio.Future()
|
|
614
|
+
if self._pending_reply is not None and not self._pending_reply.done():
|
|
615
|
+
self._pending_reply.cancel()
|
|
616
|
+
self._pending_reply = future
|
|
617
|
+
self._send(message)
|
|
618
|
+
|
|
619
|
+
def expire() -> None:
|
|
620
|
+
if not future.done():
|
|
621
|
+
future.set_exception(llm.RealtimeError("the server started no reply in time"))
|
|
622
|
+
|
|
623
|
+
handle = asyncio.get_running_loop().call_later(REPLY_TIMEOUT_S, expire)
|
|
624
|
+
future.add_done_callback(lambda _: handle.cancel())
|
|
625
|
+
return future
|
|
626
|
+
|
|
627
|
+
def commit_audio(self) -> None:
|
|
628
|
+
for chunk in self._bstream.flush():
|
|
629
|
+
self._send(chunk.data.tobytes())
|
|
630
|
+
self._send({"type": wire.INPUT_COMMIT})
|
|
631
|
+
|
|
632
|
+
def clear_audio(self) -> None:
|
|
633
|
+
self._bstream.clear()
|
|
634
|
+
|
|
635
|
+
def interrupt(self) -> None:
|
|
636
|
+
if self._generation is not None:
|
|
637
|
+
self._send({"type": wire.RESPONSE_CANCEL})
|
|
638
|
+
|
|
639
|
+
def truncate(
|
|
640
|
+
self,
|
|
641
|
+
*,
|
|
642
|
+
message_id: str,
|
|
643
|
+
modalities: list[Literal["text", "audio"]],
|
|
644
|
+
audio_end_ms: int,
|
|
645
|
+
audio_transcript: NotGivenOr[str] = NOT_GIVEN,
|
|
646
|
+
) -> None:
|
|
647
|
+
pass # the server marks a reply cut off by barge-in itself
|
|
648
|
+
|
|
649
|
+
async def aclose(self) -> None:
|
|
650
|
+
if self._closing:
|
|
651
|
+
return
|
|
652
|
+
self._closing = True
|
|
653
|
+
self._configure_timer.cancel()
|
|
654
|
+
self._configured.set()
|
|
655
|
+
self._close_generation()
|
|
656
|
+
self._send_ch.close()
|
|
657
|
+
if self._call is not None:
|
|
658
|
+
await self._call.close()
|
|
659
|
+
await utils.aio.cancel_and_wait(self._main_atask)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.1"
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: livekit-plugins-satham
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Satham realtime speech-to-speech for LiveKit Agents
|
|
5
|
+
Project-URL: Homepage, https://satham.ai
|
|
6
|
+
Author: Satham
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: livekit,livekit-agents,plugin,realtime,satham,speech-to-speech,voice-agent
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Framework :: AsyncIO
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: livekit-agents~=1.8.12
|
|
24
|
+
Requires-Dist: satham~=0.1.1
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# livekit-plugins-satham
|
|
28
|
+
|
|
29
|
+
Satham's realtime speech-to-speech model (satham-1) as a `RealtimeModel` for LiveKit Agents. Your
|
|
30
|
+
LiveKit agent keeps its own instructions and tools; Satham hears the caller, ends turns, replies in
|
|
31
|
+
speech and handles barge-in, so the `AgentSession` needs no STT, LLM, TTS or VAD. The parameters
|
|
32
|
+
follow LiveKit's OpenAI `RealtimeModel`, so moving an agent from OpenAI to Satham is mostly a one-line
|
|
33
|
+
change.
|
|
34
|
+
|
|
35
|
+
LiveKit Agents 1.8; Python 3.11+.
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
pip install livekit-plugins-satham
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Use
|
|
42
|
+
|
|
43
|
+
You pass your Satham endpoint and API key (or set `SATHAM_URL` and `SATHAM_API_KEY`); there is no
|
|
44
|
+
default server.
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import os
|
|
48
|
+
|
|
49
|
+
from livekit.agents import (
|
|
50
|
+
Agent,
|
|
51
|
+
AgentServer,
|
|
52
|
+
AgentSession,
|
|
53
|
+
JobContext,
|
|
54
|
+
RunContext,
|
|
55
|
+
cli,
|
|
56
|
+
function_tool,
|
|
57
|
+
llm,
|
|
58
|
+
)
|
|
59
|
+
from livekit.plugins import satham
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class SiteVisit(Agent):
|
|
63
|
+
def __init__(self) -> None:
|
|
64
|
+
# The agent's role and tools are Satham's instructions and tools, as they stand.
|
|
65
|
+
super().__init__(instructions="You are Asha, who books site visits for Example Homes.")
|
|
66
|
+
|
|
67
|
+
@function_tool
|
|
68
|
+
async def end_call(self, context: RunContext, reason: str = "done") -> llm.ToolResult:
|
|
69
|
+
"""End the call when the conversation is over. Say a short goodbye in the same turn."""
|
|
70
|
+
await context.wait_for_playout() # let the goodbye finish
|
|
71
|
+
... # hang up, e.g. delete the room
|
|
72
|
+
return llm.ToolResult("ended", reply_required=False)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
server = AgentServer()
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@server.rtc_session()
|
|
79
|
+
async def entrypoint(ctx: JobContext) -> None:
|
|
80
|
+
await ctx.connect()
|
|
81
|
+
session = AgentSession(
|
|
82
|
+
llm=satham.RealtimeModel( # was: openai.realtime.RealtimeModel(voice=...)
|
|
83
|
+
url=os.environ["SATHAM_URL"],
|
|
84
|
+
api_key=os.environ["SATHAM_API_KEY"],
|
|
85
|
+
greeting="Hello, this is Asha from Example Homes. Is this a good time?",
|
|
86
|
+
language="en",
|
|
87
|
+
language_switch="auto",
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
await session.start(agent=SiteVisit(), room=ctx.room)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if __name__ == "__main__":
|
|
94
|
+
cli.run_app(server)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- **Instructions and tools.** The LiveKit agent's `instructions` become the call's instructions and
|
|
98
|
+
its `@function_tool`s the call's tools, with nothing else to set. Both can change mid-call
|
|
99
|
+
(`agent.update_instructions()`, `agent.update_tools()`).
|
|
100
|
+
- **The opening and fixed words.** With `greeting`, the agent says it first. Otherwise
|
|
101
|
+
`session.generate_reply(instructions=...)` asks for a reply now (Satham's `response.create`; use it in
|
|
102
|
+
`on_enter` to open the call), and `session.say(text)` speaks fixed words in the call's voice
|
|
103
|
+
(`response.say`) with no TTS. With neither, the caller speaks first.
|
|
104
|
+
- **Mid-call changes.** `model.update_options(...)` changes any control on every live call;
|
|
105
|
+
`session.current_agent.realtime_llm_session.update_options(...)` changes one call.
|
|
106
|
+
- **Language changes** are emitted as `session_updated` (a `satham.SessionUpdated`: the language, and
|
|
107
|
+
the reason `caller`, `reply` or `client`).
|
|
108
|
+
|
|
109
|
+
## From OpenAI RealtimeModel to Satham
|
|
110
|
+
|
|
111
|
+
<!-- openai -->
|
|
112
|
+
| OpenAI `RealtimeModel` | Satham `RealtimeModel` | Supported | Notes |
|
|
113
|
+
| --- | --- | --- | --- |
|
|
114
|
+
| `model` | `model` | yes | default `"satham-1"` |
|
|
115
|
+
| `voice` | `voice` | yes | a Satham voice name, or a cloned voice's id |
|
|
116
|
+
| `modalities` | `modalities` | yes | `["audio", "text"]`, `["audio"]`, or `["text"]`, which hands the words to the session's TTS as OpenAI's text mode does |
|
|
117
|
+
| `temperature` | `temperature` | yes | |
|
|
118
|
+
| `turn_detection` | `turn_detection` | yes | `server_vad` and `semantic_vad` are both Satham's endpointing; `None`/`null` leaves turns to LiveKit; Satham adds `barge_in`, `continue_within_ms`, ... |
|
|
119
|
+
| `input_audio_noise_reduction` | `input_audio_noise_reduction` | yes | `near_field` or `far_field`; `"none"` turns it off, and null keeps the server's default (on); Satham adds `strength_db` and `apply_to_transcription` |
|
|
120
|
+
| `input_audio_transcription` | `input_audio_transcription` | partly | `enabled` and `code_mixed`; Satham transcribes with its own models, so OpenAI's `model` and `prompt` are ignored |
|
|
121
|
+
| `max_response_output_tokens` | `max_response_output_tokens` | yes | or `"inf"` |
|
|
122
|
+
| `speed` | `speed` | yes | |
|
|
123
|
+
| `tool_choice` | `tool_choice` | yes | preview: needs a server with tool support |
|
|
124
|
+
| `api_key` | `api_key` | yes | your Satham key |
|
|
125
|
+
| `base_url` | `url` | yes | your Satham endpoint |
|
|
126
|
+
| Agent instructions | Agent instructions | yes | can change mid-call |
|
|
127
|
+
| `generate_reply()` | `generate_reply()` | yes | `response.create`; `instructions` guide that reply alone |
|
|
128
|
+
| `session.say()` | `session.say()` | yes | `response.say`, no TTS needed (agents-js: call it on the realtime session) |
|
|
129
|
+
| tracing, truncation, reasoning | - | no | not applicable |
|
|
130
|
+
| azure_deployment, entra_token, api_version | - | no | not applicable |
|
|
131
|
+
| max_session_duration, conn_options | - | no | `connect_timeout` / `connectTimeoutMs` instead |
|
|
132
|
+
<!-- /openai -->
|
|
133
|
+
|
|
134
|
+
## Controls
|
|
135
|
+
|
|
136
|
+
Every keyword of `RealtimeModel(...)` and `update_options(...)` besides `url`, `api_key` and
|
|
137
|
+
`connect_timeout`. `modalities`, `turn_detection` and `input_audio_transcription` also decide what the
|
|
138
|
+
model tells LiveKit it does, so they are fixed for a model once made. Controls you leave out are not
|
|
139
|
+
sent; values are checked against these ranges, or the server's from `GET /v1/info`.
|
|
140
|
+
|
|
141
|
+
The controls marked "needs session controls" need a Satham server with session controls (its
|
|
142
|
+
`GET /v1/info` lists `controls`, as the server does since 2026-11-16); an older server refuses them
|
|
143
|
+
when the call starts. `greeting` and `agent` belong to the start of a call. Setting
|
|
144
|
+
`input_audio_noise_reduction`'s `mode` alone resets `strength_db` to that mode's preset, so send both
|
|
145
|
+
to keep a custom strength; `None` leaves noise reduction at the server's default (on), and `"none"`
|
|
146
|
+
turns it off. `agent` is an optional
|
|
147
|
+
preset on the server and is not needed.
|
|
148
|
+
|
|
149
|
+
<!-- controls -->
|
|
150
|
+
| Option | Range | Default | OpenAI equivalent | Notes |
|
|
151
|
+
| --- | --- | --- | --- | --- |
|
|
152
|
+
| `instructions` | text, up to 16000 characters | none | - | the agent's role; from the LiveKit agent or Pipecat context in the adapters |
|
|
153
|
+
| `greeting` | text, up to 1000 characters | none | - | said first; without one the caller speaks first |
|
|
154
|
+
| `tools` | up to 128 functions | none | - | preview: needs a server with tool support |
|
|
155
|
+
| `tool_choice` | see notes | "auto" | `tool_choice` | "auto", "none", "required" or one function |
|
|
156
|
+
| `agent` | text, up to 64 characters | none | - | optional: a preset agent on the server, such as a demo's |
|
|
157
|
+
| `model` | text, up to 64 characters | "satham-1" | `model` | "satham-1" only today; needs session controls |
|
|
158
|
+
| `modalities` | list | ["audio", "text"] | `modalities` | ["audio", "text"], ["audio"], or ["text"]: words only, for your own TTS; needs session controls |
|
|
159
|
+
| `language` | `auto`, `hi`, `ta`, `te`, `kn`, `bn`, `pa`, `en` | "auto" | - | |
|
|
160
|
+
| `language_switch` | `auto`, `off`, or `None` | "auto" | - | |
|
|
161
|
+
| `voice_on_language_switch` | `keep`, `native`, or `None` | "keep" | - | |
|
|
162
|
+
| `turn_detection.enabled` | `True` / `False` | true | `turn_detection=None` | false (or turn_detection=None): the client ends each turn; needs session controls |
|
|
163
|
+
| `turn_detection.type` | `server_vad`, `semantic_vad` | "server_vad" | `turn_detection.type` | needs session controls |
|
|
164
|
+
| `turn_detection.threshold` | 0.1 to 0.95 | 0.5 | `turn_detection.threshold` | the speech detector's threshold; needs session controls |
|
|
165
|
+
| `turn_detection.eagerness` | `auto`, `low`, `medium`, `high` | "auto" | `turn_detection.eagerness` | semantic_vad's end-of-turn wait; needs session controls |
|
|
166
|
+
| `turn_detection.prefix_padding_ms` | 0 to 1000 | 300 | `turn_detection.prefix_padding_ms` | needs session controls |
|
|
167
|
+
| `turn_detection.min_speech_ms` | 50 to 1000 | 100 | - | needs session controls |
|
|
168
|
+
| `turn_detection.silence_duration_ms` | 150 to 2000 | 350 | `turn_detection.silence_duration_ms` | server_vad's end-of-turn wait; needs session controls |
|
|
169
|
+
| `turn_detection.create_response` | `True` / `False` | true | `turn_detection.create_response` | answer each turn at once; needs session controls |
|
|
170
|
+
| `turn_detection.interrupt_response` | `True` / `False` | true | `turn_detection.interrupt_response` | barge-in on or off; needs session controls |
|
|
171
|
+
| `turn_detection.barge_in.min_speech_ms` | 0 to 2000 | 400 | - | needs session controls |
|
|
172
|
+
| `turn_detection.barge_in.min_probability` | 0 to 1 | 0.8 | - | needs session controls |
|
|
173
|
+
| `turn_detection.barge_in.min_dbfs` | -90 to 0, or `None` | -40 | - | needs session controls |
|
|
174
|
+
| `turn_detection.continue_within_ms` | 0 to 5000, or `None` | 2000 | - | the caller carrying on in the same turn; null: off; needs session controls |
|
|
175
|
+
| `turn_detection.continue_max_heard_ms` | 0 to 5000 | 1000 | - | needs session controls |
|
|
176
|
+
| `input_audio_noise_reduction.enabled` | `True` / `False` | true | `input_audio_noise_reduction={"type": "none"}` | false, "none" or {"type": "none"}: off; needs session controls |
|
|
177
|
+
| `input_audio_noise_reduction.mode` | `near_field`, `far_field` | "near_field" | `input_audio_noise_reduction.type` | resets strength_db to the mode's preset (12 or 30 dB) unless both are sent; needs session controls |
|
|
178
|
+
| `input_audio_noise_reduction.strength_db` | 0 to 100 | 12 | - | needs session controls |
|
|
179
|
+
| `input_audio_noise_reduction.apply_to_transcription` | `True` / `False` | false | - | needs session controls |
|
|
180
|
+
| `input_audio_transcription.enabled` | `True` / `False` | true | `input_audio_transcription=None` | transcript events to the client; needs session controls |
|
|
181
|
+
| `input_audio_transcription.code_mixed` | `True` / `False` | true | - | English words in Latin script, and digits; needs session controls |
|
|
182
|
+
| `voice` | text, up to 64 characters | the language's | `voice` | |
|
|
183
|
+
| `breaths` | `True` / `False`, or `None` | off | - | |
|
|
184
|
+
| `natural_pauses` | `True` / `False`, or `None` | off | - | |
|
|
185
|
+
| `continuation` | `True` / `False`, or `None` | true | - | each phrase carries on from the one before; needs session controls |
|
|
186
|
+
| `speed` | 1 to 1 | 1.0 | `speed` | 1.0 only today; needs session controls |
|
|
187
|
+
| `phrasing.first_phrase_max_chars` | 1 to 120 | 120 | - | at least min_phrase_chars; needs session controls |
|
|
188
|
+
| `phrasing.min_phrase_chars` | 1 to 120 | 20 | - | needs session controls |
|
|
189
|
+
| `normalise_numbers` | `True` / `False` | true | - | numbers and amounts said as words; needs session controls |
|
|
190
|
+
| `pronunciations` | word to respelling | none | - | {word: respelling}, up to 200; needs session controls |
|
|
191
|
+
| `temperature` | 0.6 to 1.2 | 0.7 | `temperature` | needs session controls |
|
|
192
|
+
| `top_p` | 0.05 to 1 | 0.8 | - | needs session controls |
|
|
193
|
+
| `max_response_output_tokens` | 1 to 4096 | 320 | `max_response_output_tokens` | or "inf"; never above the server's; needs session controls |
|
|
194
|
+
| `tone` | `auto`, `conversational`, `happy`, `sad`, `excited`, `professional` | "auto" | - | "auto": the model picks; needs session controls |
|
|
195
|
+
| `repeat_guard` | `True` / `False` | true | - | re-asks a reply that repeats a recent one; needs session controls |
|
|
196
|
+
| `drift_guard` | `True` / `False` | true | - | keeps replies in the call's language; needs session controls |
|
|
197
|
+
<!-- /controls -->
|
|
198
|
+
|
|
199
|
+
## Text mode, manual turns, tools, interruptions
|
|
200
|
+
|
|
201
|
+
- **`modalities=["text"]`.** The agent's words go to the `AgentSession`'s TTS, as with OpenAI's text
|
|
202
|
+
mode; give the session a `tts`.
|
|
203
|
+
- **`turn_detection=None`.** LiveKit's own turn detection (the session's VAD and turn detector) ends
|
|
204
|
+
each turn: the plugin commits the caller's audio, and `generate_reply()` returns the reply.
|
|
205
|
+
- **Tools (preview: they need a Satham server with tool support).** Each call the agent makes runs
|
|
206
|
+
your tool; its result goes back to the server, which replies unless the tool returns
|
|
207
|
+
`llm.ToolResult(..., reply_required=False)`.
|
|
208
|
+
- **Interruptions.** The caller speaking over the agent interrupts it and the playout stops at once.
|
|
209
|
+
LiveKit mutes the caller for the first 3 s of agent speech by default (`AgentSession(
|
|
210
|
+
aec_warmup_duration=3.0)`, off for SIP calls); set it to `None` where echo cancellation is good.
|
|
211
|
+
- **Not supported:** video, and reconnection (a dropped connection ends the call with an
|
|
212
|
+
unrecoverable error).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
livekit/plugins/satham/__init__.py,sha256=CWgijFZ4HAzfz7pVOIDhos3KVBafNF2Y20Rh1Upj5nk,727
|
|
2
|
+
livekit/plugins/satham/log.py,sha256=gJ9jmr7uUuoMQiPoXsF2f1F1Rh9tM5vJMa2pXCLCEm8,69
|
|
3
|
+
livekit/plugins/satham/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
livekit/plugins/satham/realtime.py,sha256=UDBu3sqjW3JfDMzyrdkw8TWrFhkW7su8jMwRKErnMJc,28976
|
|
5
|
+
livekit/plugins/satham/version.py,sha256=rnObPjuBcEStqSO0S6gsdS_ot8ITOQjVj_-P1LUUYpg,22
|
|
6
|
+
livekit_plugins_satham-0.1.1.dist-info/METADATA,sha256=jGvVts2Y0_Bn3h3p04T1KqhS6Eh0IpPzqRgLC1-DfHI,13251
|
|
7
|
+
livekit_plugins_satham-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
+
livekit_plugins_satham-0.1.1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
9
|
+
livekit_plugins_satham-0.1.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|