chore: handle fields other than reasoning_content in interleaved block

This commit is contained in:
Aiden Cline
2026-01-19 12:18:17 -06:00
parent 092428633f
commit 3fd0043d19

View File

@@ -123,11 +123,8 @@ export namespace ProviderTransform {
return result return result
} }
if ( if (typeof model.capabilities.interleaved === "object" && model.capabilities.interleaved.field) {
model.capabilities.interleaved && const field = model.capabilities.interleaved.field
typeof model.capabilities.interleaved === "object" &&
model.capabilities.interleaved.field === "reasoning_content"
) {
return msgs.map((msg) => { return msgs.map((msg) => {
if (msg.role === "assistant" && Array.isArray(msg.content)) { if (msg.role === "assistant" && Array.isArray(msg.content)) {
const reasoningParts = msg.content.filter((part: any) => part.type === "reasoning") const reasoningParts = msg.content.filter((part: any) => part.type === "reasoning")
@@ -136,7 +133,7 @@ export namespace ProviderTransform {
// Filter out reasoning parts from content // Filter out reasoning parts from content
const filteredContent = msg.content.filter((part: any) => part.type !== "reasoning") const filteredContent = msg.content.filter((part: any) => part.type !== "reasoning")
// Include reasoning_content directly on the message for all assistant messages // Include reasoning_content | reasoning_details directly on the message for all assistant messages
if (reasoningText) { if (reasoningText) {
return { return {
...msg, ...msg,
@@ -145,7 +142,7 @@ export namespace ProviderTransform {
...msg.providerOptions, ...msg.providerOptions,
openaiCompatible: { openaiCompatible: {
...(msg.providerOptions as any)?.openaiCompatible, ...(msg.providerOptions as any)?.openaiCompatible,
reasoning_content: reasoningText, [field]: reasoningText,
}, },
}, },
} }