in instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/wrappers.py [0:0]
def process_chunk(self, chunk):
self.response_id = chunk.id
self.model = chunk.model
# usage with streaming is available since 1.26.0
if hasattr(chunk, "usage"):
self.usage = chunk.usage
# with `include_usage` in `stream_options` we will get a last chunk without choices
if chunk.choices:
self.choices += chunk.choices
if hasattr(chunk, "service_tier"):
self.service_tier = chunk.service_tier