Skip to content

ResponseOutputTextAnnotationAddedEvent Wrong Type #1515

Open
@igorgarbuz

Description

@igorgarbuz

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

ResponseOutputTextAnnotationAddedEvent interface property type has its value response.output_text_annotation.added
but the actual type returned by the API is response.output_text.annotation.added.

To Reproduce

Compare SDK ResponseOutputTextAnnotationAddedEvent interface type with the actual API returned object.

Code snippets

Current implementation:

"""
/**
 * Emitted when an annotation is added to output text content.
 */
export interface ResponseOutputTextAnnotationAddedEvent {
  /**
   * The annotation object being added. (See annotation schema for details.)
   */
  annotation: unknown;

  /**
   * The index of the annotation within the content part.
   */
  annotation_index: number;

  /**
   * The index of the content part within the output item.
   */
  content_index: number;

  /**
   * The unique identifier of the item to which the annotation is being added.
   */
  item_id: string;

  /**
   * The index of the output item in the response's output array.
   */
  output_index: number;

  /**
   * The sequence number of this event.
   */
  sequence_number: number;

  /**
   * The type of the event. Always 'response.output_text_annotation.added'.
   */
  type: 'response.output_text_annotation.added';
}

Desired implementation example including added Annotation type and type property set to 'response.output_text.annotation.added':

type FileCitationAnnotation = {
  type: "file_citation";
  file_id: string;
  filename: string;
  index: number;
};

type FilePathAnnotation = {
  type: "file_path";
  file_path: string;
  index: number;
};

type Annotation = FileCitationAnnotation | FilePathAnnotation;

/**
 * Emitted when an annotation is added to output text content.
 */
export interface ResponseOutputTextAnnotationAddedEvent {
  annotation: Annotation;

  /**
   * The index of the annotation within the content part.
   */
  annotation_index: number;

  /**
   * The index of the content part within the output item.
   */
  content_index: number;

  /**
   * The unique identifier of the item to which the annotation is being added.
   */
  item_id: string;

  /**
   * The index of the output item in the response's output array.
   */
  output_index: number;

  /**
   * The sequence number of this event.
   */
  sequence_number: number;

  /**
   * The type of the event. Always 'response.output_text.annotation.added'.
   */
  type: 'response.output_text.annotation.added';
}

OS

MacOS

Node version

20.11.1

Library version

4.103.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions