@ai-sdk/openai 2.1.0-beta.4 → 2.1.0-beta.6

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.
@@ -2157,26 +2157,40 @@ async function convertToOpenAIResponsesInput({
2157
2157
  });
2158
2158
  const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
2159
2159
  if (reasoningId != null) {
2160
- const existingReasoningMessage = reasoningMessages[reasoningId];
2161
- const summaryParts = [];
2162
- if (part.text.length > 0) {
2163
- summaryParts.push({ type: "summary_text", text: part.text });
2164
- } else if (existingReasoningMessage !== void 0) {
2165
- warnings.push({
2166
- type: "other",
2167
- message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2168
- });
2169
- }
2170
- if (existingReasoningMessage === void 0) {
2171
- reasoningMessages[reasoningId] = {
2172
- type: "reasoning",
2173
- id: reasoningId,
2174
- encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
2175
- summary: summaryParts
2176
- };
2177
- input.push(reasoningMessages[reasoningId]);
2160
+ const reasoningMessage = reasoningMessages[reasoningId];
2161
+ if (store) {
2162
+ if (reasoningMessage === void 0) {
2163
+ input.push({ type: "item_reference", id: reasoningId });
2164
+ reasoningMessages[reasoningId] = {
2165
+ type: "reasoning",
2166
+ id: reasoningId,
2167
+ summary: []
2168
+ };
2169
+ }
2178
2170
  } else {
2179
- existingReasoningMessage.summary.push(...summaryParts);
2171
+ const summaryParts = [];
2172
+ if (part.text.length > 0) {
2173
+ summaryParts.push({
2174
+ type: "summary_text",
2175
+ text: part.text
2176
+ });
2177
+ } else if (reasoningMessage !== void 0) {
2178
+ warnings.push({
2179
+ type: "other",
2180
+ message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2181
+ });
2182
+ }
2183
+ if (reasoningMessage === void 0) {
2184
+ reasoningMessages[reasoningId] = {
2185
+ type: "reasoning",
2186
+ id: reasoningId,
2187
+ encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
2188
+ summary: summaryParts
2189
+ };
2190
+ input.push(reasoningMessages[reasoningId]);
2191
+ } else {
2192
+ reasoningMessage.summary.push(...summaryParts);
2193
+ }
2180
2194
  }
2181
2195
  } else {
2182
2196
  warnings.push({