ConstA ChatOpenAI reasoning summary object containing:
id: The reasoning item IDtype: The type of reasoning (typically "reasoning")summary: Array of summary parts, each with:
text: The summary text contenttype: The summary type (e.g., "summary_text")index: The index used to group related summary parts during streamingAn OpenAI Responses API ResponseReasoningItem with:
summary: Consolidated array of summary objects with:
text: Combined text from all parts with the same indextype: The summary typeindex field (removed after consolidation)// Input: Reasoning summary with multiple parts at the same index
const reasoning = {
id: "reasoning_123",
type: "reasoning",
summary: [
{ text: "First ", type: "summary_text", index: 0 },
{ text: "part", type: "summary_text", index: 0 },
{ text: "Second part", type: "summary_text", index: 1 }
]
};
const result = convertReasoningSummaryToResponsesReasoningItem(reasoning);
// Returns:
// {
// id: "reasoning_123",
// type: "reasoning",
// summary: [
// { text: "First part", type: "summary_text" },
// { text: "Second part", type: "summary_text" }
// ]
// }
convertResponsesDeltaToChatGenerationChunk
Converts a LangChain ChatOpenAI reasoning summary to an OpenAI Responses API reasoning item.
This converter transforms reasoning summaries that have been accumulated during streaming (where summary parts may arrive in multiple chunks with the same index) into the final consolidated format expected by OpenAI's Responses API. It combines summary parts that share the same index and removes the index field from the final output.