@xpert-ai/plugin-openai 0.1.0 → 0.2.0
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/README.md +70 -0
- package/dist/index.js +2 -2
- package/dist/llm/_position.yaml +5 -5
- package/dist/llm/gpt-6-astra.yaml +99 -0
- package/dist/llm/gpt-6-luna.yaml +116 -0
- package/dist/llm/gpt-6-sol.yaml +116 -0
- package/dist/llm/gpt-6.1-sol.yaml +99 -0
- package/dist/llm/gpt-6.1-terra.yaml +116 -0
- package/dist/llm/llm.d.ts.map +1 -1
- package/dist/llm/llm.js +3 -6
- package/dist/llm/reasoning.d.ts +2 -0
- package/dist/llm/reasoning.d.ts.map +1 -1
- package/dist/llm/reasoning.js +29 -0
- package/dist/openai.yaml +2 -2
- package/dist/provider.strategy.d.ts.map +1 -1
- package/dist/provider.strategy.js +20 -12
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +28 -3
- package/package.json +2 -2
- package/dist/llm/gpt-5.2-chat.yaml +0 -79
- package/dist/llm/gpt-5.2-codex.yaml +0 -94
- package/dist/llm/gpt-5.4-pro.yaml +0 -64
- package/dist/llm/gpt-5.4.yaml +0 -95
- package/dist/llm/gpt-5.yaml +0 -94
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasoning.d.ts","sourceRoot":"","sources":["../../src/llm/reasoning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,0BAA0B,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"reasoning.d.ts","sourceRoot":"","sources":["../../src/llm/reasoning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,0BAA0B,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAkDrE,qBAAa,6BAA8B,SAAQ,mBAAmB;cACjD,mBAAmB,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,GAAG,YAAY,CAAC,SAAS,GAAG,SAAS;IAQtG,gBAAgB,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,GAAG,UAAU,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;cAShG,qCAAqC,CACtD,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,QAAQ;cAgBxB,wCAAwC,CACzD,KAAK,EAAE,YAAY,CAAC,SAAS,CAAC,mBAAmB,GAChD,mBAAmB,GAAG,IAAI;CAwB9B"}
|
package/dist/llm/reasoning.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChatOpenAIResponses } from '@langchain/openai';
|
|
2
|
+
import { getSupportedOpenAIReasoningEfforts, shouldEnableSamplingParameters } from '../types.js';
|
|
2
3
|
function extractReasoningSummaryText(reasoning) {
|
|
3
4
|
if (!reasoning || typeof reasoning !== 'object') {
|
|
4
5
|
return undefined;
|
|
@@ -22,9 +23,34 @@ function extractReasoningDeltaText(chunk) {
|
|
|
22
23
|
}
|
|
23
24
|
return undefined;
|
|
24
25
|
}
|
|
26
|
+
function normalizeResponseUsage(usage) {
|
|
27
|
+
if (!usage)
|
|
28
|
+
return undefined;
|
|
29
|
+
return {
|
|
30
|
+
...usage,
|
|
31
|
+
...(usage.input_tokens_details ? { input_token_details: { cache_read: usage.input_tokens_details.cached_tokens } } : {}),
|
|
32
|
+
...(usage.output_tokens_details ? { output_token_details: { reasoning: usage.output_tokens_details.reasoning_tokens } } : {})
|
|
33
|
+
};
|
|
34
|
+
}
|
|
25
35
|
export class OpenAIReasoningResponsesModel extends ChatOpenAIResponses {
|
|
36
|
+
_getReasoningParams(options) {
|
|
37
|
+
// LangChain 0.6.9 only recognizes GPT-5/o-series reasoning; use our explicit catalog.
|
|
38
|
+
if (getSupportedOpenAIReasoningEfforts(this.model)) {
|
|
39
|
+
return { ...this.reasoning, ...options?.reasoning };
|
|
40
|
+
}
|
|
41
|
+
return super._getReasoningParams(options);
|
|
42
|
+
}
|
|
43
|
+
invocationParams(options) {
|
|
44
|
+
const params = super.invocationParams(options);
|
|
45
|
+
if (!shouldEnableSamplingParameters('enabled', this.clientConfig.baseURL, this.model, params.reasoning?.effort)) {
|
|
46
|
+
delete params.temperature;
|
|
47
|
+
delete params.top_p;
|
|
48
|
+
}
|
|
49
|
+
return params;
|
|
50
|
+
}
|
|
26
51
|
_convertResponsesMessageToBaseMessage(response) {
|
|
27
52
|
const message = super._convertResponsesMessageToBaseMessage(response);
|
|
53
|
+
message.usage_metadata = normalizeResponseUsage(response.usage);
|
|
28
54
|
const reasoningContent = extractReasoningSummaryText(message.additional_kwargs?.reasoning);
|
|
29
55
|
if (reasoningContent) {
|
|
30
56
|
message.additional_kwargs = {
|
|
@@ -40,6 +66,9 @@ export class OpenAIReasoningResponsesModel extends ChatOpenAIResponses {
|
|
|
40
66
|
return null;
|
|
41
67
|
}
|
|
42
68
|
const message = generationChunk.message;
|
|
69
|
+
if (chunk.type === 'response.completed') {
|
|
70
|
+
message.usage_metadata = normalizeResponseUsage(chunk.response.usage);
|
|
71
|
+
}
|
|
43
72
|
const reasoningContent = extractReasoningDeltaText(chunk) ?? extractReasoningSummaryText(message.additional_kwargs?.reasoning);
|
|
44
73
|
if (reasoningContent) {
|
|
45
74
|
message.additional_kwargs = {
|
package/dist/openai.yaml
CHANGED
|
@@ -3,8 +3,8 @@ label:
|
|
|
3
3
|
en_US: OpenAI
|
|
4
4
|
zh_Hans: OpenAI
|
|
5
5
|
description:
|
|
6
|
-
en_US: OpenAI GPT-
|
|
7
|
-
zh_Hans: OpenAI GPT-
|
|
6
|
+
en_US: OpenAI GPT-6 and GPT-5 model service via Responses API.
|
|
7
|
+
zh_Hans: OpenAI GPT-6 与 GPT-5 模型服务,通过 Responses API 提供。
|
|
8
8
|
icon_small:
|
|
9
9
|
en_US: icon_s_en.svg
|
|
10
10
|
icon_large:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.strategy.d.ts","sourceRoot":"","sources":["../src/provider.strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,wBAAwB,EAAsB,MAAM,sBAAsB,CAAA;AAC9G,OAAO,EAAc,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAGL,aAAa,EACd,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.strategy.d.ts","sourceRoot":"","sources":["../src/provider.strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,wBAAwB,EAAsB,MAAM,sBAAsB,CAAA;AAC9G,OAAO,EAAc,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAGL,aAAa,EACd,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EAEL,iBAAiB,EAGlB,MAAM,YAAY,CAAA;AAuBnB,qBAEa,sBAAuB,SAAQ,aAAa;IAC9C,MAAM,SAA0C;IAEzD,QAAQ,CAAC,oBAAoB,EAAE,wBAAwB,CAStD;IAED,UAAU,CAAC,WAAW,EAAE,iBAAiB,GAAG,MAAM;IAKlD,gBAAgB,CAAC,WAAW,EAAE,iBAAiB,GAAG,MAAM;IAIlD,2BAA2B,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAwCjF"}
|
|
@@ -5,8 +5,8 @@ import { nativeModelTransport } from '@xpert-ai/plugin-sdk';
|
|
|
5
5
|
import { Injectable, Logger } from '@nestjs/common';
|
|
6
6
|
import { AIModelProviderStrategy, CredentialsValidateFailedError, ModelProvider, } from '@xpert-ai/plugin-sdk';
|
|
7
7
|
import { AiModelTypeEnum } from '@xpert-ai/contracts';
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import { OpenAIClient } from '@langchain/openai';
|
|
9
|
+
import { OpenAIProvider, toCredentialKwargs, isOpenAIOfficialBaseUrl, } from './types.js';
|
|
10
10
|
const OpenAIValidationFallbackPatterns = [
|
|
11
11
|
'model is not supported',
|
|
12
12
|
'unsupported model',
|
|
@@ -48,34 +48,42 @@ let OpenAIProviderStrategy = OpenAIProviderStrategy_1 = class OpenAIProviderStra
|
|
|
48
48
|
return `Bearer ${credentials.api_key}`;
|
|
49
49
|
}
|
|
50
50
|
async validateProviderCredentials(credentials) {
|
|
51
|
+
const params = toCredentialKwargs(credentials);
|
|
52
|
+
if (isOpenAIOfficialBaseUrl(params.configuration.baseURL)) {
|
|
53
|
+
// Authentication must not depend on access to an older generation's probe model.
|
|
54
|
+
try {
|
|
55
|
+
const client = new OpenAIClient({ apiKey: params.apiKey, ...params.configuration });
|
|
56
|
+
await client.models.list();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
throw new CredentialsValidateFailedError(error instanceof Error ? error.message : 'OpenAI credentials verification failed');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
51
63
|
const modelInstance = this.getModelManager(AiModelTypeEnum.LLM);
|
|
64
|
+
const models = this.getProviderModels(AiModelTypeEnum.LLM);
|
|
52
65
|
let lastError;
|
|
53
|
-
for (const model of
|
|
66
|
+
for (const { model } of models) {
|
|
54
67
|
try {
|
|
55
68
|
await modelInstance.validateCredentials(model, credentials);
|
|
56
69
|
return;
|
|
57
70
|
}
|
|
58
71
|
catch (ex) {
|
|
59
|
-
lastError = ex;
|
|
60
72
|
if (!shouldRetryWithNextValidationModel(ex)) {
|
|
61
73
|
if (ex instanceof CredentialsValidateFailedError) {
|
|
62
74
|
throw ex;
|
|
63
75
|
}
|
|
64
76
|
else {
|
|
65
|
-
this.logger.error(`${this.getProviderSchema().provider}: credentials verification failed`, ex
|
|
77
|
+
this.logger.error(`${this.getProviderSchema().provider}: credentials verification failed`, ex instanceof Error ? ex.stack : undefined);
|
|
66
78
|
throw ex;
|
|
67
79
|
}
|
|
68
80
|
}
|
|
81
|
+
if (ex instanceof CredentialsValidateFailedError)
|
|
82
|
+
lastError = ex;
|
|
69
83
|
this.logger.warn(`${this.getProviderSchema().provider}: validation model '${model}' unavailable, trying next candidate`);
|
|
70
84
|
}
|
|
71
85
|
}
|
|
72
|
-
|
|
73
|
-
throw lastError;
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
this.logger.error(`${this.getProviderSchema().provider}: credentials verification failed`, lastError?.stack);
|
|
77
|
-
throw lastError;
|
|
78
|
-
}
|
|
86
|
+
throw lastError ?? new CredentialsValidateFailedError('No OpenAI models are available for credentials verification');
|
|
79
87
|
}
|
|
80
88
|
};
|
|
81
89
|
OpenAIProviderStrategy = OpenAIProviderStrategy_1 = __decorate([
|
package/dist/types.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export interface OpenAICredentials {
|
|
|
9
9
|
endpoint_url?: string;
|
|
10
10
|
sampling_parameters?: 'auto' | 'enabled' | 'disabled';
|
|
11
11
|
}
|
|
12
|
-
export type OpenAIReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
13
|
-
export interface OpenAIModelOptions extends CommonChatModelParameters {
|
|
12
|
+
export type OpenAIReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
13
|
+
export interface OpenAIModelOptions extends Partial<CommonChatModelParameters> {
|
|
14
14
|
streaming?: boolean;
|
|
15
15
|
top_p?: number;
|
|
16
16
|
max_tokens?: number;
|
|
@@ -24,7 +24,7 @@ export declare function isOpenAIOfficialBaseUrl(baseURL?: string): boolean;
|
|
|
24
24
|
export declare function isOpenAIGPT5ProModel(model?: string): boolean;
|
|
25
25
|
export declare function getSupportedOpenAIReasoningEfforts(model?: string): readonly OpenAIReasoningEffort[] | undefined;
|
|
26
26
|
export declare function normalizeOpenAIReasoningEffort(model?: string, effort?: OpenAIReasoningEffort): OpenAIReasoningEffort | undefined;
|
|
27
|
-
export declare function shouldEnableSamplingParameters(mode: OpenAICredentials['sampling_parameters'], baseURL?: string, model?: string): boolean;
|
|
27
|
+
export declare function shouldEnableSamplingParameters(mode: OpenAICredentials['sampling_parameters'], baseURL?: string, model?: string, reasoningEffort?: OpenAIReasoningEffort): boolean;
|
|
28
28
|
export declare function shouldEnableResponseFormat(baseURL?: string, model?: string): boolean;
|
|
29
29
|
export declare function normalizeOpenAIMaxTokens(maxTokens?: number, baseURL?: string): number | undefined;
|
|
30
30
|
export declare function toCredentialKwargs(credentials: OpenAICredentials): {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAmB,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAOhE,eAAO,MAAM,cAAc,WAAW,CAAA;AACtC,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAC/D,eAAO,MAAM,8BAA8B,KAAK,CAAA;AAIhD,eAAO,MAAM,OAAO,QAAiE,CAAA;AAErF,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;CACrD;AAED,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAmB,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAOhE,eAAO,MAAM,cAAc,WAAW,CAAA;AACtC,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAC/D,eAAO,MAAM,8BAA8B,KAAK,CAAA;AAIhD,eAAO,MAAM,OAAO,QAAiE,CAAA;AAErF,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;CACrD;AAED,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAA;AA+CpG,MAAM,WAAW,kBAAmB,SAAQ,OAAO,CAAC,yBAAyB,CAAC;IAC7E,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,qBAAqB,CAAA;IACxC,eAAe,CAAC,EAAE,MAAM,GAAG,aAAa,CAAA;CACxC;AAID,wBAAgB,sBAAsB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAuBnE;AAED,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAWjE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,wBAAgB,kCAAkC,CACjD,KAAK,CAAC,EAAE,MAAM,GACZ,SAAS,qBAAqB,EAAE,GAAG,SAAS,CAO9C;AAED,wBAAgB,8BAA8B,CAC7C,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,qBAAqB,GAC5B,qBAAqB,GAAG,SAAS,CA+BnC;AAED,wBAAgB,8BAA8B,CAC7C,IAAI,EAAE,iBAAiB,CAAC,qBAAqB,CAAC,EAC9C,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,qBAAqB,GACrC,OAAO,CAuBT;AAED,wBAAgB,0BAA0B,CACzC,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GACZ,OAAO,CAMT;AAED,wBAAgB,wBAAwB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUjG;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EAYhE"}
|
package/dist/types.js
CHANGED
|
@@ -8,6 +8,16 @@ export const OpenAIResponsesMinOutputTokens = 16;
|
|
|
8
8
|
const OpenAIApiVersionPath = '/v1';
|
|
9
9
|
const OpenAIOfficialHost = 'api.openai.com';
|
|
10
10
|
export const SvgIcon = readFileSync(join(moduleDir, '_assets/icon_s_en.svg'), 'utf8');
|
|
11
|
+
const OpenAICurrentModelProfiles = [
|
|
12
|
+
{ model: 'gpt-6-astra', supported: ['low', 'medium', 'high', 'xhigh', 'max'], defaultEffort: 'medium' },
|
|
13
|
+
{ model: 'gpt-6.1-sol', supported: ['low', 'medium', 'high', 'xhigh', 'max'], defaultEffort: 'medium' },
|
|
14
|
+
{ model: 'gpt-6.1-terra', supported: ['none', 'low', 'medium', 'high', 'xhigh', 'max'], defaultEffort: 'medium' },
|
|
15
|
+
{ model: 'gpt-6-luna', supported: ['none', 'low', 'medium', 'high', 'xhigh', 'max'], defaultEffort: 'medium' },
|
|
16
|
+
{ model: 'gpt-6-sol', supported: ['none', 'low', 'medium', 'high', 'xhigh', 'max'], defaultEffort: 'medium' },
|
|
17
|
+
];
|
|
18
|
+
function getCurrentModelProfile(model) {
|
|
19
|
+
return OpenAICurrentModelProfiles.find((profile) => profile.model === model?.trim());
|
|
20
|
+
}
|
|
11
21
|
const OpenAIReasoningEffortScale = [
|
|
12
22
|
'none',
|
|
13
23
|
'minimal',
|
|
@@ -15,6 +25,7 @@ const OpenAIReasoningEffortScale = [
|
|
|
15
25
|
'medium',
|
|
16
26
|
'high',
|
|
17
27
|
'xhigh',
|
|
28
|
+
'max',
|
|
18
29
|
];
|
|
19
30
|
const OpenAIReasoningEffortProfiles = [
|
|
20
31
|
{
|
|
@@ -76,11 +87,16 @@ export function getSupportedOpenAIReasoningEfforts(model) {
|
|
|
76
87
|
if (!model?.trim()) {
|
|
77
88
|
return undefined;
|
|
78
89
|
}
|
|
79
|
-
return
|
|
90
|
+
return getCurrentModelProfile(model)?.supported ??
|
|
91
|
+
OpenAIReasoningEffortProfiles.find(({ pattern }) => pattern.test(model.trim()))?.supported;
|
|
80
92
|
}
|
|
81
93
|
export function normalizeOpenAIReasoningEffort(model, effort) {
|
|
94
|
+
const currentProfile = getCurrentModelProfile(model);
|
|
82
95
|
if (!effort) {
|
|
83
|
-
return
|
|
96
|
+
return currentProfile?.defaultEffort;
|
|
97
|
+
}
|
|
98
|
+
if (currentProfile && effort === 'minimal') {
|
|
99
|
+
return 'low';
|
|
84
100
|
}
|
|
85
101
|
const supported = getSupportedOpenAIReasoningEfforts(model);
|
|
86
102
|
if (!supported?.length) {
|
|
@@ -101,7 +117,16 @@ export function normalizeOpenAIReasoningEffort(model, effort) {
|
|
|
101
117
|
return candidateDistance < closestDistance ? candidate : closest;
|
|
102
118
|
});
|
|
103
119
|
}
|
|
104
|
-
export function shouldEnableSamplingParameters(mode, baseURL, model) {
|
|
120
|
+
export function shouldEnableSamplingParameters(mode, baseURL, model, reasoningEffort) {
|
|
121
|
+
// An endpoint override must not send parameters forbidden by the official model contract.
|
|
122
|
+
// GPT-5.2 and GPT-5.4 default to none when the request omits reasoning effort.
|
|
123
|
+
const defaultsToNone = model?.trim() === 'gpt-5.2' || model?.trim() === 'gpt-5.4';
|
|
124
|
+
const effectiveEffort = normalizeOpenAIReasoningEffort(model, reasoningEffort) ??
|
|
125
|
+
(defaultsToNone ? 'none' : undefined);
|
|
126
|
+
if (isOpenAIOfficialBaseUrl(baseURL) && getSupportedOpenAIReasoningEfforts(model) &&
|
|
127
|
+
effectiveEffort !== 'none') {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
105
130
|
if (mode === 'enabled') {
|
|
106
131
|
return true;
|
|
107
132
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpert-ai/plugin-openai",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "OpenAI GPT-5 model plugin for XpertAI platform using Responses API",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "OpenAI GPT-6 and GPT-5 model plugin for XpertAI platform using Responses API",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "XpertAI",
|
|
7
7
|
"url": "https://xpertai.cn"
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
native_protocols:
|
|
2
|
-
- openai_responses
|
|
3
|
-
model: gpt-5.2-chat
|
|
4
|
-
label:
|
|
5
|
-
en_US: GPT-5.2 Chat
|
|
6
|
-
zh_Hans: GPT-5.2 Chat
|
|
7
|
-
model_type: llm
|
|
8
|
-
features:
|
|
9
|
-
- agent-thought
|
|
10
|
-
- tool-call
|
|
11
|
-
- multi-tool-call
|
|
12
|
-
- stream-tool-call
|
|
13
|
-
- structured-output
|
|
14
|
-
- vision
|
|
15
|
-
model_properties:
|
|
16
|
-
mode: chat
|
|
17
|
-
context_size: 128000
|
|
18
|
-
max_output: 16384
|
|
19
|
-
parameter_rules:
|
|
20
|
-
- name: temperature
|
|
21
|
-
use_template: temperature
|
|
22
|
-
default: 1
|
|
23
|
-
min: 0.0
|
|
24
|
-
max: 2.0
|
|
25
|
-
help:
|
|
26
|
-
zh_Hans: 采样温度,控制输出的随机性。
|
|
27
|
-
en_US: Sampling temperature, controls the randomness of the output.
|
|
28
|
-
- name: max_tokens
|
|
29
|
-
use_template: max_tokens
|
|
30
|
-
default: 4096
|
|
31
|
-
min: 16
|
|
32
|
-
max: 16384
|
|
33
|
-
help:
|
|
34
|
-
zh_Hans: 最大输出 token 数量。
|
|
35
|
-
en_US: Maximum number of output tokens.
|
|
36
|
-
- name: top_p
|
|
37
|
-
use_template: top_p
|
|
38
|
-
default: 1
|
|
39
|
-
min: 0.0
|
|
40
|
-
max: 1.0
|
|
41
|
-
help:
|
|
42
|
-
zh_Hans: 核采样参数,控制输出的多样性。
|
|
43
|
-
en_US: Nucleus sampling parameter, controls output diversity.
|
|
44
|
-
- name: frequency_penalty
|
|
45
|
-
use_template: frequency_penalty
|
|
46
|
-
default: 0
|
|
47
|
-
min: -2.0
|
|
48
|
-
max: 2.0
|
|
49
|
-
help:
|
|
50
|
-
zh_Hans: 降低重复内容的出现频率。
|
|
51
|
-
en_US: Reduces repetition in the output.
|
|
52
|
-
- name: presence_penalty
|
|
53
|
-
label:
|
|
54
|
-
zh_Hans: 存在惩罚
|
|
55
|
-
en_US: Presence Penalty
|
|
56
|
-
type: float
|
|
57
|
-
default: 0
|
|
58
|
-
min: -2.0
|
|
59
|
-
max: 2.0
|
|
60
|
-
help:
|
|
61
|
-
zh_Hans: 提高讨论新话题的可能性。
|
|
62
|
-
en_US: Increases the likelihood of discussing new topics.
|
|
63
|
-
- name: response_format
|
|
64
|
-
label:
|
|
65
|
-
zh_Hans: 回复格式
|
|
66
|
-
en_US: Response Format
|
|
67
|
-
type: string
|
|
68
|
-
help:
|
|
69
|
-
zh_Hans: 指定模型必须输出的格式。
|
|
70
|
-
en_US: Specifying the format that the model must output.
|
|
71
|
-
required: false
|
|
72
|
-
options:
|
|
73
|
-
- text
|
|
74
|
-
- json_object
|
|
75
|
-
pricing:
|
|
76
|
-
input: '1.75'
|
|
77
|
-
output: '14'
|
|
78
|
-
unit: '0.000001'
|
|
79
|
-
currency: USD
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
native_protocols:
|
|
2
|
-
- openai_responses
|
|
3
|
-
model: gpt-5.2-codex
|
|
4
|
-
label:
|
|
5
|
-
en_US: GPT-5.2 Codex
|
|
6
|
-
zh_Hans: GPT-5.2 Codex
|
|
7
|
-
model_type: llm
|
|
8
|
-
features:
|
|
9
|
-
- agent-thought
|
|
10
|
-
- tool-call
|
|
11
|
-
- multi-tool-call
|
|
12
|
-
- stream-tool-call
|
|
13
|
-
- structured-output
|
|
14
|
-
- vision
|
|
15
|
-
model_properties:
|
|
16
|
-
mode: chat
|
|
17
|
-
context_size: 400000
|
|
18
|
-
max_output: 128000
|
|
19
|
-
parameter_rules:
|
|
20
|
-
- name: temperature
|
|
21
|
-
use_template: temperature
|
|
22
|
-
default: 1
|
|
23
|
-
min: 0.0
|
|
24
|
-
max: 2.0
|
|
25
|
-
help:
|
|
26
|
-
zh_Hans: 采样温度,控制输出的随机性。
|
|
27
|
-
en_US: Sampling temperature, controls the randomness of the output.
|
|
28
|
-
- name: max_tokens
|
|
29
|
-
use_template: max_tokens
|
|
30
|
-
default: 32768
|
|
31
|
-
min: 16
|
|
32
|
-
max: 128000
|
|
33
|
-
help:
|
|
34
|
-
zh_Hans: 最大输出 token 数量。
|
|
35
|
-
en_US: Maximum number of output tokens.
|
|
36
|
-
- name: top_p
|
|
37
|
-
use_template: top_p
|
|
38
|
-
default: 1
|
|
39
|
-
min: 0.0
|
|
40
|
-
max: 1.0
|
|
41
|
-
help:
|
|
42
|
-
zh_Hans: 核采样参数,控制输出的多样性。
|
|
43
|
-
en_US: Nucleus sampling parameter, controls output diversity.
|
|
44
|
-
- name: reasoning_effort
|
|
45
|
-
label:
|
|
46
|
-
zh_Hans: 推理力度
|
|
47
|
-
en_US: Reasoning Effort
|
|
48
|
-
type: string
|
|
49
|
-
required: false
|
|
50
|
-
default: medium
|
|
51
|
-
options:
|
|
52
|
-
- low
|
|
53
|
-
- medium
|
|
54
|
-
- high
|
|
55
|
-
- xhigh
|
|
56
|
-
help:
|
|
57
|
-
zh_Hans: 控制模型推理的深度。xhigh 提供最深推理,适合更复杂的编码任务。
|
|
58
|
-
en_US: Controls how much reasoning effort the model uses. xhigh provides the deepest reasoning for more complex coding tasks.
|
|
59
|
-
- name: frequency_penalty
|
|
60
|
-
use_template: frequency_penalty
|
|
61
|
-
default: 0
|
|
62
|
-
min: -2.0
|
|
63
|
-
max: 2.0
|
|
64
|
-
help:
|
|
65
|
-
zh_Hans: 降低重复内容的出现频率。
|
|
66
|
-
en_US: Reduces repetition in the output.
|
|
67
|
-
- name: presence_penalty
|
|
68
|
-
label:
|
|
69
|
-
zh_Hans: 存在惩罚
|
|
70
|
-
en_US: Presence Penalty
|
|
71
|
-
type: float
|
|
72
|
-
default: 0
|
|
73
|
-
min: -2.0
|
|
74
|
-
max: 2.0
|
|
75
|
-
help:
|
|
76
|
-
zh_Hans: 提高讨论新话题的可能性。
|
|
77
|
-
en_US: Increases the likelihood of discussing new topics.
|
|
78
|
-
- name: response_format
|
|
79
|
-
label:
|
|
80
|
-
zh_Hans: 回复格式
|
|
81
|
-
en_US: Response Format
|
|
82
|
-
type: string
|
|
83
|
-
help:
|
|
84
|
-
zh_Hans: 指定模型必须输出的格式。
|
|
85
|
-
en_US: Specifying the format that the model must output.
|
|
86
|
-
required: false
|
|
87
|
-
options:
|
|
88
|
-
- text
|
|
89
|
-
- json_object
|
|
90
|
-
pricing:
|
|
91
|
-
input: '1.75'
|
|
92
|
-
output: '14'
|
|
93
|
-
unit: '0.000001'
|
|
94
|
-
currency: USD
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
native_protocols:
|
|
2
|
-
- openai_responses
|
|
3
|
-
model: gpt-5.4-pro
|
|
4
|
-
label:
|
|
5
|
-
en_US: GPT-5.4 Pro
|
|
6
|
-
zh_Hans: GPT-5.4 Pro
|
|
7
|
-
model_type: llm
|
|
8
|
-
features:
|
|
9
|
-
- agent-thought
|
|
10
|
-
- tool-call
|
|
11
|
-
- multi-tool-call
|
|
12
|
-
- stream-tool-call
|
|
13
|
-
- vision
|
|
14
|
-
model_properties:
|
|
15
|
-
mode: chat
|
|
16
|
-
context_size: 400000
|
|
17
|
-
max_output: 128000
|
|
18
|
-
parameter_rules:
|
|
19
|
-
- name: max_tokens
|
|
20
|
-
use_template: max_tokens
|
|
21
|
-
default: 32768
|
|
22
|
-
min: 16
|
|
23
|
-
max: 128000
|
|
24
|
-
help:
|
|
25
|
-
zh_Hans: 最大输出 token 数量。
|
|
26
|
-
en_US: Maximum number of output tokens.
|
|
27
|
-
- name: reasoning_effort
|
|
28
|
-
label:
|
|
29
|
-
zh_Hans: 推理力度
|
|
30
|
-
en_US: Reasoning Effort
|
|
31
|
-
type: string
|
|
32
|
-
required: false
|
|
33
|
-
default: medium
|
|
34
|
-
options:
|
|
35
|
-
- medium
|
|
36
|
-
- high
|
|
37
|
-
- xhigh
|
|
38
|
-
help:
|
|
39
|
-
zh_Hans: 控制模型推理的深度。Pro 模型从 medium 起步,xhigh 适合最复杂的问题。
|
|
40
|
-
en_US: Controls how much reasoning effort the model uses. Pro models start at medium, while xhigh is best for the hardest problems.
|
|
41
|
-
- name: frequency_penalty
|
|
42
|
-
use_template: frequency_penalty
|
|
43
|
-
default: 0
|
|
44
|
-
min: -2.0
|
|
45
|
-
max: 2.0
|
|
46
|
-
help:
|
|
47
|
-
zh_Hans: 降低重复内容的出现频率。
|
|
48
|
-
en_US: Reduces repetition in the output.
|
|
49
|
-
- name: presence_penalty
|
|
50
|
-
label:
|
|
51
|
-
zh_Hans: 存在惩罚
|
|
52
|
-
en_US: Presence Penalty
|
|
53
|
-
type: float
|
|
54
|
-
default: 0
|
|
55
|
-
min: -2.0
|
|
56
|
-
max: 2.0
|
|
57
|
-
help:
|
|
58
|
-
zh_Hans: 提高讨论新话题的可能性。
|
|
59
|
-
en_US: Increases the likelihood of discussing new topics.
|
|
60
|
-
pricing:
|
|
61
|
-
input: '25'
|
|
62
|
-
output: '200'
|
|
63
|
-
unit: '0.000001'
|
|
64
|
-
currency: USD
|
package/dist/llm/gpt-5.4.yaml
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
native_protocols:
|
|
2
|
-
- openai_responses
|
|
3
|
-
model: gpt-5.4
|
|
4
|
-
label:
|
|
5
|
-
en_US: GPT-5.4
|
|
6
|
-
zh_Hans: GPT-5.4
|
|
7
|
-
model_type: llm
|
|
8
|
-
features:
|
|
9
|
-
- agent-thought
|
|
10
|
-
- tool-call
|
|
11
|
-
- multi-tool-call
|
|
12
|
-
- stream-tool-call
|
|
13
|
-
- structured-output
|
|
14
|
-
- vision
|
|
15
|
-
model_properties:
|
|
16
|
-
mode: chat
|
|
17
|
-
context_size: 400000
|
|
18
|
-
max_output: 128000
|
|
19
|
-
parameter_rules:
|
|
20
|
-
- name: temperature
|
|
21
|
-
use_template: temperature
|
|
22
|
-
default: 1
|
|
23
|
-
min: 0.0
|
|
24
|
-
max: 2.0
|
|
25
|
-
help:
|
|
26
|
-
zh_Hans: 采样温度,控制输出的随机性。
|
|
27
|
-
en_US: Sampling temperature, controls the randomness of the output.
|
|
28
|
-
- name: max_tokens
|
|
29
|
-
use_template: max_tokens
|
|
30
|
-
default: 32768
|
|
31
|
-
min: 16
|
|
32
|
-
max: 128000
|
|
33
|
-
help:
|
|
34
|
-
zh_Hans: 最大输出 token 数量。GPT-5.4 支持最大 128K 输出。
|
|
35
|
-
en_US: Maximum number of output tokens. GPT-5.4 supports up to 128K output.
|
|
36
|
-
- name: top_p
|
|
37
|
-
use_template: top_p
|
|
38
|
-
default: 1
|
|
39
|
-
min: 0.0
|
|
40
|
-
max: 1.0
|
|
41
|
-
help:
|
|
42
|
-
zh_Hans: 核采样参数,控制输出的多样性。
|
|
43
|
-
en_US: Nucleus sampling parameter, controls output diversity.
|
|
44
|
-
- name: reasoning_effort
|
|
45
|
-
label:
|
|
46
|
-
zh_Hans: 推理力度
|
|
47
|
-
en_US: Reasoning Effort
|
|
48
|
-
type: string
|
|
49
|
-
required: false
|
|
50
|
-
default: none
|
|
51
|
-
options:
|
|
52
|
-
- none
|
|
53
|
-
- low
|
|
54
|
-
- medium
|
|
55
|
-
- high
|
|
56
|
-
- xhigh
|
|
57
|
-
help:
|
|
58
|
-
zh_Hans: 控制模型推理的深度。none 为默认值,xhigh 提供最深推理但通常延迟更高。
|
|
59
|
-
en_US: Controls how much reasoning effort the model uses. none is the default, while xhigh provides the deepest reasoning at higher latency.
|
|
60
|
-
- name: frequency_penalty
|
|
61
|
-
use_template: frequency_penalty
|
|
62
|
-
default: 0
|
|
63
|
-
min: -2.0
|
|
64
|
-
max: 2.0
|
|
65
|
-
help:
|
|
66
|
-
zh_Hans: 降低重复内容的出现频率。
|
|
67
|
-
en_US: Reduces repetition in the output.
|
|
68
|
-
- name: presence_penalty
|
|
69
|
-
label:
|
|
70
|
-
zh_Hans: 存在惩罚
|
|
71
|
-
en_US: Presence Penalty
|
|
72
|
-
type: float
|
|
73
|
-
default: 0
|
|
74
|
-
min: -2.0
|
|
75
|
-
max: 2.0
|
|
76
|
-
help:
|
|
77
|
-
zh_Hans: 提高讨论新话题的可能性。
|
|
78
|
-
en_US: Increases the likelihood of discussing new topics.
|
|
79
|
-
- name: response_format
|
|
80
|
-
label:
|
|
81
|
-
zh_Hans: 回复格式
|
|
82
|
-
en_US: Response Format
|
|
83
|
-
type: string
|
|
84
|
-
help:
|
|
85
|
-
zh_Hans: 指定模型必须输出的格式。
|
|
86
|
-
en_US: Specifying the format that the model must output.
|
|
87
|
-
required: false
|
|
88
|
-
options:
|
|
89
|
-
- text
|
|
90
|
-
- json_object
|
|
91
|
-
pricing:
|
|
92
|
-
input: '2'
|
|
93
|
-
output: '16'
|
|
94
|
-
unit: '0.000001'
|
|
95
|
-
currency: USD
|
package/dist/llm/gpt-5.yaml
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
native_protocols:
|
|
2
|
-
- openai_responses
|
|
3
|
-
model: gpt-5
|
|
4
|
-
label:
|
|
5
|
-
en_US: GPT-5
|
|
6
|
-
zh_Hans: GPT-5
|
|
7
|
-
model_type: llm
|
|
8
|
-
features:
|
|
9
|
-
- agent-thought
|
|
10
|
-
- tool-call
|
|
11
|
-
- multi-tool-call
|
|
12
|
-
- stream-tool-call
|
|
13
|
-
- structured-output
|
|
14
|
-
- vision
|
|
15
|
-
model_properties:
|
|
16
|
-
mode: chat
|
|
17
|
-
context_size: 400000
|
|
18
|
-
max_output: 128000
|
|
19
|
-
parameter_rules:
|
|
20
|
-
- name: temperature
|
|
21
|
-
use_template: temperature
|
|
22
|
-
default: 1
|
|
23
|
-
min: 0.0
|
|
24
|
-
max: 2.0
|
|
25
|
-
help:
|
|
26
|
-
zh_Hans: 采样温度,控制输出的随机性。
|
|
27
|
-
en_US: Sampling temperature, controls the randomness of the output.
|
|
28
|
-
- name: max_tokens
|
|
29
|
-
use_template: max_tokens
|
|
30
|
-
default: 32768
|
|
31
|
-
min: 16
|
|
32
|
-
max: 128000
|
|
33
|
-
help:
|
|
34
|
-
zh_Hans: 最大输出 token 数量。GPT-5 支持最大 128K 输出。
|
|
35
|
-
en_US: Maximum number of output tokens. GPT-5 supports up to 128K output.
|
|
36
|
-
- name: top_p
|
|
37
|
-
use_template: top_p
|
|
38
|
-
default: 1
|
|
39
|
-
min: 0.0
|
|
40
|
-
max: 1.0
|
|
41
|
-
help:
|
|
42
|
-
zh_Hans: 核采样参数,控制输出的多样性。
|
|
43
|
-
en_US: Nucleus sampling parameter, controls output diversity.
|
|
44
|
-
- name: reasoning_effort
|
|
45
|
-
label:
|
|
46
|
-
zh_Hans: 推理力度
|
|
47
|
-
en_US: Reasoning Effort
|
|
48
|
-
type: string
|
|
49
|
-
required: false
|
|
50
|
-
default: medium
|
|
51
|
-
options:
|
|
52
|
-
- minimal
|
|
53
|
-
- low
|
|
54
|
-
- medium
|
|
55
|
-
- high
|
|
56
|
-
help:
|
|
57
|
-
zh_Hans: 控制模型推理的深度。high 提供最深度的推理,minimal 适合更快的响应。
|
|
58
|
-
en_US: Controls how much reasoning effort the model uses. high provides the deepest reasoning, while minimal favors faster responses.
|
|
59
|
-
- name: frequency_penalty
|
|
60
|
-
use_template: frequency_penalty
|
|
61
|
-
default: 0
|
|
62
|
-
min: -2.0
|
|
63
|
-
max: 2.0
|
|
64
|
-
help:
|
|
65
|
-
zh_Hans: 降低重复内容的出现频率。
|
|
66
|
-
en_US: Reduces repetition in the output.
|
|
67
|
-
- name: presence_penalty
|
|
68
|
-
label:
|
|
69
|
-
zh_Hans: 存在惩罚
|
|
70
|
-
en_US: Presence Penalty
|
|
71
|
-
type: float
|
|
72
|
-
default: 0
|
|
73
|
-
min: -2.0
|
|
74
|
-
max: 2.0
|
|
75
|
-
help:
|
|
76
|
-
zh_Hans: 提高讨论新话题的可能性。
|
|
77
|
-
en_US: Increases the likelihood of discussing new topics.
|
|
78
|
-
- name: response_format
|
|
79
|
-
label:
|
|
80
|
-
zh_Hans: 回复格式
|
|
81
|
-
en_US: Response Format
|
|
82
|
-
type: string
|
|
83
|
-
help:
|
|
84
|
-
zh_Hans: 指定模型必须输出的格式。
|
|
85
|
-
en_US: Specifying the format that the model must output.
|
|
86
|
-
required: false
|
|
87
|
-
options:
|
|
88
|
-
- text
|
|
89
|
-
- json_object
|
|
90
|
-
pricing:
|
|
91
|
-
input: '1.25'
|
|
92
|
-
output: '10'
|
|
93
|
-
unit: '0.000001'
|
|
94
|
-
currency: USD
|