Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- package.json +1 -1
- pnpm-lock.yaml +6 -6
- src/openai_patch.ts +10 -2
package.json
CHANGED
|
@@ -60,7 +60,7 @@
|
|
| 60 |
"dependencies": {
|
| 61 |
"@modelcontextprotocol/sdk": "^1.15.0",
|
| 62 |
"express": "^4.21.2",
|
| 63 |
-
"openai": "^
|
| 64 |
"zod": "^3.25.71"
|
| 65 |
},
|
| 66 |
"devDependencies": {
|
|
|
|
| 60 |
"dependencies": {
|
| 61 |
"@modelcontextprotocol/sdk": "^1.15.0",
|
| 62 |
"express": "^4.21.2",
|
| 63 |
+
"openai": "^5.8.2",
|
| 64 |
"zod": "^3.25.71"
|
| 65 |
},
|
| 66 |
"devDependencies": {
|
pnpm-lock.yaml
CHANGED
|
@@ -15,8 +15,8 @@ importers:
|
|
| 15 |
specifier: ^4.21.2
|
| 16 |
version: 4.21.2
|
| 17 |
openai:
|
| 18 |
-
specifier: ^
|
| 19 |
-
version:
|
| 20 |
zod:
|
| 21 |
specifier: ^3.25.71
|
| 22 |
version: 3.25.71
|
|
@@ -1224,12 +1224,12 @@ packages:
|
|
| 1224 |
once@1.4.0:
|
| 1225 |
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
| 1226 |
|
| 1227 |
-
openai@
|
| 1228 |
-
resolution: {integrity: sha512-
|
| 1229 |
hasBin: true
|
| 1230 |
peerDependencies:
|
| 1231 |
ws: ^8.18.0
|
| 1232 |
-
zod: ^3.
|
| 1233 |
peerDependenciesMeta:
|
| 1234 |
ws:
|
| 1235 |
optional: true
|
|
@@ -2847,7 +2847,7 @@ snapshots:
|
|
| 2847 |
dependencies:
|
| 2848 |
wrappy: 1.0.2
|
| 2849 |
|
| 2850 |
-
openai@
|
| 2851 |
optionalDependencies:
|
| 2852 |
ws: 8.18.3
|
| 2853 |
zod: 3.25.71
|
|
|
|
| 15 |
specifier: ^4.21.2
|
| 16 |
version: 4.21.2
|
| 17 |
openai:
|
| 18 |
+
specifier: ^5.8.2
|
| 19 |
+
version: 5.8.2(ws@8.18.3)(zod@3.25.71)
|
| 20 |
zod:
|
| 21 |
specifier: ^3.25.71
|
| 22 |
version: 3.25.71
|
|
|
|
| 1224 |
once@1.4.0:
|
| 1225 |
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
| 1226 |
|
| 1227 |
+
openai@5.8.2:
|
| 1228 |
+
resolution: {integrity: sha512-8C+nzoHYgyYOXhHGN6r0fcb4SznuEn1R7YZMvlqDbnCuE0FM2mm3T1HiYW6WIcMS/F1Of2up/cSPjLPaWt0X9Q==}
|
| 1229 |
hasBin: true
|
| 1230 |
peerDependencies:
|
| 1231 |
ws: ^8.18.0
|
| 1232 |
+
zod: ^3.23.8
|
| 1233 |
peerDependenciesMeta:
|
| 1234 |
ws:
|
| 1235 |
optional: true
|
|
|
|
| 2847 |
dependencies:
|
| 2848 |
wrappy: 1.0.2
|
| 2849 |
|
| 2850 |
+
openai@5.8.2(ws@8.18.3)(zod@3.25.71):
|
| 2851 |
optionalDependencies:
|
| 2852 |
ws: 8.18.3
|
| 2853 |
zod: 3.25.71
|
src/openai_patch.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
| 1 |
/*
|
| 2 |
-
* This file
|
| 3 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
*/
|
| 5 |
import type {
|
| 6 |
ResponseReasoningItem as OpenAIResponseReasoningItem,
|
|
@@ -14,15 +19,18 @@ import type {
|
|
| 14 |
} from "openai/resources/responses/responses";
|
| 15 |
|
| 16 |
import type { ChatCompletionChunk } from "openai/resources/chat/completions";
|
|
|
|
| 17 |
export interface ReasoningTextContent {
|
| 18 |
type: "reasoning_text";
|
| 19 |
text: string;
|
| 20 |
}
|
|
|
|
| 21 |
export type PatchedResponseReasoningItem = OpenAIResponseReasoningItem & {
|
| 22 |
// Raw CoT returned in reasoning item (in addition to the summary)
|
| 23 |
content: ReasoningTextContent[];
|
| 24 |
};
|
| 25 |
|
|
|
|
| 26 |
interface PatchedResponseReasoningDeltaEvent {
|
| 27 |
type: "response.reasoning.delta";
|
| 28 |
sequence_number: number;
|
|
|
|
| 1 |
/*
|
| 2 |
+
* This file patches OpenAI SDK types for OpenResponses spec compliance.
|
| 3 |
+
*
|
| 4 |
+
* The OpenAI SDK uses event type names like "response.reasoning_text.delta",
|
| 5 |
+
* but the OpenResponses spec uses "response.reasoning.delta" (without "_text").
|
| 6 |
+
* We maintain custom event types here to match the OpenResponses specification.
|
| 7 |
+
*
|
| 8 |
+
* Once the OpenAI SDK aligns with OpenResponses spec, this file can be simplified.
|
| 9 |
*/
|
| 10 |
import type {
|
| 11 |
ResponseReasoningItem as OpenAIResponseReasoningItem,
|
|
|
|
| 19 |
} from "openai/resources/responses/responses";
|
| 20 |
|
| 21 |
import type { ChatCompletionChunk } from "openai/resources/chat/completions";
|
| 22 |
+
|
| 23 |
export interface ReasoningTextContent {
|
| 24 |
type: "reasoning_text";
|
| 25 |
text: string;
|
| 26 |
}
|
| 27 |
+
|
| 28 |
export type PatchedResponseReasoningItem = OpenAIResponseReasoningItem & {
|
| 29 |
// Raw CoT returned in reasoning item (in addition to the summary)
|
| 30 |
content: ReasoningTextContent[];
|
| 31 |
};
|
| 32 |
|
| 33 |
+
// Custom event types for OpenResponses spec (differs from SDK's "response.reasoning_text.*")
|
| 34 |
interface PatchedResponseReasoningDeltaEvent {
|
| 35 |
type: "response.reasoning.delta";
|
| 36 |
sequence_number: number;
|