AIX: DeepSeek V4: wires and parser NS

This commit is contained in:
Enrico Ros
2026-04-24 05:09:16 -07:00
parent 678e6b8ba1
commit 784ee9a4da
2 changed files with 11 additions and 0 deletions
@@ -494,6 +494,10 @@ export function createOpenAIChatCompletionsParserNS(): ChatGenerateParseFunction
} else if (message.content !== undefined && message.content !== null)
throw new Error(`unexpected message content type: ${typeof message.content}`);
// [DeepSeek, 2026-04-24] Non-streaming reasoning_content -> 'ma' reasoning part (mirror of streaming path above)
if (typeof message.reasoning_content === 'string' && message.reasoning_content)
pt.appendReasoningText(message.reasoning_content);
// [OpenRouter, 2025-01-20] Handle structured reasoning_details
if (Array.isArray(message.reasoning_details)) {
for (const reasoningDetail of message.reasoning_details) {
@@ -189,6 +189,13 @@ export namespace OpenAIWire_Messages {
/** [OpenRouter, 2025-01-20] Reasoning traces with multiple blocks (summary, text, encrypted). */
reasoning_details: z.array(OpenAIWire_ContentParts.OpenRouter_ReasoningDetail_schema).optional(),
/**
* [DeepSeek, 2026-04-24] Chain-of-thought reasoning text.
* - Response: emitted by V4 thinking-by-default; parsed into a 'ma' reasoning part.
* - (this) Request: MUST be echoed back on assistant turns that carry tool_calls (otherwise HTTP 400: "The reasoning_content in the thinking mode must be passed back to the API.").
*/
reasoning_content: z.string().nullable().optional(),
// function_call: // ignored, as it's deprecated
// name: _optionalParticipantName, // omitted by choice: generally unsupported
});