telemetry-dev-bedrock 0.2.4__tar.gz → 0.2.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: telemetry-dev-bedrock
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: AWS Bedrock integration for telemetry.dev Python SDK
5
5
  Keywords: telemetry,opentelemetry,bedrock,aws,boto3,genai,tracing
6
6
  Author: telemetry.dev
@@ -77,7 +77,7 @@ telemetry_dev.init(
77
77
  bedrock = wrap_bedrock(boto3.client("bedrock-runtime", region_name="us-east-1"))
78
78
 
79
79
  bedrock.converse(
80
- modelId="anthropic.claude-3-5-haiku-20241022-v1:0",
80
+ modelId="global.anthropic.claude-haiku-5-5",
81
81
  messages=[{"role": "user", "content": [{"text": "Hello"}]}],
82
82
  )
83
83
 
@@ -54,7 +54,7 @@ telemetry_dev.init(
54
54
  bedrock = wrap_bedrock(boto3.client("bedrock-runtime", region_name="us-east-1"))
55
55
 
56
56
  bedrock.converse(
57
- modelId="anthropic.claude-3-5-haiku-20241022-v1:0",
57
+ modelId="global.anthropic.claude-haiku-5-5",
58
58
  messages=[{"role": "user", "content": [{"text": "Hello"}]}],
59
59
  )
60
60
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "telemetry-dev-bedrock"
3
- version = "0.2.4"
3
+ version = "0.2.6"
4
4
  description = "AWS Bedrock integration for telemetry.dev Python SDK"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "telemetry-dev-bedrock"
3
- version = "0.2.4"
3
+ version = "0.2.6"
4
4
  description = "AWS Bedrock integration for telemetry.dev Python SDK"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -2,6 +2,6 @@ from __future__ import annotations
2
2
 
3
3
  from ._instrument import instrument_bedrock, uninstrument_bedrock, wrap_bedrock
4
4
 
5
- __version__ = "0.2.4"
5
+ __version__ = "0.2.6"
6
6
 
7
7
  __all__ = ["__version__", "instrument_bedrock", "uninstrument_bedrock", "wrap_bedrock"]
@@ -19,7 +19,6 @@ from ._messages import normalize_content_block
19
19
 
20
20
  # The core applies max_attribute_length after the mask.
21
21
  _CAPTURE_TRUNCATED_ATTRIBUTE = "telemetry.dev.capture.truncated"
22
- _OMIT = object()
23
22
 
24
23
 
25
24
  def stream_capture_budget() -> telemetry_dev.CaptureBudget:
@@ -106,14 +105,6 @@ class _DeltaBuffer:
106
105
  raise
107
106
 
108
107
 
109
- def capture_masked(handle: Any) -> bool:
110
- masked = getattr(handle, "capture_masked", None)
111
- if isinstance(masked, bool):
112
- return masked
113
- client = getattr(handle, "_client", None)
114
- return getattr(client, "mask", _OMIT) is not None if client is not None else True
115
-
116
-
117
108
  def mark_capture_incomplete(fields: dict[str, Any], mask_output: bool) -> dict[str, Any]:
118
109
  marked = merge_fields(fields, {"attributes": {_CAPTURE_TRUNCATED_ATTRIBUTE: True}})
119
110
  if mask_output:
@@ -580,7 +571,7 @@ class AgentStreamState(StreamState):
580
571
  # Metadata bypasses the capture flags and the mask, so trace content is filtered here,
581
572
  # and a mask that cannot see it withholds it.
582
573
  client = telemetry_dev.get_client()
583
- masked = client is None or getattr(client, "mask", _OMIT) is not None
574
+ masked = client is None or client.mask is not None
584
575
  self.trace_capture = {
585
576
  "input": client is not None and client.capture_input and not masked,
586
577
  "output": client is not None and client.capture_output and not masked,
@@ -792,7 +783,7 @@ class InstrumentedEventStream:
792
783
  state: StreamState,
793
784
  finish: Callable[[dict[str, Any]], None],
794
785
  started_at: float,
795
- handle: Any,
786
+ handle: telemetry_dev.SpanHandle,
796
787
  report_error: Callable[[BaseException], None],
797
788
  ) -> None:
798
789
  self._stream = stream
@@ -803,7 +794,7 @@ class InstrumentedEventStream:
803
794
  self._ended = False
804
795
  self._first = False
805
796
  self._track_output_chunks = isinstance(state, ConverseStreamState | InvokeModelStreamState)
806
- self._mask_output_when_incomplete = capture_masked(handle)
797
+ self._mask_output_when_incomplete = handle.capture_masked
807
798
  self._report_error = report_error
808
799
  state.report_error = self._report_error
809
800
 
@@ -841,9 +832,7 @@ class InstrumentedEventStream:
841
832
  if state_has_output is not None
842
833
  else _event_has_output(event)
843
834
  ):
844
- record_output_chunk = getattr(self._handle, "record_output_chunk", None)
845
- if callable(record_output_chunk):
846
- record_output_chunk(received_at * 1000)
835
+ self._handle.record_output_chunk(received_at * 1000)
847
836
  except Exception as exc:
848
837
  self._report_error(exc)
849
838
  yield event