Skip to content

Commit 5eb9f4a

Browse files
feat: Integrate OpenAI Responses API to enable GPT-5 features (#7891)
* Thinking for deepseek and openrouter providers * fix: messages array is modified as a side-effect * fix formatting and type errors * Add type annotations for reasoning fields in OpenAI chunk processing * Handle thinking blocks for openaiAdapter * Optimize chat stream processing by replacing string concatenation with array operations for better performance * Add support for Claude reasoning blocks with signature handling * Add reasoning_details support for thinking messages in OpenAI type converters * Optionally preserve reasoning, improve the handling of reasoning_details * Remove debug console logs from reasoning details merging * Remove reasoning content for Claude models when no signature is present in reasoning details * remove forceStreamChat flag and simplify streaming logic in BaseLLM * remove preserveReasoning option and always preserve reasoning blocks * Responses API: apply net changes from 95f076b^..8bd85e2 as one commit on responses_api_2 to bring in Responses API work and merged updates * add support for provider-specific reasoning fields in LLM implementations --------- Co-authored-by: Patrick Erichsen <[email protected]>
1 parent c9b9862 commit 5eb9f4a

File tree

7 files changed

+1271
-106
lines changed

7 files changed

+1271
-106
lines changed

core/index.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,15 @@ export interface ToolResultChatMessage {
359359
role: "tool";
360360
content: string;
361361
toolCallId: string;
362+
/** Arbitrary per-message metadata (IDs, provider-specific info, etc.) */
363+
metadata?: Record<string, unknown>;
362364
}
363365

364366
export interface UserChatMessage {
365367
role: "user";
366368
content: MessageContent;
369+
/** Arbitrary per-message metadata (IDs, provider-specific info, etc.) */
370+
metadata?: Record<string, unknown>;
367371
}
368372

369373
export interface ThinkingChatMessage {
@@ -372,6 +376,12 @@ export interface ThinkingChatMessage {
372376
signature?: string;
373377
redactedThinking?: string;
374378
toolCalls?: ToolCallDelta[];
379+
reasoning_details?: {
380+
signature?: string;
381+
[key: string]: any;
382+
}[];
383+
/** Arbitrary per-message metadata (IDs, provider-specific info, etc.) */
384+
metadata?: Record<string, unknown>;
375385
}
376386

377387
/**
@@ -400,11 +410,15 @@ export interface AssistantChatMessage {
400410
content: MessageContent;
401411
toolCalls?: ToolCallDelta[];
402412
usage?: Usage;
413+
/** Arbitrary per-message metadata (IDs, provider-specific info, etc.) */
414+
metadata?: Record<string, unknown>;
403415
}
404416

405417
export interface SystemChatMessage {
406418
role: "system";
407419
content: string;
420+
/** Arbitrary per-message metadata (IDs, provider-specific info, etc.) */
421+
metadata?: Record<string, unknown>;
408422
}
409423

410424
export type ChatMessage =

0 commit comments

Comments
 (0)