OpenInference JS
    Preparing search index...
    • Converts a SpanOutput object or string into OpenTelemetry attributes.

      This function transforms span output data into the standardized attribute format used by OpenTelemetry, mapping values to the appropriate semantic convention keys.

      Parameters

      • output: string | SpanOutput | null | undefined

        The SpanOutput object, string, or undefined to convert

      Returns Attributes

      OpenTelemetry attributes with OUTPUT_VALUE and OUTPUT_MIME_TYPE keys

      // SpanOutput object
      getOutputAttributes({ value: "result", mimeType: MimeType.TEXT })
      // Returns: { [OUTPUT_VALUE]: "result", [OUTPUT_MIME_TYPE]: MimeType.TEXT }

      // String input
      getOutputAttributes("simple string")
      // Returns: { [OUTPUT_VALUE]: "simple string", [OUTPUT_MIME_TYPE]: MimeType.TEXT }

      // Undefined input
      getOutputAttributes(undefined) // Returns: {}