livekit-plugins-aws 1.0.0rc3__tar.gz → 1.0.0rc4__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: livekit-plugins-aws
3
- Version: 1.0.0rc3
3
+ Version: 1.0.0rc4
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/
@@ -21,7 +21,7 @@ Requires-Python: >=3.9.0
21
21
  Requires-Dist: aiobotocore==2.19.0
22
22
  Requires-Dist: amazon-transcribe>=0.6.2
23
23
  Requires-Dist: boto3==1.36.3
24
- Requires-Dist: livekit-agents>=1.0.0.rc3
24
+ Requires-Dist: livekit-agents>=1.0.0.rc4
25
25
  Description-Content-Type: text/markdown
26
26
 
27
27
  # LiveKit Plugins AWS
@@ -35,7 +35,6 @@ from .log import logger
35
35
  from .utils import get_aws_credentials, to_chat_ctx, to_fnc_ctx
36
36
 
37
37
  TEXT_MODEL = Literal["anthropic.claude-3-5-sonnet-20241022-v2:0"]
38
- DEFAULT_REGION = "us-east-1"
39
38
 
40
39
 
41
40
  @dataclass
@@ -228,12 +227,24 @@ class LLMStream(llm.LLMStream):
228
227
  self._tool_call_id = tool_use["toolUseId"]
229
228
  self._fnc_name = tool_use["name"]
230
229
  self._fnc_raw_arguments = ""
230
+
231
231
  elif "contentBlockDelta" in chunk:
232
232
  delta = chunk["contentBlockDelta"]["delta"]
233
233
  if "toolUse" in delta:
234
234
  self._fnc_raw_arguments += delta["toolUse"]["input"]
235
235
  elif "text" in delta:
236
236
  self._text += delta["text"]
237
+
238
+ elif "metadata" in chunk:
239
+ metadata = chunk["metadata"]
240
+ return llm.ChatChunk(
241
+ request_id=request_id,
242
+ usage=llm.CompletionUsage(
243
+ completion_tokens=metadata["usage"]["outputTokens"],
244
+ prompt_tokens=metadata["usage"]["inputTokens"],
245
+ total_tokens=metadata["usage"]["totalTokens"],
246
+ ),
247
+ )
237
248
  elif "contentBlockStop" in chunk:
238
249
  if self._text:
239
250
  chat_chunk = llm.ChatChunk(
@@ -13,6 +13,8 @@ from livekit.agents.utils import is_given
13
13
 
14
14
  __all__ = ["to_fnc_ctx", "to_chat_ctx", "get_aws_credentials"]
15
15
 
16
+ DEFAULT_REGION = "us-east-1"
17
+
16
18
 
17
19
  def get_aws_credentials(
18
20
  api_key: NotGivenOr[str],
@@ -21,9 +23,7 @@ def get_aws_credentials(
21
23
  ):
22
24
  aws_region = region if is_given(region) else os.environ.get("AWS_DEFAULT_REGION")
23
25
  if not aws_region:
24
- raise ValueError(
25
- "AWS_DEFAULT_REGION must be set via argument or the AWS_DEFAULT_REGION environment variable." # noqa: E501
26
- )
26
+ aws_region = DEFAULT_REGION
27
27
 
28
28
  if is_given(api_key) and is_given(api_secret):
29
29
  session = boto3.Session(
@@ -127,6 +127,8 @@ def _build_tool_spec(fnc: FunctionTool) -> dict:
127
127
 
128
128
  def _build_image(image: ImageContent, cache_key: Any) -> dict:
129
129
  img = utils.serialize_image(image)
130
+ if img.external_url:
131
+ raise ValueError("external_url is not supported by AWS Bedrock.")
130
132
  if cache_key not in image._cache:
131
133
  image._cache[cache_key] = img.data_bytes
132
134
  return {
@@ -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.0.0.rc3'
15
+ __version__ = '1.0.0.rc4'
@@ -23,7 +23,7 @@ classifiers = [
23
23
  "Programming Language :: Python :: 3 :: Only",
24
24
  ]
25
25
  dependencies = [
26
- "livekit-agents>=1.0.0.rc3",
26
+ "livekit-agents>=1.0.0.rc4",
27
27
  "aiobotocore==2.19.0",
28
28
  "boto3==1.36.3",
29
29
  "amazon-transcribe>=0.6.2",