livekit-plugins-aws 1.2.8__tar.gz → 1.2.9__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.

Files changed (18) hide show
  1. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/PKG-INFO +2 -2
  2. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/experimental/realtime/realtime_model.py +1 -0
  3. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/llm.py +19 -2
  4. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/tts.py +18 -0
  5. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/version.py +1 -1
  6. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/pyproject.toml +1 -1
  7. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/.gitignore +0 -0
  8. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/README.md +0 -0
  9. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/__init__.py +0 -0
  10. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/experimental/realtime/__init__.py +0 -0
  11. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/experimental/realtime/events.py +0 -0
  12. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/experimental/realtime/pretty_printer.py +0 -0
  13. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/experimental/realtime/turn_tracker.py +0 -0
  14. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/log.py +0 -0
  15. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/models.py +0 -0
  16. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/py.typed +0 -0
  17. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/livekit/plugins/aws/stt.py +0 -0
  18. {livekit_plugins_aws-1.2.8 → livekit_plugins_aws-1.2.9}/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.8
3
+ Version: 1.2.9
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.8
23
+ Requires-Dist: livekit-agents>=1.2.9
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"
@@ -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
- tool_config: dict[str, Any] = {"tools": to_fnc_ctx(tools)}
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
- opts["system"] = [{"text": content} for content in extra_data.system_messages]
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__(
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "1.2.8"
15
+ __version__ = "1.2.9"
@@ -23,7 +23,7 @@ classifiers = [
23
23
  "Programming Language :: Python :: 3 :: Only",
24
24
  ]
25
25
  dependencies = [
26
- "livekit-agents>=1.2.8",
26
+ "livekit-agents>=1.2.9",
27
27
  "aioboto3>=14.1.0",
28
28
  "amazon-transcribe>=0.6.4",
29
29
  ]