Class OpenAiResponsesMetadata

java.lang.Object
org.springframework.ai.openai.responses.OpenAiResponsesMetadata

public final class OpenAiResponsesMetadata extends Object
Metadata keys published by OpenAiResponsesChatModel, and the part attributes it uses.

There are two groups. What a turn reports is published on the generation or response metadata; what a turn needs to be replayed travels in the part attributes and payloads.

The assistant message carries no metadata of its own. What a turn reports beyond its parts describes one response rather than the message, and message metadata is persisted by some chat memory repositories and dropped by others, so nothing that matters may live there.

The openai.responses.* keys are specific to this API. REFUSAL, ANNOTATIONS and REASONING_CONTENT keep the unprefixed names OpenAiChatModel publishes on its assistant message, so code moving between the two beans only has to change where it reads them, not what it looks up.

Since:
2.1.0
Author:
Dimitar Proynov
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Citations attached to the generated text, e.g. from web or file search.
    static final String
    The response creation timestamp, in seconds since the epoch.
    static final String
    The kind of the payload carried by a reasoning part: the encrypted_content of a reasoning item, which has to travel back verbatim for the model to keep its train of thought across a tool call or a follow-up turn.
    static final String
    Summary of the tools OpenAI executed server-side within the request, as a list of {type, id, status} maps.
    static final String
    Why an incomplete response stopped: max_output_tokens or content_filter.
    static final String
    Part attribute holding the id of the output item a part was mapped from, e.g.
    static final String
    Part attribute holding the status of the output item a part was mapped from: in_progress, completed or incomplete.
    static final String
    Part attribute holding the phase of an assistant message item (commentary or final_answer), which GPT-5.5 and later return to mark whether a message was a final answer or an intermediate update.
    static final String
    The provider of every payload and every UnknownPart this model produces, and the only one it replays.
    static final String
    Reasoning summary text, one line per reasoning item.
    static final String
    The model's refusal text, or an empty string.
    static final String
    The response status: completed, incomplete, failed, ...
  • Method Summary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PROVIDER

      public static final String PROVIDER
      The provider of every payload and every UnknownPart this model produces, and the only one it replays.

      The endpoint, not the vendor. Chat Completions and Responses are two OpenAI APIs whose replay payloads are not interchangeable, and a conversation can move between them, so naming the endpoint is what keeps either one from replaying the other's data if their handling of payload-carrying parts ever converges.

      See Also:
    • ENCRYPTED_CONTENT_KIND

      public static final String ENCRYPTED_CONTENT_KIND
      The kind of the payload carried by a reasoning part: the encrypted_content of a reasoning item, which has to travel back verbatim for the model to keep its train of thought across a tool call or a follow-up turn.
      See Also:
    • ITEM_ID_ATTRIBUTE

      public static final String ITEM_ID_ATTRIBUTE
      Part attribute holding the id of the output item a part was mapped from, e.g. rs_... for a reasoning item or fc_... for a function call.

      This is the item id, which addresses the item's position in the transcript, never the call_id that pairs a call with its result. A reasoning part cannot be replayed without it.

      See Also:
    • ITEM_STATUS_ATTRIBUTE

      public static final String ITEM_STATUS_ATTRIBUTE
      Part attribute holding the status of the output item a part was mapped from: in_progress, completed or incomplete.
      See Also:
    • PHASE_ATTRIBUTE

      public static final String PHASE_ATTRIBUTE
      Part attribute holding the phase of an assistant message item (commentary or final_answer), which GPT-5.5 and later return to mark whether a message was a final answer or an intermediate update.

      Replayed so the model does not mistake a prior intermediate update for a final answer.

      See Also:
    • STATUS

      public static final String STATUS
      The response status: completed, incomplete, failed, ...
      See Also:
    • INCOMPLETE_REASON

      public static final String INCOMPLETE_REASON
      Why an incomplete response stopped: max_output_tokens or content_filter.
      See Also:
    • HOSTED_TOOL_CALLS

      public static final String HOSTED_TOOL_CALLS
      Summary of the tools OpenAI executed server-side within the request, as a list of {type, id, status} maps. These are never surfaced as tool calls.

      The summary describes activity inside a single request, so it is neither replayed on the next turn nor worth persisting with the conversation. The authoritative copy of each item is the UnknownPart it was mapped to, which holds the item verbatim and is replayed as-is.

      See Also:
    • CREATED_AT

      public static final String CREATED_AT
      The response creation timestamp, in seconds since the epoch.
      See Also:
    • REFUSAL

      public static final String REFUSAL
      The model's refusal text, or an empty string.

      There is no refusal part type, so this is the only place a refusal surfaces. On a stream it is the running total, published on every chunk that extends it, which is what lets it survive aggregation.

      See Also:
    • ANNOTATIONS

      public static final String ANNOTATIONS
      Citations attached to the generated text, e.g. from web or file search.

      The key matches OpenAiChatModel, but the value shape does not: this model publishes a List<Map<String, Object>>, whereas OpenAiChatModel publishes the OpenAI SDK's own annotation objects. Code that casts the entries has to be adjusted when swapping one bean for the other.

      See Also:
    • REASONING_CONTENT

      public static final String REASONING_CONTENT
      Reasoning summary text, one line per reasoning item. OpenAI never returns raw reasoning text, only summaries and an encrypted blob.

      Published under the key OpenAiChatModel and DeepSeek surface reasoning under. It is a flattened view: the authoritative form is the ordered ReasoningParts on the assistant message, which keep each item separate, in place among the tool calls it justified, and carry the encrypted content needed to replay it.

      See Also: