@arizeai/openinference-instrumentation-openai 4.4.2 → 4.4.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arizeai/openinference-instrumentation-openai",
3
- "version": "4.4.2",
3
+ "version": "4.4.3",
4
4
  "private": false,
5
5
  "description": "OpenInference instrumentation for OpenAI",
6
6
  "keywords": [],
@@ -556,7 +556,11 @@ export class OpenAIInstrumentation extends InstrumentationBase<typeof openai> {
556
556
  ...getResponsesOutputMessagesAttributes(result),
557
557
  ...getResponsesUsageAttributes(result),
558
558
  });
559
- span.setStatus({ code: SpanStatusCode.OK });
559
+ span.setStatus(
560
+ result.status === "failed"
561
+ ? { code: SpanStatusCode.ERROR, message: result.error?.message }
562
+ : { code: SpanStatusCode.OK },
563
+ );
560
564
  span.end();
561
565
  };
562
566
  if (isResponseCreateResponse(result)) {
@@ -255,7 +255,11 @@ export async function consumeResponseStreamEvents(
255
255
 
256
256
  for await (const event of stream) {
257
257
  switch (event.type) {
258
- case "response.completed": {
258
+ // A stream can end on any of these; the incomplete and failed ones still carry the
259
+ // partial output and the usage.
260
+ case "response.completed":
261
+ case "response.incomplete":
262
+ case "response.failed": {
259
263
  response = event.response;
260
264
  break;
261
265
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // this is an auto-generated file. see js/scripts/version-update.js
2
- export const VERSION = "4.4.2";
2
+ export const VERSION = "4.4.3";