@@ -96,7 +96,7 @@ def setup_once() -> None:
9696 """
9797 client.messages.create(stream=True) can return an instance of the Stream class, which implements the iterator protocol.
9898 The private _iterator variable and the close() method are patched. During iteration over the _iterator generator,
99- information from intercepted events are accumulated and used to populate output attributes on the AI Client Span.
99+ information from intercepted events is accumulated and used to populate output attributes on the AI Client Span.
100100
101101 The span can be finished in two places:
102102 - When the user exits the context manager or directly calls close(), the patched close() finishes the span.
@@ -110,9 +110,9 @@ def setup_once() -> None:
110110 AsyncMessages .create = _wrap_message_create_async (AsyncMessages .create )
111111
112112 """
113- client.messages.stream() can return an instance of the Stream class, which implements the iterator protocol.
113+ client.messages.stream() can return an instance of the MessageStream class, which implements the iterator protocol.
114114 The private _iterator variable and the close() method are patched. During iteration over the _iterator generator,
115- information from intercepted events are accumulated and used to populate output attributes on the AI Client Span.
115+ information from intercepted events is accumulated and used to populate output attributes on the AI Client Span.
116116
117117 The span can be finished in two places:
118118 - When the user exits the context manager or directly calls close(), the patched close() finishes the span.
@@ -463,13 +463,13 @@ def _wrap_synchronous_message_iterator(
463463 with capture_internal_exceptions ():
464464 if hasattr (stream , "_span" ):
465465 _finish_streaming_span (
466- stream ._span ,
467- stream ._integration ,
468- stream ._model ,
469- stream ._usage ,
470- stream ._content_blocks ,
471- stream ._response_id ,
472- stream ._finish_reason ,
466+ span = stream ._span ,
467+ integration = stream ._integration ,
468+ model = stream ._model ,
469+ usage = stream ._usage ,
470+ content_blocks = stream ._content_blocks ,
471+ response_id = stream ._response_id ,
472+ finish_reason = stream ._finish_reason ,
473473 )
474474 del stream ._span
475475
@@ -811,13 +811,13 @@ def close(self: "Union[Stream, MessageStream]") -> None:
811811 return f (self )
812812
813813 _finish_streaming_span (
814- self ._span ,
815- self ._integration ,
816- self ._model ,
817- self ._usage ,
818- self ._content_blocks ,
819- self ._response_id ,
820- self ._finish_reason ,
814+ span = self ._span ,
815+ integration = self ._integration ,
816+ model = self ._model ,
817+ usage = self ._usage ,
818+ content_blocks = self ._content_blocks ,
819+ response_id = self ._response_id ,
820+ finish_reason = self ._finish_reason ,
821821 )
822822 del self ._span
823823
0 commit comments