@veryfront/ext-llm-openai 0.1.1284 → 0.1.1286-rc.25337
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.
- package/esm/extensions/ext-llm-openai/src/openai-chat-request-builder.d.ts.map +1 -1
- package/esm/extensions/ext-llm-openai/src/openai-chat-request-builder.js +72 -48
- package/esm/extensions/ext-llm-openai/src/openai-responses-request-builder.d.ts.map +1 -1
- package/esm/extensions/ext-llm-openai/src/openai-responses-request-builder.js +0 -2
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-chat-request-builder.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-chat-request-builder.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,2BAA2B,CAAC;AAanC,MAAM,WAAW,+BAAgC,SAAQ,uBAAuB;IAC9E,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACpD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,CAAC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAC9C,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAC3C,CAAC;AAEF,yFAAyF;AACzF,MAAM,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAE/D,KAAK,gBAAgB,GAAG;IACtB,IAAI,CAAC,OAAO,EAAE;QACZ,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT,KAAK,IAAI,KAAK,CAAC;QACb,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;AAUF,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,+BAA+B,EACxC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,gBAAgB,EAC1B,YAAY,CAAC,EAAE,6BAA6B,GAC3C,2BAA2B,
|
|
1
|
+
{"version":3,"file":"openai-chat-request-builder.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-chat-request-builder.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,2BAA2B,CAAC;AAanC,MAAM,WAAW,+BAAgC,SAAQ,uBAAuB;IAC9E,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACpD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,CAAC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAC9C,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAC3C,CAAC;AAEF,yFAAyF;AACzF,MAAM,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAE/D,KAAK,gBAAgB,GAAG;IACtB,IAAI,CAAC,OAAO,EAAE;QACZ,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT,KAAK,IAAI,KAAK,CAAC;QACb,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;AAUF,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,+BAA+B,EACxC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,gBAAgB,EAC1B,YAAY,CAAC,EAAE,6BAA6B,GAC3C,2BAA2B,CAyK7B"}
|
|
@@ -46,7 +46,16 @@ export function buildOpenAIChatRequest(modelId, providerName, options, stream, w
|
|
|
46
46
|
}
|
|
47
47
|
// Reasoning models and models with fixed sampling params
|
|
48
48
|
// reject sampling params outright. Emit warnings.
|
|
49
|
-
|
|
49
|
+
const samplingWarningDetails = (openaiName) => {
|
|
50
|
+
if (fixedSampling)
|
|
51
|
+
return `Dropped because this model uses fixed sampling parameters.`;
|
|
52
|
+
if (samplingRejected)
|
|
53
|
+
return `Dropped because this model rejects ${openaiName}.`;
|
|
54
|
+
return `Dropped because reasoning was active for this request and OpenAI rejects ${openaiName} with reasoning.`;
|
|
55
|
+
};
|
|
56
|
+
const warnDroppedSamplingParams = () => {
|
|
57
|
+
if (!dropSamplingParams)
|
|
58
|
+
return;
|
|
50
59
|
const dropped = [
|
|
51
60
|
["temperature", "temperature"],
|
|
52
61
|
["topP", "top_p"],
|
|
@@ -59,24 +68,20 @@ export function buildOpenAIChatRequest(modelId, providerName, options, stream, w
|
|
|
59
68
|
type: "unsupported-setting",
|
|
60
69
|
provider: "openai",
|
|
61
70
|
setting: key,
|
|
62
|
-
details:
|
|
63
|
-
? `Dropped because this model uses fixed sampling parameters.`
|
|
64
|
-
: samplingRejected
|
|
65
|
-
? `Dropped because this model rejects ${openaiName}.`
|
|
66
|
-
: `Dropped because reasoning was active for this request and OpenAI rejects ${openaiName} with reasoning.`,
|
|
71
|
+
details: samplingWarningDetails(openaiName),
|
|
67
72
|
});
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
?
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
};
|
|
76
|
+
warnDroppedSamplingParams();
|
|
77
|
+
const tokenLimitFields = () => {
|
|
78
|
+
if (options.maxOutputTokens === undefined)
|
|
79
|
+
return {};
|
|
80
|
+
return isNativeOpenAIModel(modelId)
|
|
81
|
+
? { max_completion_tokens: options.maxOutputTokens }
|
|
82
|
+
: { max_tokens: options.maxOutputTokens };
|
|
83
|
+
};
|
|
84
|
+
const samplingAndStopFields = () => ({
|
|
80
85
|
...(!dropSamplingParams && options.temperature !== undefined
|
|
81
86
|
? { temperature: options.temperature }
|
|
82
87
|
: {}),
|
|
@@ -84,23 +89,16 @@ export function buildOpenAIChatRequest(modelId, providerName, options, stream, w
|
|
|
84
89
|
...(options.stopSequences && options.stopSequences.length > 0
|
|
85
90
|
? { stop: [...options.stopSequences] }
|
|
86
91
|
: {}),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
...(options.seed !== undefined ? { seed: options.seed } : {}),
|
|
92
|
+
});
|
|
93
|
+
const penaltyFields = () => ({
|
|
90
94
|
...(!dropSamplingParams && options.presencePenalty !== undefined
|
|
91
95
|
? { presence_penalty: options.presencePenalty }
|
|
92
96
|
: {}),
|
|
93
97
|
...(!dropSamplingParams && options.frequencyPenalty !== undefined
|
|
94
98
|
? { frequency_penalty: options.frequencyPenalty }
|
|
95
99
|
: {}),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
? { user: options.userId }
|
|
99
|
-
: {}),
|
|
100
|
-
...(options.serviceTier !== undefined ? { service_tier: options.serviceTier } : {}),
|
|
101
|
-
...(options.parallelToolCalls !== undefined
|
|
102
|
-
? { parallel_tool_calls: options.parallelToolCalls }
|
|
103
|
-
: {}),
|
|
100
|
+
});
|
|
101
|
+
const responseFormatFields = () => ({
|
|
104
102
|
...(options.responseFormat && options.responseFormat.type !== "text"
|
|
105
103
|
? {
|
|
106
104
|
response_format: options.responseFormat.type === "json" ? { type: "json_object" } : {
|
|
@@ -118,32 +116,58 @@ export function buildOpenAIChatRequest(modelId, providerName, options, stream, w
|
|
|
118
116
|
},
|
|
119
117
|
}
|
|
120
118
|
: {}),
|
|
119
|
+
});
|
|
120
|
+
const userFields = () => ({
|
|
121
|
+
...(typeof options.userId === "string" && options.userId.length > 0
|
|
122
|
+
? { user: options.userId }
|
|
123
|
+
: {}),
|
|
124
|
+
});
|
|
125
|
+
const body = {
|
|
126
|
+
model: modelId,
|
|
127
|
+
messages,
|
|
128
|
+
...(stream ? { stream: true, stream_options: { include_usage: true } } : {}),
|
|
129
|
+
...tokenLimitFields(),
|
|
130
|
+
...samplingAndStopFields(),
|
|
131
|
+
...(tools ? { tools } : {}),
|
|
132
|
+
...(options.toolChoice !== undefined ? { tool_choice: options.toolChoice } : {}),
|
|
133
|
+
...(options.seed !== undefined ? { seed: options.seed } : {}),
|
|
134
|
+
...penaltyFields(),
|
|
135
|
+
...(reasoning !== undefined ? { reasoning_effort: reasoning.effort } : {}),
|
|
136
|
+
...userFields(),
|
|
137
|
+
...(options.serviceTier !== undefined ? { service_tier: options.serviceTier } : {}),
|
|
138
|
+
...(options.parallelToolCalls !== undefined
|
|
139
|
+
? { parallel_tool_calls: options.parallelToolCalls }
|
|
140
|
+
: {}),
|
|
141
|
+
...responseFormatFields(),
|
|
121
142
|
};
|
|
122
143
|
defineOpenAIProviderOptions(body, providerOpts);
|
|
123
144
|
// Provider-native options may tune request behavior, but they must not
|
|
124
145
|
// replace the runtime-owned transport mode, model, or conversation.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
else {
|
|
132
|
-
delete body.stream;
|
|
133
|
-
delete body.stream_options;
|
|
134
|
-
}
|
|
135
|
-
if (suppressReasoningForFunctionTools) {
|
|
136
|
-
if (resolvedReasoning !== undefined || body.reasoning_effort !== undefined) {
|
|
137
|
-
warnings.push({
|
|
138
|
-
type: "unsupported-setting",
|
|
139
|
-
provider: "openai",
|
|
140
|
-
setting: "reasoning",
|
|
141
|
-
details: "Veryfront drops reasoning because this Chat Completions transport " +
|
|
142
|
-
"does not support reasoning alongside function tools.",
|
|
143
|
-
});
|
|
146
|
+
const applyTransportCapabilities = () => {
|
|
147
|
+
body.model = modelId;
|
|
148
|
+
body.messages = messages;
|
|
149
|
+
if (stream) {
|
|
150
|
+
body.stream = true;
|
|
151
|
+
body.stream_options = { include_usage: true };
|
|
144
152
|
}
|
|
145
|
-
|
|
146
|
-
|
|
153
|
+
else {
|
|
154
|
+
delete body.stream;
|
|
155
|
+
delete body.stream_options;
|
|
156
|
+
}
|
|
157
|
+
if (suppressReasoningForFunctionTools) {
|
|
158
|
+
if (resolvedReasoning !== undefined || body.reasoning_effort !== undefined) {
|
|
159
|
+
warnings.push({
|
|
160
|
+
type: "unsupported-setting",
|
|
161
|
+
provider: "openai",
|
|
162
|
+
setting: "reasoning",
|
|
163
|
+
details: "Veryfront drops reasoning because this Chat Completions transport " +
|
|
164
|
+
"does not support reasoning alongside function tools.",
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
delete body.reasoning_effort;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
applyTransportCapabilities();
|
|
147
171
|
return body;
|
|
148
172
|
}
|
|
149
173
|
function hasOpenAIFunctionTools(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-responses-request-builder.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-responses-request-builder.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAyBxF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAA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QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"openai-responses-request-builder.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-responses-request-builder.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAyBxF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,wBAAwB,EAAE,CAAC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,IAAI,CAAC,OAAO,EAAE;QACZ,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT,KAAK,IAAI,KAAK,CAAC;QACb,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;AAogBF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,+BAA+B,EACxC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,gBAAgB,GACzB,sBAAsB,CA8IxB"}
|
|
@@ -368,12 +368,10 @@ function toOpenAIResponsesUserContent(parts) {
|
|
|
368
368
|
throw unsupportedFileInputError("OpenAI Responses", part, "Send a document such as PDF, text, or a spreadsheet.");
|
|
369
369
|
}
|
|
370
370
|
const data = readInlineFileData(part);
|
|
371
|
-
const filename = fileInputBaseName(part.filename);
|
|
372
371
|
content.push(data === undefined
|
|
373
372
|
? {
|
|
374
373
|
type: "input_file",
|
|
375
374
|
file_url: readRemoteFileUrl("OpenAI Responses", part),
|
|
376
|
-
...(filename ? { filename } : {}),
|
|
377
375
|
}
|
|
378
376
|
: toOpenAIResponsesInlineFile(part, data));
|
|
379
377
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veryfront/ext-llm-openai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1286-rc.25337",
|
|
4
4
|
"description": "Veryfront first-party extension package for ext-llm-openai",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"veryfront",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"capabilities": []
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"veryfront": "^0.1.
|
|
48
|
+
"veryfront": "^0.1.1286-rc.25337"
|
|
49
49
|
},
|
|
50
50
|
"type": "module",
|
|
51
51
|
"types": "./esm/extensions/ext-llm-openai/src/index.d.ts",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"NOTICE",
|
|
56
56
|
"README.md"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "1547fd58b8387214c0d1d9c7ebd5367edf98ff29"
|
|
59
59
|
}
|