@xpert-ai/plugin-openai 0.0.1 → 0.0.3
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/dist/index.js +2 -2
- package/dist/llm/_position.yaml +3 -0
- package/dist/llm/gpt-5.2-codex.yaml +3 -3
- package/dist/llm/gpt-5.2-pro.yaml +4 -32
- package/dist/llm/gpt-5.2.yaml +3 -3
- package/dist/llm/gpt-5.3-codex.yaml +3 -3
- package/dist/llm/gpt-5.4-pro.yaml +63 -0
- package/dist/llm/gpt-5.4.yaml +92 -0
- package/dist/llm/gpt-5.yaml +92 -0
- package/dist/llm/llm.d.ts.map +1 -1
- package/dist/llm/llm.js +11 -4
- package/dist/openai.yaml +2 -2
- package/dist/provider.strategy.js +1 -1
- package/dist/types.d.ts +5 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17,8 +17,8 @@ const plugin = {
|
|
|
17
17
|
value: SvgIcon,
|
|
18
18
|
},
|
|
19
19
|
displayName: 'OpenAI',
|
|
20
|
-
description: 'Provide OpenAI GPT-5
|
|
21
|
-
keywords: ['OpenAI', 'GPT-5', 'model', 'llm', 'reasoning', 'Responses API'],
|
|
20
|
+
description: 'Provide OpenAI GPT-5 and GPT-5.4 models via Responses API',
|
|
21
|
+
keywords: ['OpenAI', 'GPT-5', 'GPT-5.4', 'model', 'llm', 'reasoning', 'Responses API'],
|
|
22
22
|
author: 'XpertAI Team',
|
|
23
23
|
},
|
|
24
24
|
config: {
|
package/dist/llm/_position.yaml
CHANGED
|
@@ -47,13 +47,13 @@ parameter_rules:
|
|
|
47
47
|
required: false
|
|
48
48
|
default: medium
|
|
49
49
|
options:
|
|
50
|
+
- minimal
|
|
50
51
|
- low
|
|
51
52
|
- medium
|
|
52
53
|
- high
|
|
53
|
-
- xhigh
|
|
54
54
|
help:
|
|
55
|
-
zh_Hans: 控制模型推理的深度。
|
|
56
|
-
en_US: Controls how much reasoning effort the model uses.
|
|
55
|
+
zh_Hans: 控制模型推理的深度。high 提供最深度的推理,minimal 适合更快的响应。
|
|
56
|
+
en_US: Controls how much reasoning effort the model uses. high provides the deepest reasoning, while minimal favors faster responses.
|
|
57
57
|
- name: frequency_penalty
|
|
58
58
|
use_template: frequency_penalty
|
|
59
59
|
default: 0
|
|
@@ -8,21 +8,12 @@ features:
|
|
|
8
8
|
- tool-call
|
|
9
9
|
- multi-tool-call
|
|
10
10
|
- stream-tool-call
|
|
11
|
-
- structured-output
|
|
12
11
|
- vision
|
|
13
12
|
model_properties:
|
|
14
13
|
mode: chat
|
|
15
14
|
context_size: 400000
|
|
16
15
|
max_output: 128000
|
|
17
16
|
parameter_rules:
|
|
18
|
-
- name: temperature
|
|
19
|
-
use_template: temperature
|
|
20
|
-
default: 1
|
|
21
|
-
min: 0.0
|
|
22
|
-
max: 2.0
|
|
23
|
-
help:
|
|
24
|
-
zh_Hans: 采样温度,控制输出的随机性。
|
|
25
|
-
en_US: Sampling temperature, controls the randomness of the output.
|
|
26
17
|
- name: max_tokens
|
|
27
18
|
use_template: max_tokens
|
|
28
19
|
default: 32768
|
|
@@ -31,14 +22,6 @@ parameter_rules:
|
|
|
31
22
|
help:
|
|
32
23
|
zh_Hans: 最大输出 token 数量。
|
|
33
24
|
en_US: Maximum number of output tokens.
|
|
34
|
-
- name: top_p
|
|
35
|
-
use_template: top_p
|
|
36
|
-
default: 1
|
|
37
|
-
min: 0.0
|
|
38
|
-
max: 1.0
|
|
39
|
-
help:
|
|
40
|
-
zh_Hans: 核采样参数,控制输出的多样性。
|
|
41
|
-
en_US: Nucleus sampling parameter, controls output diversity.
|
|
42
25
|
- name: reasoning_effort
|
|
43
26
|
label:
|
|
44
27
|
zh_Hans: 推理力度
|
|
@@ -47,12 +30,13 @@ parameter_rules:
|
|
|
47
30
|
required: false
|
|
48
31
|
default: medium
|
|
49
32
|
options:
|
|
33
|
+
- minimal
|
|
34
|
+
- low
|
|
50
35
|
- medium
|
|
51
36
|
- high
|
|
52
|
-
- xhigh
|
|
53
37
|
help:
|
|
54
|
-
zh_Hans: 控制模型推理的深度。
|
|
55
|
-
en_US: Controls how much reasoning effort the model uses.
|
|
38
|
+
zh_Hans: 控制模型推理的深度。high 提供最深度的推理,minimal 适合更快的响应。
|
|
39
|
+
en_US: Controls how much reasoning effort the model uses. high provides the deepest reasoning, while minimal favors faster responses.
|
|
56
40
|
- name: frequency_penalty
|
|
57
41
|
use_template: frequency_penalty
|
|
58
42
|
default: 0
|
|
@@ -72,18 +56,6 @@ parameter_rules:
|
|
|
72
56
|
help:
|
|
73
57
|
zh_Hans: 提高讨论新话题的可能性。
|
|
74
58
|
en_US: Increases the likelihood of discussing new topics.
|
|
75
|
-
- name: response_format
|
|
76
|
-
label:
|
|
77
|
-
zh_Hans: 回复格式
|
|
78
|
-
en_US: Response Format
|
|
79
|
-
type: string
|
|
80
|
-
help:
|
|
81
|
-
zh_Hans: 指定模型必须输出的格式。
|
|
82
|
-
en_US: Specifying the format that the model must output.
|
|
83
|
-
required: false
|
|
84
|
-
options:
|
|
85
|
-
- text
|
|
86
|
-
- json_object
|
|
87
59
|
pricing:
|
|
88
60
|
input: '21'
|
|
89
61
|
output: '168'
|
package/dist/llm/gpt-5.2.yaml
CHANGED
|
@@ -47,13 +47,13 @@ parameter_rules:
|
|
|
47
47
|
required: false
|
|
48
48
|
default: medium
|
|
49
49
|
options:
|
|
50
|
+
- minimal
|
|
50
51
|
- low
|
|
51
52
|
- medium
|
|
52
53
|
- high
|
|
53
|
-
- xhigh
|
|
54
54
|
help:
|
|
55
|
-
zh_Hans: 控制模型推理的深度。
|
|
56
|
-
en_US: Controls how much reasoning effort the model uses.
|
|
55
|
+
zh_Hans: 控制模型推理的深度。high 提供最深度的推理,minimal 适合更快的响应。
|
|
56
|
+
en_US: Controls how much reasoning effort the model uses. high provides the deepest reasoning, while minimal favors faster responses.
|
|
57
57
|
- name: frequency_penalty
|
|
58
58
|
use_template: frequency_penalty
|
|
59
59
|
default: 0
|
|
@@ -47,13 +47,13 @@ parameter_rules:
|
|
|
47
47
|
required: false
|
|
48
48
|
default: medium
|
|
49
49
|
options:
|
|
50
|
+
- minimal
|
|
50
51
|
- low
|
|
51
52
|
- medium
|
|
52
53
|
- high
|
|
53
|
-
- xhigh
|
|
54
54
|
help:
|
|
55
|
-
zh_Hans: 控制模型推理的深度。
|
|
56
|
-
en_US: Controls how much reasoning effort the model uses.
|
|
55
|
+
zh_Hans: 控制模型推理的深度。high 提供最深度的推理,minimal 适合更快的响应。
|
|
56
|
+
en_US: Controls how much reasoning effort the model uses. high provides the deepest reasoning, while minimal favors faster responses.
|
|
57
57
|
- name: frequency_penalty
|
|
58
58
|
use_template: frequency_penalty
|
|
59
59
|
default: 0
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
model: gpt-5.4-pro
|
|
2
|
+
label:
|
|
3
|
+
en_US: GPT-5.4 Pro
|
|
4
|
+
zh_Hans: GPT-5.4 Pro
|
|
5
|
+
model_type: llm
|
|
6
|
+
features:
|
|
7
|
+
- agent-thought
|
|
8
|
+
- tool-call
|
|
9
|
+
- multi-tool-call
|
|
10
|
+
- stream-tool-call
|
|
11
|
+
- vision
|
|
12
|
+
model_properties:
|
|
13
|
+
mode: chat
|
|
14
|
+
context_size: 400000
|
|
15
|
+
max_output: 128000
|
|
16
|
+
parameter_rules:
|
|
17
|
+
- name: max_tokens
|
|
18
|
+
use_template: max_tokens
|
|
19
|
+
default: 32768
|
|
20
|
+
min: 1
|
|
21
|
+
max: 128000
|
|
22
|
+
help:
|
|
23
|
+
zh_Hans: 最大输出 token 数量。
|
|
24
|
+
en_US: Maximum number of output tokens.
|
|
25
|
+
- name: reasoning_effort
|
|
26
|
+
label:
|
|
27
|
+
zh_Hans: 推理力度
|
|
28
|
+
en_US: Reasoning Effort
|
|
29
|
+
type: string
|
|
30
|
+
required: false
|
|
31
|
+
default: medium
|
|
32
|
+
options:
|
|
33
|
+
- minimal
|
|
34
|
+
- low
|
|
35
|
+
- medium
|
|
36
|
+
- high
|
|
37
|
+
help:
|
|
38
|
+
zh_Hans: 控制模型推理的深度。high 提供最深度的推理,minimal 适合更快的响应。
|
|
39
|
+
en_US: Controls how much reasoning effort the model uses. high provides the deepest reasoning, while minimal favors faster responses.
|
|
40
|
+
- name: frequency_penalty
|
|
41
|
+
use_template: frequency_penalty
|
|
42
|
+
default: 0
|
|
43
|
+
min: -2.0
|
|
44
|
+
max: 2.0
|
|
45
|
+
help:
|
|
46
|
+
zh_Hans: 降低重复内容的出现频率。
|
|
47
|
+
en_US: Reduces repetition in the output.
|
|
48
|
+
- name: presence_penalty
|
|
49
|
+
label:
|
|
50
|
+
zh_Hans: 存在惩罚
|
|
51
|
+
en_US: Presence Penalty
|
|
52
|
+
type: float
|
|
53
|
+
default: 0
|
|
54
|
+
min: -2.0
|
|
55
|
+
max: 2.0
|
|
56
|
+
help:
|
|
57
|
+
zh_Hans: 提高讨论新话题的可能性。
|
|
58
|
+
en_US: Increases the likelihood of discussing new topics.
|
|
59
|
+
pricing:
|
|
60
|
+
input: '25'
|
|
61
|
+
output: '200'
|
|
62
|
+
unit: '0.000001'
|
|
63
|
+
currency: USD
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
model: gpt-5.4
|
|
2
|
+
label:
|
|
3
|
+
en_US: GPT-5.4
|
|
4
|
+
zh_Hans: GPT-5.4
|
|
5
|
+
model_type: llm
|
|
6
|
+
features:
|
|
7
|
+
- agent-thought
|
|
8
|
+
- tool-call
|
|
9
|
+
- multi-tool-call
|
|
10
|
+
- stream-tool-call
|
|
11
|
+
- structured-output
|
|
12
|
+
- vision
|
|
13
|
+
model_properties:
|
|
14
|
+
mode: chat
|
|
15
|
+
context_size: 400000
|
|
16
|
+
max_output: 128000
|
|
17
|
+
parameter_rules:
|
|
18
|
+
- name: temperature
|
|
19
|
+
use_template: temperature
|
|
20
|
+
default: 1
|
|
21
|
+
min: 0.0
|
|
22
|
+
max: 2.0
|
|
23
|
+
help:
|
|
24
|
+
zh_Hans: 采样温度,控制输出的随机性。
|
|
25
|
+
en_US: Sampling temperature, controls the randomness of the output.
|
|
26
|
+
- name: max_tokens
|
|
27
|
+
use_template: max_tokens
|
|
28
|
+
default: 32768
|
|
29
|
+
min: 1
|
|
30
|
+
max: 128000
|
|
31
|
+
help:
|
|
32
|
+
zh_Hans: 最大输出 token 数量。GPT-5.4 支持最大 128K 输出。
|
|
33
|
+
en_US: Maximum number of output tokens. GPT-5.4 supports up to 128K output.
|
|
34
|
+
- name: top_p
|
|
35
|
+
use_template: top_p
|
|
36
|
+
default: 1
|
|
37
|
+
min: 0.0
|
|
38
|
+
max: 1.0
|
|
39
|
+
help:
|
|
40
|
+
zh_Hans: 核采样参数,控制输出的多样性。
|
|
41
|
+
en_US: Nucleus sampling parameter, controls output diversity.
|
|
42
|
+
- name: reasoning_effort
|
|
43
|
+
label:
|
|
44
|
+
zh_Hans: 推理力度
|
|
45
|
+
en_US: Reasoning Effort
|
|
46
|
+
type: string
|
|
47
|
+
required: false
|
|
48
|
+
default: medium
|
|
49
|
+
options:
|
|
50
|
+
- minimal
|
|
51
|
+
- low
|
|
52
|
+
- medium
|
|
53
|
+
- high
|
|
54
|
+
help:
|
|
55
|
+
zh_Hans: 控制模型推理的深度。high 提供最深度的推理,minimal 适合更快的响应。
|
|
56
|
+
en_US: Controls how much reasoning effort the model uses. high provides the deepest reasoning, while minimal favors faster responses.
|
|
57
|
+
- name: frequency_penalty
|
|
58
|
+
use_template: frequency_penalty
|
|
59
|
+
default: 0
|
|
60
|
+
min: -2.0
|
|
61
|
+
max: 2.0
|
|
62
|
+
help:
|
|
63
|
+
zh_Hans: 降低重复内容的出现频率。
|
|
64
|
+
en_US: Reduces repetition in the output.
|
|
65
|
+
- name: presence_penalty
|
|
66
|
+
label:
|
|
67
|
+
zh_Hans: 存在惩罚
|
|
68
|
+
en_US: Presence Penalty
|
|
69
|
+
type: float
|
|
70
|
+
default: 0
|
|
71
|
+
min: -2.0
|
|
72
|
+
max: 2.0
|
|
73
|
+
help:
|
|
74
|
+
zh_Hans: 提高讨论新话题的可能性。
|
|
75
|
+
en_US: Increases the likelihood of discussing new topics.
|
|
76
|
+
- name: response_format
|
|
77
|
+
label:
|
|
78
|
+
zh_Hans: 回复格式
|
|
79
|
+
en_US: Response Format
|
|
80
|
+
type: string
|
|
81
|
+
help:
|
|
82
|
+
zh_Hans: 指定模型必须输出的格式。
|
|
83
|
+
en_US: Specifying the format that the model must output.
|
|
84
|
+
required: false
|
|
85
|
+
options:
|
|
86
|
+
- text
|
|
87
|
+
- json_object
|
|
88
|
+
pricing:
|
|
89
|
+
input: '2'
|
|
90
|
+
output: '16'
|
|
91
|
+
unit: '0.000001'
|
|
92
|
+
currency: USD
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
model: gpt-5
|
|
2
|
+
label:
|
|
3
|
+
en_US: GPT-5
|
|
4
|
+
zh_Hans: GPT-5
|
|
5
|
+
model_type: llm
|
|
6
|
+
features:
|
|
7
|
+
- agent-thought
|
|
8
|
+
- tool-call
|
|
9
|
+
- multi-tool-call
|
|
10
|
+
- stream-tool-call
|
|
11
|
+
- structured-output
|
|
12
|
+
- vision
|
|
13
|
+
model_properties:
|
|
14
|
+
mode: chat
|
|
15
|
+
context_size: 400000
|
|
16
|
+
max_output: 128000
|
|
17
|
+
parameter_rules:
|
|
18
|
+
- name: temperature
|
|
19
|
+
use_template: temperature
|
|
20
|
+
default: 1
|
|
21
|
+
min: 0.0
|
|
22
|
+
max: 2.0
|
|
23
|
+
help:
|
|
24
|
+
zh_Hans: 采样温度,控制输出的随机性。
|
|
25
|
+
en_US: Sampling temperature, controls the randomness of the output.
|
|
26
|
+
- name: max_tokens
|
|
27
|
+
use_template: max_tokens
|
|
28
|
+
default: 32768
|
|
29
|
+
min: 1
|
|
30
|
+
max: 128000
|
|
31
|
+
help:
|
|
32
|
+
zh_Hans: 最大输出 token 数量。GPT-5 支持最大 128K 输出。
|
|
33
|
+
en_US: Maximum number of output tokens. GPT-5 supports up to 128K output.
|
|
34
|
+
- name: top_p
|
|
35
|
+
use_template: top_p
|
|
36
|
+
default: 1
|
|
37
|
+
min: 0.0
|
|
38
|
+
max: 1.0
|
|
39
|
+
help:
|
|
40
|
+
zh_Hans: 核采样参数,控制输出的多样性。
|
|
41
|
+
en_US: Nucleus sampling parameter, controls output diversity.
|
|
42
|
+
- name: reasoning_effort
|
|
43
|
+
label:
|
|
44
|
+
zh_Hans: 推理力度
|
|
45
|
+
en_US: Reasoning Effort
|
|
46
|
+
type: string
|
|
47
|
+
required: false
|
|
48
|
+
default: medium
|
|
49
|
+
options:
|
|
50
|
+
- minimal
|
|
51
|
+
- low
|
|
52
|
+
- medium
|
|
53
|
+
- high
|
|
54
|
+
help:
|
|
55
|
+
zh_Hans: 控制模型推理的深度。high 提供最深度的推理,minimal 适合更快的响应。
|
|
56
|
+
en_US: Controls how much reasoning effort the model uses. high provides the deepest reasoning, while minimal favors faster responses.
|
|
57
|
+
- name: frequency_penalty
|
|
58
|
+
use_template: frequency_penalty
|
|
59
|
+
default: 0
|
|
60
|
+
min: -2.0
|
|
61
|
+
max: 2.0
|
|
62
|
+
help:
|
|
63
|
+
zh_Hans: 降低重复内容的出现频率。
|
|
64
|
+
en_US: Reduces repetition in the output.
|
|
65
|
+
- name: presence_penalty
|
|
66
|
+
label:
|
|
67
|
+
zh_Hans: 存在惩罚
|
|
68
|
+
en_US: Presence Penalty
|
|
69
|
+
type: float
|
|
70
|
+
default: 0
|
|
71
|
+
min: -2.0
|
|
72
|
+
max: 2.0
|
|
73
|
+
help:
|
|
74
|
+
zh_Hans: 提高讨论新话题的可能性。
|
|
75
|
+
en_US: Increases the likelihood of discussing new topics.
|
|
76
|
+
- name: response_format
|
|
77
|
+
label:
|
|
78
|
+
zh_Hans: 回复格式
|
|
79
|
+
en_US: Response Format
|
|
80
|
+
type: string
|
|
81
|
+
help:
|
|
82
|
+
zh_Hans: 指定模型必须输出的格式。
|
|
83
|
+
en_US: Specifying the format that the model must output.
|
|
84
|
+
required: false
|
|
85
|
+
options:
|
|
86
|
+
- text
|
|
87
|
+
- json_object
|
|
88
|
+
pricing:
|
|
89
|
+
input: '1.25'
|
|
90
|
+
output: '10'
|
|
91
|
+
unit: '0.000001'
|
|
92
|
+
currency: USD
|
package/dist/llm/llm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/llm/llm.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAmB,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEjE,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/llm/llm.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAmB,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEjE,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,iBAAiB,EAKlB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,qBACa,wBAAyB,SAAQ,kBAAkB;;aAGhC,aAAa,EAAE,sBAAsB;gBAArC,aAAa,EAAE,sBAAsB;IAI7D,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB9E,YAAY,CAAC,YAAY,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,iBAAiB;CAyD/E"}
|
package/dist/llm/llm.js
CHANGED
|
@@ -7,7 +7,7 @@ import { AiModelTypeEnum } from '@metad/contracts';
|
|
|
7
7
|
import { Injectable, Logger } from '@nestjs/common';
|
|
8
8
|
import { CredentialsValidateFailedError, getErrorMessage, LargeLanguageModel, } from '@xpert-ai/plugin-sdk';
|
|
9
9
|
import { isNil, omitBy } from 'lodash-es';
|
|
10
|
-
import { shouldEnableSamplingParameters, toCredentialKwargs } from '../types.js';
|
|
10
|
+
import { shouldEnableResponseFormat, shouldEnableSamplingParameters, toCredentialKwargs } from '../types.js';
|
|
11
11
|
import { OpenAIProviderStrategy } from '../provider.strategy.js';
|
|
12
12
|
let OpenAILargeLanguageModel = OpenAILargeLanguageModel_1 = class OpenAILargeLanguageModel extends LargeLanguageModel {
|
|
13
13
|
#logger = new Logger(OpenAILargeLanguageModel_1.name);
|
|
@@ -38,10 +38,14 @@ let OpenAILargeLanguageModel = OpenAILargeLanguageModel_1 = class OpenAILargeLan
|
|
|
38
38
|
const credentials = modelProvider.credentials;
|
|
39
39
|
const params = toCredentialKwargs(credentials);
|
|
40
40
|
const modelOptions = copilotModel.options;
|
|
41
|
+
const model = copilotModel.model;
|
|
41
42
|
const hasCustomEndpoint = !!credentials?.endpoint_url?.trim();
|
|
42
43
|
const streaming = modelOptions?.streaming ?? !hasCustomEndpoint;
|
|
43
|
-
const supportsSamplingParams = shouldEnableSamplingParameters(credentials?.sampling_parameters, params.configuration?.baseURL);
|
|
44
|
-
const
|
|
44
|
+
const supportsSamplingParams = shouldEnableSamplingParameters(credentials?.sampling_parameters, params.configuration?.baseURL, model);
|
|
45
|
+
const supportsResponseFormat = shouldEnableResponseFormat(params.configuration?.baseURL, model);
|
|
46
|
+
const responseFormat = supportsResponseFormat && modelOptions?.response_format
|
|
47
|
+
? { type: modelOptions.response_format }
|
|
48
|
+
: undefined;
|
|
45
49
|
const fields = omitBy({
|
|
46
50
|
...params,
|
|
47
51
|
model,
|
|
@@ -58,7 +62,7 @@ let OpenAILargeLanguageModel = OpenAILargeLanguageModel_1 = class OpenAILargeLan
|
|
|
58
62
|
: undefined,
|
|
59
63
|
streamUsage: streaming,
|
|
60
64
|
}, isNil);
|
|
61
|
-
|
|
65
|
+
const chatModel = new ChatOpenAI({
|
|
62
66
|
...fields,
|
|
63
67
|
verbose: options?.verbose,
|
|
64
68
|
callbacks: [
|
|
@@ -69,6 +73,9 @@ let OpenAILargeLanguageModel = OpenAILargeLanguageModel_1 = class OpenAILargeLan
|
|
|
69
73
|
profile: this.getModelProfile(model, credentials)
|
|
70
74
|
}
|
|
71
75
|
});
|
|
76
|
+
return responseFormat
|
|
77
|
+
? chatModel.withConfig({ response_format: responseFormat })
|
|
78
|
+
: chatModel;
|
|
72
79
|
}
|
|
73
80
|
};
|
|
74
81
|
OpenAILargeLanguageModel = OpenAILargeLanguageModel_1 = __decorate([
|
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-5 model service via Responses API.
|
|
7
|
-
zh_Hans: OpenAI GPT-5 模型服务,通过 Responses API 提供。
|
|
6
|
+
en_US: OpenAI GPT-5 and GPT-5.4 model service via Responses API.
|
|
7
|
+
zh_Hans: OpenAI GPT-5 与 GPT-5.4 模型服务,通过 Responses API 提供。
|
|
8
8
|
icon_small:
|
|
9
9
|
en_US: icon_s_en.svg
|
|
10
10
|
icon_large:
|
|
@@ -19,7 +19,7 @@ let OpenAIProviderStrategy = OpenAIProviderStrategy_1 = class OpenAIProviderStra
|
|
|
19
19
|
async validateProviderCredentials(credentials) {
|
|
20
20
|
try {
|
|
21
21
|
const modelInstance = this.getModelManager(AiModelTypeEnum.LLM);
|
|
22
|
-
await modelInstance.validateCredentials('gpt-5
|
|
22
|
+
await modelInstance.validateCredentials('gpt-5', credentials);
|
|
23
23
|
}
|
|
24
24
|
catch (ex) {
|
|
25
25
|
if (ex instanceof CredentialsValidateFailedError) {
|
package/dist/types.d.ts
CHANGED
|
@@ -8,18 +8,21 @@ export interface OpenAICredentials {
|
|
|
8
8
|
endpoint_url?: string;
|
|
9
9
|
sampling_parameters?: 'auto' | 'enabled' | 'disabled';
|
|
10
10
|
}
|
|
11
|
+
export type OpenAIReasoningEffort = 'minimal' | 'low' | 'medium' | 'high';
|
|
11
12
|
export interface OpenAIModelOptions extends CommonChatModelParameters {
|
|
12
13
|
streaming?: boolean;
|
|
13
14
|
top_p?: number;
|
|
14
15
|
max_tokens?: number;
|
|
15
16
|
frequency_penalty?: number;
|
|
16
17
|
presence_penalty?: number;
|
|
17
|
-
reasoning_effort?:
|
|
18
|
+
reasoning_effort?: OpenAIReasoningEffort;
|
|
18
19
|
response_format?: 'text' | 'json_object';
|
|
19
20
|
}
|
|
20
21
|
export declare function normalizeOpenAIBaseUrl(endpointUrl?: string): string;
|
|
21
22
|
export declare function isOpenAIOfficialBaseUrl(baseURL?: string): boolean;
|
|
22
|
-
export declare function
|
|
23
|
+
export declare function isOpenAIGPT5ProModel(model?: string): boolean;
|
|
24
|
+
export declare function shouldEnableSamplingParameters(mode: OpenAICredentials['sampling_parameters'], baseURL?: string, model?: string): boolean;
|
|
25
|
+
export declare function shouldEnableResponseFormat(baseURL?: string, model?: string): boolean;
|
|
23
26
|
export declare function toCredentialKwargs(credentials: OpenAICredentials): {
|
|
24
27
|
configuration: ClientOptions;
|
|
25
28
|
temperature: number;
|
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;AAI/D,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,WAAW,kBAAmB,SAAQ,yBAAyB;IACpE,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,
|
|
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;AAI/D,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,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEzE,MAAM,WAAW,kBAAmB,SAAQ,yBAAyB;IACpE,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,8BAA8B,CAC7C,IAAI,EAAE,iBAAiB,CAAC,qBAAqB,CAAC,EAC9C,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GACZ,OAAO,CAcT;AAED,wBAAgB,0BAA0B,CACzC,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GACZ,OAAO,CAMT;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EAYhE"}
|
package/dist/types.js
CHANGED
|
@@ -7,6 +7,7 @@ export const OpenAIDefaultBaseUrl = 'https://api.openai.com/v1';
|
|
|
7
7
|
const OpenAIApiVersionPath = '/v1';
|
|
8
8
|
const OpenAIOfficialHost = 'api.openai.com';
|
|
9
9
|
export const SvgIcon = readFileSync(join(moduleDir, '_assets/icon_s_en.svg'), 'utf8');
|
|
10
|
+
const OpenAIGPT5ProModelPattern = /^gpt-5(?:\.\d+)?-pro$/;
|
|
10
11
|
export function normalizeOpenAIBaseUrl(endpointUrl) {
|
|
11
12
|
if (!endpointUrl?.trim()) {
|
|
12
13
|
return OpenAIDefaultBaseUrl;
|
|
@@ -41,14 +42,26 @@ export function isOpenAIOfficialBaseUrl(baseURL) {
|
|
|
41
42
|
return baseURL.includes(OpenAIOfficialHost);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
export function
|
|
45
|
+
export function isOpenAIGPT5ProModel(model) {
|
|
46
|
+
return !!model?.trim() && OpenAIGPT5ProModelPattern.test(model.trim());
|
|
47
|
+
}
|
|
48
|
+
export function shouldEnableSamplingParameters(mode, baseURL, model) {
|
|
45
49
|
if (mode === 'enabled') {
|
|
46
50
|
return true;
|
|
47
51
|
}
|
|
48
52
|
if (mode === 'disabled') {
|
|
49
53
|
return false;
|
|
50
54
|
}
|
|
51
|
-
|
|
55
|
+
if (!isOpenAIOfficialBaseUrl(baseURL)) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return !isOpenAIGPT5ProModel(model);
|
|
59
|
+
}
|
|
60
|
+
export function shouldEnableResponseFormat(baseURL, model) {
|
|
61
|
+
if (!isOpenAIOfficialBaseUrl(baseURL)) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return !isOpenAIGPT5ProModel(model);
|
|
52
65
|
}
|
|
53
66
|
export function toCredentialKwargs(credentials) {
|
|
54
67
|
const credentialsKwargs = {
|