livekit-plugins-aws 1.2.8__tar.gz → 1.2.10__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.
Potentially problematic release.
This version of livekit-plugins-aws might be problematic. Click here for more details.
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/PKG-INFO +2 -2
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/experimental/realtime/realtime_model.py +8 -1
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/llm.py +19 -2
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/tts.py +18 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/version.py +1 -1
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/pyproject.toml +1 -1
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/.gitignore +0 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/README.md +0 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/__init__.py +0 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/experimental/realtime/__init__.py +0 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/experimental/realtime/events.py +0 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/experimental/realtime/pretty_printer.py +0 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/experimental/realtime/turn_tracker.py +0 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/log.py +0 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/models.py +0 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/py.typed +0 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/stt.py +0 -0
- {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.10}/livekit/plugins/aws/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: livekit-plugins-aws
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.10
|
|
4
4
|
Summary: LiveKit Agents Plugin for services from AWS
|
|
5
5
|
Project-URL: Documentation, https://docs.livekit.io
|
|
6
6
|
Project-URL: Website, https://livekit.io/
|
|
@@ -20,7 +20,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
|
20
20
|
Requires-Python: >=3.9.0
|
|
21
21
|
Requires-Dist: aioboto3>=14.1.0
|
|
22
22
|
Requires-Dist: amazon-transcribe>=0.6.4
|
|
23
|
-
Requires-Dist: livekit-agents>=1.2.
|
|
23
|
+
Requires-Dist: livekit-agents>=1.2.10
|
|
24
24
|
Provides-Extra: realtime
|
|
25
25
|
Requires-Dist: aws-sdk-bedrock-runtime==0.0.2; (python_version >= '3.12') and extra == 'realtime'
|
|
26
26
|
Requires-Dist: boto3>1.35.10; extra == 'realtime'
|
|
@@ -240,6 +240,7 @@ class RealtimeModel(llm.RealtimeModel):
|
|
|
240
240
|
user_transcription=True,
|
|
241
241
|
auto_tool_reply_generation=True,
|
|
242
242
|
audio_output=True,
|
|
243
|
+
manual_function_calls=False,
|
|
243
244
|
)
|
|
244
245
|
)
|
|
245
246
|
self.model_id = "amazon.nova-sonic-v1:0"
|
|
@@ -272,6 +273,10 @@ class RealtimeModel(llm.RealtimeModel):
|
|
|
272
273
|
async def aclose(self) -> None:
|
|
273
274
|
pass
|
|
274
275
|
|
|
276
|
+
@property
|
|
277
|
+
def model(self) -> str:
|
|
278
|
+
return self.model_id
|
|
279
|
+
|
|
275
280
|
|
|
276
281
|
class RealtimeSession( # noqa: F811
|
|
277
282
|
llm.RealtimeSession[Literal["bedrock_server_event_received", "bedrock_client_event_queued"]]
|
|
@@ -556,6 +561,7 @@ class RealtimeSession( # noqa: F811
|
|
|
556
561
|
message_stream=self._current_generation.message_ch,
|
|
557
562
|
function_stream=self._current_generation.function_ch,
|
|
558
563
|
user_initiated=False,
|
|
564
|
+
response_id=self._current_generation.response_id,
|
|
559
565
|
)
|
|
560
566
|
self.emit("generation_created", generation_ev)
|
|
561
567
|
|
|
@@ -864,7 +870,8 @@ class RealtimeSession( # noqa: F811
|
|
|
864
870
|
output_tokens = event_data["event"]["usageEvent"]["details"]["delta"]["output"]
|
|
865
871
|
# Q: should we be counting per turn or utterance?
|
|
866
872
|
metrics = RealtimeModelMetrics(
|
|
867
|
-
label=self._realtime_model.
|
|
873
|
+
label=self._realtime_model.label,
|
|
874
|
+
model=self._realtime_model.model,
|
|
868
875
|
# TODO: pass in the correct request_id
|
|
869
876
|
request_id=event_data["event"]["usageEvent"]["completionId"],
|
|
870
877
|
timestamp=time.monotonic(),
|
|
@@ -51,6 +51,8 @@ class _LLMOptions:
|
|
|
51
51
|
max_output_tokens: NotGivenOr[int]
|
|
52
52
|
top_p: NotGivenOr[float]
|
|
53
53
|
additional_request_fields: NotGivenOr[dict[str, Any]]
|
|
54
|
+
cache_system: bool
|
|
55
|
+
cache_tools: bool
|
|
54
56
|
|
|
55
57
|
|
|
56
58
|
class LLM(llm.LLM):
|
|
@@ -66,6 +68,8 @@ class LLM(llm.LLM):
|
|
|
66
68
|
top_p: NotGivenOr[float] = NOT_GIVEN,
|
|
67
69
|
tool_choice: NotGivenOr[ToolChoice] = NOT_GIVEN,
|
|
68
70
|
additional_request_fields: NotGivenOr[dict[str, Any]] = NOT_GIVEN,
|
|
71
|
+
cache_system: bool = False,
|
|
72
|
+
cache_tools: bool = False,
|
|
69
73
|
session: aioboto3.Session | None = None,
|
|
70
74
|
) -> None:
|
|
71
75
|
"""
|
|
@@ -87,6 +91,8 @@ class LLM(llm.LLM):
|
|
|
87
91
|
top_p (float, optional): The nucleus sampling probability for response generation. Defaults to None.
|
|
88
92
|
tool_choice (ToolChoice, optional): Specifies whether to use tools during response generation. Defaults to "auto".
|
|
89
93
|
additional_request_fields (dict[str, Any], optional): Additional request fields to send to the AWS Bedrock Converse API. Defaults to None.
|
|
94
|
+
cache_system (bool, optional): Caches system messages to reduce token usage. Defaults to False.
|
|
95
|
+
cache_tools (bool, optional): Caches tool definitions to reduce token usage. Defaults to False.
|
|
90
96
|
session (aioboto3.Session, optional): Optional aioboto3 session to use.
|
|
91
97
|
""" # noqa: E501
|
|
92
98
|
super().__init__()
|
|
@@ -111,6 +117,8 @@ class LLM(llm.LLM):
|
|
|
111
117
|
max_output_tokens=max_output_tokens,
|
|
112
118
|
top_p=top_p,
|
|
113
119
|
additional_request_fields=additional_request_fields,
|
|
120
|
+
cache_system=cache_system,
|
|
121
|
+
cache_tools=cache_tools,
|
|
114
122
|
)
|
|
115
123
|
|
|
116
124
|
@property
|
|
@@ -140,7 +148,11 @@ class LLM(llm.LLM):
|
|
|
140
148
|
if not tools:
|
|
141
149
|
return None
|
|
142
150
|
|
|
143
|
-
|
|
151
|
+
tools_list = to_fnc_ctx(tools)
|
|
152
|
+
if self._opts.cache_tools:
|
|
153
|
+
tools_list.append({"cachePoint": {"type": "default"}})
|
|
154
|
+
|
|
155
|
+
tool_config: dict[str, Any] = {"tools": tools_list}
|
|
144
156
|
tool_choice = (
|
|
145
157
|
cast(ToolChoice, tool_choice) if is_given(tool_choice) else self._opts.tool_choice
|
|
146
158
|
)
|
|
@@ -162,7 +174,12 @@ class LLM(llm.LLM):
|
|
|
162
174
|
messages, extra_data = chat_ctx.to_provider_format(format="aws")
|
|
163
175
|
opts["messages"] = messages
|
|
164
176
|
if extra_data.system_messages:
|
|
165
|
-
|
|
177
|
+
system_messages: list[dict[str, str | dict]] = [
|
|
178
|
+
{"text": content} for content in extra_data.system_messages
|
|
179
|
+
]
|
|
180
|
+
if self._opts.cache_system:
|
|
181
|
+
system_messages.append({"cachePoint": {"type": "default"}})
|
|
182
|
+
opts["system"] = system_messages
|
|
166
183
|
|
|
167
184
|
inference_config: dict[str, Any] = {}
|
|
168
185
|
if is_given(self._opts.max_output_tokens):
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
from __future__ import annotations
|
|
14
14
|
|
|
15
15
|
from dataclasses import dataclass, replace
|
|
16
|
+
from typing import cast
|
|
16
17
|
|
|
17
18
|
import aioboto3 # type: ignore
|
|
18
19
|
import botocore # type: ignore
|
|
@@ -111,6 +112,23 @@ class TTS(tts.TTS):
|
|
|
111
112
|
) -> ChunkedStream:
|
|
112
113
|
return ChunkedStream(tts=self, text=text, conn_options=conn_options)
|
|
113
114
|
|
|
115
|
+
def update_options(
|
|
116
|
+
self,
|
|
117
|
+
*,
|
|
118
|
+
voice: NotGivenOr[str] = NOT_GIVEN,
|
|
119
|
+
language: NotGivenOr[str] = NOT_GIVEN,
|
|
120
|
+
speech_engine: NotGivenOr[TTSSpeechEngine] = NOT_GIVEN,
|
|
121
|
+
text_type: NotGivenOr[TTSTextType] = NOT_GIVEN,
|
|
122
|
+
) -> None:
|
|
123
|
+
if is_given(voice):
|
|
124
|
+
self._opts.voice = voice
|
|
125
|
+
if is_given(language):
|
|
126
|
+
self._opts.language = language
|
|
127
|
+
if is_given(speech_engine):
|
|
128
|
+
self._opts.speech_engine = cast(TTSSpeechEngine, speech_engine)
|
|
129
|
+
if is_given(text_type):
|
|
130
|
+
self._opts.text_type = cast(TTSTextType, text_type)
|
|
131
|
+
|
|
114
132
|
|
|
115
133
|
class ChunkedStream(tts.ChunkedStream):
|
|
116
134
|
def __init__(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|