@llumiverse/common 1.2.0 → 1.4.0-dev.20260629.090753Z

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.
Files changed (184) hide show
  1. package/lib/capability/anthropic.d.ts +3 -0
  2. package/lib/capability/anthropic.d.ts.map +1 -0
  3. package/lib/capability/anthropic.js +92 -0
  4. package/lib/capability/anthropic.js.map +1 -0
  5. package/lib/{types/capability → capability}/azure_foundry.d.ts +1 -1
  6. package/lib/capability/azure_foundry.d.ts.map +1 -0
  7. package/lib/capability/azure_foundry.js +394 -0
  8. package/lib/capability/azure_foundry.js.map +1 -0
  9. package/lib/{types/capability → capability}/bedrock.d.ts +1 -1
  10. package/lib/capability/bedrock.d.ts.map +1 -0
  11. package/lib/capability/bedrock.js +300 -0
  12. package/lib/capability/bedrock.js.map +1 -0
  13. package/lib/{types/capability → capability}/openai.d.ts +1 -1
  14. package/lib/capability/openai.d.ts.map +1 -0
  15. package/lib/capability/openai.js +179 -0
  16. package/lib/capability/openai.js.map +1 -0
  17. package/lib/{types/capability → capability}/vertexai.d.ts +1 -1
  18. package/lib/capability/vertexai.d.ts.map +1 -0
  19. package/lib/capability/vertexai.js +137 -0
  20. package/lib/capability/vertexai.js.map +1 -0
  21. package/lib/{types/capability.d.ts → capability.d.ts} +1 -1
  22. package/lib/capability.d.ts.map +1 -0
  23. package/lib/{esm/capability.js → capability.js} +21 -15
  24. package/lib/capability.js.map +1 -0
  25. package/lib/index.d.ts +14 -0
  26. package/lib/index.d.ts.map +1 -0
  27. package/lib/index.js +14 -0
  28. package/lib/index.js.map +1 -0
  29. package/lib/options/anthropic.d.ts +16 -0
  30. package/lib/options/anthropic.d.ts.map +1 -0
  31. package/lib/options/anthropic.js +34 -0
  32. package/lib/options/anthropic.js.map +1 -0
  33. package/lib/{types/options → options}/azure_foundry.d.ts +14 -14
  34. package/lib/options/azure_foundry.d.ts.map +1 -0
  35. package/lib/{esm/options → options}/azure_foundry.js +126 -126
  36. package/lib/options/azure_foundry.js.map +1 -0
  37. package/lib/options/bedrock.d.ts +61 -0
  38. package/lib/options/bedrock.d.ts.map +1 -0
  39. package/lib/options/bedrock.js +489 -0
  40. package/lib/options/bedrock.js.map +1 -0
  41. package/lib/options/context-windows.d.ts.map +1 -0
  42. package/lib/options/context-windows.js.map +1 -0
  43. package/lib/options/embedding.d.ts +38 -0
  44. package/lib/options/embedding.d.ts.map +1 -0
  45. package/lib/options/embedding.js +77 -0
  46. package/lib/options/embedding.js.map +1 -0
  47. package/lib/{types/options → options}/fallback.d.ts +2 -2
  48. package/lib/options/fallback.d.ts.map +1 -0
  49. package/lib/options/fallback.js +65 -0
  50. package/lib/options/fallback.js.map +1 -0
  51. package/lib/{types/options → options}/groq.d.ts +2 -2
  52. package/lib/options/groq.d.ts.map +1 -0
  53. package/lib/options/groq.js +54 -0
  54. package/lib/options/groq.js.map +1 -0
  55. package/lib/options/openai.d.ts +40 -0
  56. package/lib/options/openai.d.ts.map +1 -0
  57. package/lib/options/openai.js +284 -0
  58. package/lib/options/openai.js.map +1 -0
  59. package/lib/{types/options → options}/shared-parsing.d.ts +1 -1
  60. package/lib/options/shared-parsing.d.ts.map +1 -0
  61. package/lib/{esm/options → options}/shared-parsing.js +14 -17
  62. package/lib/options/shared-parsing.js.map +1 -0
  63. package/lib/options/version-parsing.d.ts.map +1 -0
  64. package/lib/{esm/options → options}/version-parsing.js +15 -15
  65. package/lib/options/version-parsing.js.map +1 -0
  66. package/lib/{types/options → options}/vertexai.d.ts +18 -15
  67. package/lib/options/vertexai.d.ts.map +1 -0
  68. package/lib/options/vertexai.js +606 -0
  69. package/lib/options/vertexai.js.map +1 -0
  70. package/lib/{types/options.d.ts → options.d.ts} +1 -1
  71. package/lib/options.d.ts.map +1 -0
  72. package/lib/{esm/options.js → options.js} +10 -7
  73. package/lib/options.js.map +1 -0
  74. package/lib/{types/types.d.ts → types.d.ts} +161 -42
  75. package/lib/types.d.ts.map +1 -0
  76. package/lib/{esm/types.js → types.js} +28 -22
  77. package/lib/types.js.map +1 -0
  78. package/package.json +12 -34
  79. package/src/LlumiverseError.test.ts +18 -72
  80. package/src/capability/anthropic.ts +99 -0
  81. package/src/capability/azure_foundry.ts +303 -65
  82. package/src/capability/bedrock.ts +201 -56
  83. package/src/capability/openai.ts +135 -41
  84. package/src/capability/vertexai.ts +105 -35
  85. package/src/capability.ts +21 -16
  86. package/src/index.ts +13 -11
  87. package/src/options/anthropic.ts +59 -0
  88. package/src/options/azure_foundry.ts +157 -143
  89. package/src/options/bedrock.ts +266 -187
  90. package/src/options/context-windows.ts +2 -2
  91. package/src/options/embedding.ts +92 -0
  92. package/src/options/fallback.ts +50 -17
  93. package/src/options/groq.ts +48 -21
  94. package/src/options/openai.ts +231 -183
  95. package/src/options/shared-parsing.ts +16 -21
  96. package/src/options/version-parsing.ts +17 -17
  97. package/src/options/vertexai.ts +385 -288
  98. package/src/options.ts +11 -8
  99. package/src/types.ts +284 -160
  100. package/lib/cjs/capability/azure_foundry.js +0 -160
  101. package/lib/cjs/capability/azure_foundry.js.map +0 -1
  102. package/lib/cjs/capability/bedrock.js +0 -158
  103. package/lib/cjs/capability/bedrock.js.map +0 -1
  104. package/lib/cjs/capability/openai.js +0 -98
  105. package/lib/cjs/capability/openai.js.map +0 -1
  106. package/lib/cjs/capability/vertexai.js +0 -80
  107. package/lib/cjs/capability/vertexai.js.map +0 -1
  108. package/lib/cjs/capability.js +0 -109
  109. package/lib/cjs/capability.js.map +0 -1
  110. package/lib/cjs/index.js +0 -27
  111. package/lib/cjs/index.js.map +0 -1
  112. package/lib/cjs/options/azure_foundry.js +0 -423
  113. package/lib/cjs/options/azure_foundry.js.map +0 -1
  114. package/lib/cjs/options/bedrock.js +0 -427
  115. package/lib/cjs/options/bedrock.js.map +0 -1
  116. package/lib/cjs/options/context-windows.js +0 -138
  117. package/lib/cjs/options/context-windows.js.map +0 -1
  118. package/lib/cjs/options/fallback.js +0 -35
  119. package/lib/cjs/options/fallback.js.map +0 -1
  120. package/lib/cjs/options/groq.js +0 -37
  121. package/lib/cjs/options/groq.js.map +0 -1
  122. package/lib/cjs/options/openai.js +0 -246
  123. package/lib/cjs/options/openai.js.map +0 -1
  124. package/lib/cjs/options/shared-parsing.js +0 -144
  125. package/lib/cjs/options/shared-parsing.js.map +0 -1
  126. package/lib/cjs/options/version-parsing.js +0 -326
  127. package/lib/cjs/options/version-parsing.js.map +0 -1
  128. package/lib/cjs/options/vertexai.js +0 -525
  129. package/lib/cjs/options/vertexai.js.map +0 -1
  130. package/lib/cjs/options.js +0 -30
  131. package/lib/cjs/options.js.map +0 -1
  132. package/lib/cjs/package.json +0 -3
  133. package/lib/cjs/types.js +0 -299
  134. package/lib/cjs/types.js.map +0 -1
  135. package/lib/esm/capability/azure_foundry.js +0 -157
  136. package/lib/esm/capability/azure_foundry.js.map +0 -1
  137. package/lib/esm/capability/bedrock.js +0 -155
  138. package/lib/esm/capability/bedrock.js.map +0 -1
  139. package/lib/esm/capability/openai.js +0 -95
  140. package/lib/esm/capability/openai.js.map +0 -1
  141. package/lib/esm/capability/vertexai.js +0 -77
  142. package/lib/esm/capability/vertexai.js.map +0 -1
  143. package/lib/esm/capability.js.map +0 -1
  144. package/lib/esm/index.js +0 -11
  145. package/lib/esm/index.js.map +0 -1
  146. package/lib/esm/options/azure_foundry.js.map +0 -1
  147. package/lib/esm/options/bedrock.js +0 -423
  148. package/lib/esm/options/bedrock.js.map +0 -1
  149. package/lib/esm/options/context-windows.js.map +0 -1
  150. package/lib/esm/options/fallback.js +0 -32
  151. package/lib/esm/options/fallback.js.map +0 -1
  152. package/lib/esm/options/groq.js +0 -34
  153. package/lib/esm/options/groq.js.map +0 -1
  154. package/lib/esm/options/openai.js +0 -243
  155. package/lib/esm/options/openai.js.map +0 -1
  156. package/lib/esm/options/shared-parsing.js.map +0 -1
  157. package/lib/esm/options/version-parsing.js.map +0 -1
  158. package/lib/esm/options/vertexai.js +0 -519
  159. package/lib/esm/options/vertexai.js.map +0 -1
  160. package/lib/esm/options.js.map +0 -1
  161. package/lib/esm/types.js.map +0 -1
  162. package/lib/types/capability/azure_foundry.d.ts.map +0 -1
  163. package/lib/types/capability/bedrock.d.ts.map +0 -1
  164. package/lib/types/capability/openai.d.ts.map +0 -1
  165. package/lib/types/capability/vertexai.d.ts.map +0 -1
  166. package/lib/types/capability.d.ts.map +0 -1
  167. package/lib/types/index.d.ts +0 -11
  168. package/lib/types/index.d.ts.map +0 -1
  169. package/lib/types/options/azure_foundry.d.ts.map +0 -1
  170. package/lib/types/options/bedrock.d.ts +0 -54
  171. package/lib/types/options/bedrock.d.ts.map +0 -1
  172. package/lib/types/options/context-windows.d.ts.map +0 -1
  173. package/lib/types/options/fallback.d.ts.map +0 -1
  174. package/lib/types/options/groq.d.ts.map +0 -1
  175. package/lib/types/options/openai.d.ts +0 -37
  176. package/lib/types/options/openai.d.ts.map +0 -1
  177. package/lib/types/options/shared-parsing.d.ts.map +0 -1
  178. package/lib/types/options/version-parsing.d.ts.map +0 -1
  179. package/lib/types/options/vertexai.d.ts.map +0 -1
  180. package/lib/types/options.d.ts.map +0 -1
  181. package/lib/types/types.d.ts.map +0 -1
  182. /package/lib/{types/options → options}/context-windows.d.ts +0 -0
  183. /package/lib/{esm/options → options}/context-windows.js +0 -0
  184. /package/lib/{types/options → options}/version-parsing.d.ts +0 -0
@@ -1,272 +1,318 @@
1
- import { ModelOptionInfoItem, ModelOptions, ModelOptionsInfo, OptionType, ReasoningEffort, SharedOptions } from "../types.js";
2
- import { textOptionsFallback } from "./fallback.js";
1
+ import {
2
+ type ModelOptionInfoItem,
3
+ type ModelOptions,
4
+ type ModelOptionsInfo,
5
+ OptionType,
6
+ type ReasoningEffort,
7
+ SharedOptions,
8
+ } from '../types.js';
3
9
 
4
10
  // Union type of all OpenAI options
11
+ /**
12
+ * @discriminator _option_id
13
+ */
5
14
  export type OpenAiOptions = OpenAiThinkingOptions | OpenAiTextOptions | OpenAiDalleOptions | OpenAiGptImageOptions;
6
15
 
7
16
  export interface OpenAiThinkingOptions {
8
- _option_id: "openai-thinking",
9
- max_tokens?: number,
10
- stop_sequence?: string[],
11
- effort?: ReasoningEffort,
12
- reasoning_effort?: ReasoningEffort,
13
- image_detail?: "low" | "high" | "auto",
17
+ _option_id: 'openai-thinking';
18
+ max_tokens?: number;
19
+ stop_sequence?: string[];
20
+ effort?: ReasoningEffort;
21
+ reasoning_effort?: ReasoningEffort;
22
+ image_detail?: 'low' | 'high' | 'auto';
14
23
  }
15
24
 
16
25
  export interface OpenAiTextOptions {
17
- _option_id: "openai-text",
18
- max_tokens?: number,
19
- temperature?: number,
20
- top_p?: number,
21
- presence_penalty?: number,
22
- frequency_penalty?: number,
23
- stop_sequence?: string[],
24
- image_detail?: "low" | "high" | "auto",
26
+ _option_id: 'openai-text';
27
+ max_tokens?: number;
28
+ temperature?: number;
29
+ top_p?: number;
30
+ presence_penalty?: number;
31
+ frequency_penalty?: number;
32
+ stop_sequence?: string[];
33
+ image_detail?: 'low' | 'high' | 'auto';
25
34
  }
26
35
  export interface OpenAiDalleOptions {
27
- _option_id: "openai-dalle",
28
- size?: "256x256" | "512x512" | "1024x1024" | "1792x1024" | "1024x1792",
29
- image_quality?: "standard" | "hd",
30
- style?: "vivid" | "natural",
31
- response_format?: "url" | "b64_json",
32
- n?: number,
36
+ _option_id: 'openai-dalle';
37
+ size?: '256x256' | '512x512' | '1024x1024' | '1792x1024' | '1024x1792';
38
+ image_quality?: 'standard' | 'hd';
39
+ style?: 'vivid' | 'natural';
40
+ response_format?: 'url' | 'b64_json';
41
+ n?: number;
33
42
  }
34
43
 
35
44
  export interface OpenAiGptImageOptions {
36
- _option_id: "openai-gpt-image",
37
- size?: "1024x1024" | "1024x1536" | "1536x1024" | "auto",
38
- image_quality?: "low" | "medium" | "high" | "auto",
39
- background?: "transparent" | "opaque" | "auto",
40
- output_format?: "png" | "webp" | "jpeg",
45
+ _option_id: 'openai-gpt-image';
46
+ size?: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
47
+ image_quality?: 'low' | 'medium' | 'high' | 'auto';
48
+ background?: 'transparent' | 'opaque' | 'auto';
49
+ output_format?: 'png' | 'webp' | 'jpeg';
41
50
  }
42
51
 
43
52
  export function getOpenAiOptions(model: string, _option?: ModelOptions): ModelOptionsInfo {
44
- const visionOptions: ModelOptionInfoItem[] = isVisionModel(model) ? [
45
- {
46
- name: "image_detail", type: OptionType.enum, enum: { "Low": "low", "High": "high", "Auto": "auto" },
47
- default: "auto", description: "Controls how the model processes an input image."
48
- },
49
- ] : [];
53
+ const visionOptions: ModelOptionInfoItem[] = isVisionModel(model)
54
+ ? [
55
+ {
56
+ name: 'image_detail',
57
+ type: OptionType.enum,
58
+ enum: { Low: 'low', High: 'high', Auto: 'auto' },
59
+ default: 'auto',
60
+ description: 'Controls how the model processes an input image.',
61
+ },
62
+ ]
63
+ : [];
50
64
 
51
65
  // Image generation models
52
66
  if (isImageModel(model)) {
53
- const isGPTImage = model.includes("gpt-image") || model.includes("chatgpt-image");
54
- const isDallE2 = model.includes("dall-e-2");
55
- const isDallE3 = model.includes("dall-e-3");
67
+ const isGPTImage = model.includes('gpt-image') || model.includes('chatgpt-image');
68
+ const isDallE2 = model.includes('dall-e-2');
69
+ const isDallE3 = model.includes('dall-e-3');
56
70
 
57
71
  const sizeOptions: Record<string, string> = {};
58
72
  if (isGPTImage) {
59
- sizeOptions["1024x1024"] = "1024x1024";
60
- sizeOptions["1024x1536"] = "1024x1536";
61
- sizeOptions["1536x1024"] = "1536x1024";
62
- sizeOptions["Auto"] = "auto";
73
+ sizeOptions['1024x1024'] = '1024x1024';
74
+ sizeOptions['1024x1536'] = '1024x1536';
75
+ sizeOptions['1536x1024'] = '1536x1024';
76
+ sizeOptions.Auto = 'auto';
63
77
  } else if (isDallE2) {
64
- sizeOptions["256x256"] = "256x256";
65
- sizeOptions["512x512"] = "512x512";
66
- sizeOptions["1024x1024"] = "1024x1024";
78
+ sizeOptions['256x256'] = '256x256';
79
+ sizeOptions['512x512'] = '512x512';
80
+ sizeOptions['1024x1024'] = '1024x1024';
67
81
  } else if (isDallE3) {
68
- sizeOptions["1024x1024"] = "1024x1024";
69
- sizeOptions["1792x1024"] = "1792x1024";
70
- sizeOptions["1024x1792"] = "1024x1792";
82
+ sizeOptions['1024x1024'] = '1024x1024';
83
+ sizeOptions['1792x1024'] = '1792x1024';
84
+ sizeOptions['1024x1792'] = '1024x1792';
71
85
  }
72
86
 
73
87
  const baseImageOptions: ModelOptionInfoItem[] = [
74
88
  {
75
- name: "size",
89
+ name: 'size',
76
90
  type: OptionType.enum,
77
91
  enum: sizeOptions,
78
- default: "1024x1024",
79
- description: "The size of the generated image"
80
- }
92
+ default: '1024x1024',
93
+ description: 'The size of the generated image',
94
+ },
81
95
  ];
82
96
 
83
- const gptImageOptions: ModelOptionInfoItem[] = isGPTImage ? [
84
- {
85
- name: "image_quality",
86
- type: OptionType.enum,
87
- enum: { "Low": "low", "Medium": "medium", "High": "high", "Auto": "auto" },
88
- default: "auto",
89
- description: "The quality of the generated image"
90
- },
91
- {
92
- name: "background",
93
- type: OptionType.enum,
94
- enum: { "Transparent": "transparent", "Opaque": "opaque", "Auto": "auto" },
95
- default: "auto",
96
- description: "The background setting for the image"
97
- },
98
- {
99
- name: "output_format",
100
- type: OptionType.enum,
101
- enum: { "PNG": "png", "WebP": "webp", "JPEG": "jpeg" },
102
- default: "png",
103
- description: "The output format for the image"
104
- }
105
- ] : [];
97
+ const gptImageOptions: ModelOptionInfoItem[] = isGPTImage
98
+ ? [
99
+ {
100
+ name: 'image_quality',
101
+ type: OptionType.enum,
102
+ enum: { Low: 'low', Medium: 'medium', High: 'high', Auto: 'auto' },
103
+ default: 'auto',
104
+ description: 'The quality of the generated image',
105
+ },
106
+ {
107
+ name: 'background',
108
+ type: OptionType.enum,
109
+ enum: { Transparent: 'transparent', Opaque: 'opaque', Auto: 'auto' },
110
+ default: 'auto',
111
+ description: 'The background setting for the image',
112
+ },
113
+ {
114
+ name: 'output_format',
115
+ type: OptionType.enum,
116
+ enum: { PNG: 'png', WebP: 'webp', JPEG: 'jpeg' },
117
+ default: 'png',
118
+ description: 'The output format for the image',
119
+ },
120
+ ]
121
+ : [];
106
122
 
107
- const dalleOptions: ModelOptionInfoItem[] = (isDallE2 || isDallE3) ? [
108
- {
109
- name: "image_quality",
110
- type: OptionType.enum,
111
- enum: isDallE3 ? { "Standard": "standard", "HD": "hd" } : { "Standard": "standard" },
112
- default: "standard",
113
- description: "The quality of the generated image"
114
- },
115
- {
116
- name: "style",
117
- type: OptionType.enum,
118
- enum: { "Vivid": "vivid", "Natural": "natural" },
119
- default: "vivid",
120
- description: "The style of the generated image (DALL-E 3 only)"
121
- },
122
- {
123
- name: "response_format",
124
- type: OptionType.enum,
125
- enum: { "URL": "url", "Base64 JSON": "b64_json" },
126
- default: "b64_json",
127
- description: "The format of the response"
128
- }
129
- ] : [];
123
+ const dalleOptions: ModelOptionInfoItem[] =
124
+ isDallE2 || isDallE3
125
+ ? [
126
+ {
127
+ name: 'image_quality',
128
+ type: OptionType.enum,
129
+ enum: isDallE3 ? { Standard: 'standard', HD: 'hd' } : { Standard: 'standard' },
130
+ default: 'standard',
131
+ description: 'The quality of the generated image',
132
+ },
133
+ {
134
+ name: 'style',
135
+ type: OptionType.enum,
136
+ enum: { Vivid: 'vivid', Natural: 'natural' },
137
+ default: 'vivid',
138
+ description: 'The style of the generated image (DALL-E 3 only)',
139
+ },
140
+ {
141
+ name: 'response_format',
142
+ type: OptionType.enum,
143
+ enum: { URL: 'url', 'Base64 JSON': 'b64_json' },
144
+ default: 'b64_json',
145
+ description: 'The format of the response',
146
+ },
147
+ ]
148
+ : [];
130
149
 
131
- const nImagesOption: ModelOptionInfoItem[] = isDallE2 ? [
132
- {
133
- name: "n",
134
- type: OptionType.numeric,
135
- min: 1,
136
- max: 10,
137
- default: 1,
138
- integer: true,
139
- description: "Number of images to generate (DALL-E 2 only)"
140
- }
141
- ] : [];
150
+ const nImagesOption: ModelOptionInfoItem[] = isDallE2
151
+ ? [
152
+ {
153
+ name: 'n',
154
+ type: OptionType.numeric,
155
+ min: 1,
156
+ max: 10,
157
+ default: 1,
158
+ integer: true,
159
+ description: 'Number of images to generate (DALL-E 2 only)',
160
+ },
161
+ ]
162
+ : [];
142
163
 
143
164
  return {
144
- _option_id: isGPTImage ? "openai-gpt-image" : "openai-dalle",
145
- options: [
146
- ...baseImageOptions,
147
- ...gptImageOptions,
148
- ...dalleOptions,
149
- ...nImagesOption,
150
- ]
165
+ _option_id: isGPTImage ? 'openai-gpt-image' : 'openai-dalle',
166
+ options: [...baseImageOptions, ...gptImageOptions, ...dalleOptions, ...nImagesOption],
151
167
  };
152
168
  }
153
169
 
154
170
  if (isReasoningModel(model)) {
155
171
  //Is thinking text model
156
172
  let max_tokens_limit = 4096;
157
- if (model.includes("o1")) {
158
- if (model.includes("preview")) {
173
+ if (model.includes('o1')) {
174
+ if (model.includes('preview')) {
159
175
  max_tokens_limit = 32768;
160
- }
161
- else if (model.includes("mini")) {
176
+ } else if (model.includes('mini')) {
162
177
  max_tokens_limit = 65536;
163
- }
164
- else {
178
+ } else {
165
179
  max_tokens_limit = 100000;
166
180
  }
167
- }
168
- else if (model.includes("o3")) {
181
+ } else if (model.includes('o3')) {
169
182
  max_tokens_limit = 100000;
170
- }
171
- else if (model.includes("o4") || model.includes("gpt-5")) {
183
+ } else if (model.includes('o4') || model.includes('gpt-5')) {
172
184
  max_tokens_limit = 128000;
173
185
  }
174
186
 
175
187
  const commonOptions: ModelOptionInfoItem[] = [
176
188
  {
177
- name: SharedOptions.max_tokens, type: OptionType.numeric, min: 1, max: max_tokens_limit,
178
- integer: true, description: "The maximum number of tokens to generate",
189
+ name: SharedOptions.max_tokens,
190
+ type: OptionType.numeric,
191
+ min: 1,
192
+ max: max_tokens_limit,
193
+ integer: true,
194
+ description: 'The maximum number of tokens to generate',
179
195
  },
180
196
  {
181
- name: SharedOptions.stop_sequence, type: OptionType.string_list, value: [],
182
- description: "The stop sequence of the generated image",
197
+ name: SharedOptions.stop_sequence,
198
+ type: OptionType.string_list,
199
+ value: [],
200
+ description: 'The stop sequence of the generated image',
183
201
  },
184
202
  ];
185
203
 
186
- const reasoningOptions: ModelOptionInfoItem[] = isGpt5ProModel(model) ? [
187
- {
188
- name: SharedOptions.effort, type: OptionType.enum, enum: { "High": "high" },
189
- default: "high", description: "GPT-5 Pro only supports high reasoning effort."
190
- },
191
- ] : model.includes("o3") || model.includes("o4") || model.includes("gpt-5") || isO1Full(model) ? [
192
- {
193
- name: SharedOptions.effort, type: OptionType.enum, enum: { "Low": "low", "Medium": "medium", "High": "high" },
194
- default: "medium", description: "How much effort the model should put into reasoning, lower values result in faster responses and less tokens used."
195
- },
196
- ] : [];
204
+ const reasoningOptions: ModelOptionInfoItem[] = isGpt5ProModel(model)
205
+ ? [
206
+ {
207
+ name: SharedOptions.effort,
208
+ type: OptionType.enum,
209
+ enum: { High: 'high' },
210
+ default: 'high',
211
+ description: 'GPT-5 Pro only supports high reasoning effort.',
212
+ },
213
+ ]
214
+ : model.includes('o3') || model.includes('o4') || model.includes('gpt-5') || isO1Full(model)
215
+ ? [
216
+ {
217
+ name: SharedOptions.effort,
218
+ type: OptionType.enum,
219
+ enum: { Low: 'low', Medium: 'medium', High: 'high' },
220
+ default: 'medium',
221
+ description:
222
+ 'How much effort the model should put into reasoning, lower values result in faster responses and less tokens used.',
223
+ },
224
+ ]
225
+ : [];
197
226
 
198
227
  return {
199
- _option_id: "openai-thinking",
200
- options: [
201
- ...commonOptions,
202
- ...reasoningOptions,
203
- ...visionOptions,
204
- ],
228
+ _option_id: 'openai-thinking',
229
+ options: [...commonOptions, ...reasoningOptions, ...visionOptions],
205
230
  };
206
231
  } else {
207
232
  let max_tokens_limit = 4096;
208
- if (model.includes("gpt-4o")) {
233
+ if (model.includes('gpt-4o')) {
209
234
  max_tokens_limit = 16384;
210
- if (model.includes("gpt-4o-2024-05-13") || model.includes("realtime")) {
235
+ if (model.includes('gpt-4o-2024-05-13') || model.includes('realtime')) {
211
236
  max_tokens_limit = 4096;
212
237
  }
213
- }
214
- else if (model.includes("gpt-4")) {
215
- if (model.includes("turbo")) {
238
+ } else if (model.includes('gpt-4')) {
239
+ if (model.includes('turbo')) {
216
240
  max_tokens_limit = 4096;
217
241
  } else {
218
242
  max_tokens_limit = 8192;
219
243
  }
220
- }
221
- else if (model.includes("gpt-3-5")) {
244
+ } else if (model.includes('gpt-3-5')) {
222
245
  max_tokens_limit = 4096;
223
- }
224
- else if (model.includes("gpt-5")) {
246
+ } else if (model.includes('gpt-5')) {
225
247
  max_tokens_limit = 128000;
226
248
  }
227
249
 
228
250
  //Is non-thinking text model
229
251
  const commonOptions: ModelOptionInfoItem[] = [
230
252
  {
231
- name: SharedOptions.max_tokens, type: OptionType.numeric, min: 1, max: max_tokens_limit,
232
- integer: true, step: 200, description: "The maximum number of tokens to generate",
253
+ name: SharedOptions.max_tokens,
254
+ type: OptionType.numeric,
255
+ min: 1,
256
+ max: max_tokens_limit,
257
+ integer: true,
258
+ step: 200,
259
+ description: 'The maximum number of tokens to generate',
233
260
  },
234
261
  {
235
- name: "temperature", type: OptionType.numeric, min: 0.0, max: 2.0, default: 0.7,
236
- integer: false, step: 0.1, description: "A higher temperature biases toward less likely tokens, making the model more creative"
262
+ name: 'temperature',
263
+ type: OptionType.numeric,
264
+ min: 0.0,
265
+ max: 2.0,
266
+ default: 0.7,
267
+ integer: false,
268
+ step: 0.1,
269
+ description: 'A higher temperature biases toward less likely tokens, making the model more creative',
237
270
  },
238
271
  {
239
- name: "top_p", type: OptionType.numeric, min: 0, max: 1,
240
- integer: false, step: 0.1, description: "Limits token sampling to the cumulative probability of the top p tokens"
272
+ name: 'top_p',
273
+ type: OptionType.numeric,
274
+ min: 0,
275
+ max: 1,
276
+ integer: false,
277
+ step: 0.1,
278
+ description: 'Limits token sampling to the cumulative probability of the top p tokens',
241
279
  },
242
280
  {
243
- name: "presence_penalty", type: OptionType.numeric, min: -2.0, max: 2.0,
244
- integer: false, step: 0.1, description: "Penalise tokens if they appear at least once in the text"
281
+ name: 'presence_penalty',
282
+ type: OptionType.numeric,
283
+ min: -2.0,
284
+ max: 2.0,
285
+ integer: false,
286
+ step: 0.1,
287
+ description: 'Penalise tokens if they appear at least once in the text',
245
288
  },
246
289
  {
247
- name: "frequency_penalty", type: OptionType.numeric, min: -2.0, max: 2.0,
248
- integer: false, step: 0.1, description: "Penalise tokens based on their frequency in the text"
290
+ name: 'frequency_penalty',
291
+ type: OptionType.numeric,
292
+ min: -2.0,
293
+ max: 2.0,
294
+ integer: false,
295
+ step: 0.1,
296
+ description: 'Penalise tokens based on their frequency in the text',
249
297
  },
250
298
  {
251
- name: SharedOptions.stop_sequence, type: OptionType.string_list, value: [],
252
- description: "The generation will halt if one of the stop sequences is output",
253
- }
254
- ]
299
+ name: SharedOptions.stop_sequence,
300
+ type: OptionType.string_list,
301
+ value: [],
302
+ description: 'The generation will halt if one of the stop sequences is output',
303
+ },
304
+ ];
255
305
 
256
306
  return {
257
- _option_id: "openai-text",
258
- options: [
259
- ...commonOptions,
260
- ...visionOptions,
261
- ],
262
- }
307
+ _option_id: 'openai-text',
308
+ options: [...commonOptions, ...visionOptions],
309
+ };
263
310
  }
264
- return textOptionsFallback;
265
311
  }
266
312
 
267
313
  function isO1Full(model: string): boolean {
268
- if (model.includes("o1")) {
269
- if (model.includes("mini") || model.includes("preview")) {
314
+ if (model.includes('o1')) {
315
+ if (model.includes('mini') || model.includes('preview')) {
270
316
  return false;
271
317
  }
272
318
  return true;
@@ -276,10 +322,12 @@ function isO1Full(model: string): boolean {
276
322
 
277
323
  function isReasoningModel(model: string): boolean {
278
324
  const normalized = model.toLowerCase();
279
- return normalized.includes("o1")
280
- || normalized.includes("o3")
281
- || normalized.includes("o4")
282
- || normalized.includes("gpt-5");
325
+ return (
326
+ normalized.includes('o1') ||
327
+ normalized.includes('o3') ||
328
+ normalized.includes('o4') ||
329
+ normalized.includes('gpt-5')
330
+ );
283
331
  }
284
332
 
285
333
  function isGpt5ProModel(model: string): boolean {
@@ -288,9 +336,9 @@ function isGpt5ProModel(model: string): boolean {
288
336
  }
289
337
 
290
338
  function isVisionModel(model: string): boolean {
291
- return model.includes("gpt-4o") || isO1Full(model) || model.includes("gpt-4-turbo");
339
+ return model.includes('gpt-4o') || isO1Full(model) || model.includes('gpt-4-turbo');
292
340
  }
293
341
 
294
342
  function isImageModel(model: string): boolean {
295
- return model.includes("dall-e") || model.includes("gpt-image") || model.includes("chatgpt-image");
343
+ return model.includes('dall-e') || model.includes('gpt-image') || model.includes('chatgpt-image');
296
344
  }
@@ -6,13 +6,9 @@
6
6
  * max-tokens limits for non-Claude models, etc.).
7
7
  */
8
8
 
9
- import { type ModelOptionInfoItem, OptionType } from "../types.js";
10
- import { getMaxOutputTokens } from "./context-windows.js";
11
- import {
12
- getAvailableEffortLevels,
13
- isClaudeVersionGTE,
14
- supportsAdaptiveThinking,
15
- } from "./version-parsing.js";
9
+ import { type ModelOptionInfoItem, OptionType } from '../types.js';
10
+ import { getMaxOutputTokens } from './context-windows.js';
11
+ import { getAvailableEffortLevels, isClaudeVersionGTE, supportsAdaptiveThinking } from './version-parsing.js';
16
12
 
17
13
  // ============================================================================
18
14
  // Max tokens
@@ -39,10 +35,11 @@ export function getClaudeMaxTokensLimit(model: string): number {
39
35
  export function buildClaudeCacheOptions(): ModelOptionInfoItem[] {
40
36
  return [
41
37
  {
42
- name: "cache_enabled",
38
+ name: 'cache_enabled',
43
39
  type: OptionType.boolean,
44
40
  default: false,
45
- description: "Enable prompt caching. Injects cache breakpoints at the system prompt, tools, and conversation pivot.",
41
+ description:
42
+ 'Enable prompt caching. Injects cache breakpoints at the system prompt, tools, and conversation pivot.',
46
43
  },
47
44
  ];
48
45
  }
@@ -55,10 +52,10 @@ export function buildClaudeCacheTtlOptions(cacheEnabled?: boolean): ModelOptionI
55
52
  if (!cacheEnabled) return [];
56
53
  return [
57
54
  {
58
- name: "cache_ttl",
55
+ name: 'cache_ttl',
59
56
  type: OptionType.enum,
60
- enum: { "5 minutes (default)": "5m", "1 hour": "1h" },
61
- default: "5m",
57
+ enum: { '5 minutes (default)': '5m', '1 hour': '1h' },
58
+ default: '5m',
62
59
  description: "TTL for cache breakpoints. '1h' requires extended caching to be enabled on your account.",
63
60
  },
64
61
  ];
@@ -77,10 +74,11 @@ export function buildClaudeEffortOptions(model: string): ModelOptionInfoItem[] {
77
74
  if (!effortLevels) return [];
78
75
  return [
79
76
  {
80
- name: "effort",
77
+ name: 'effort',
81
78
  type: OptionType.enum,
82
79
  enum: effortLevels,
83
- description: "Controls how many tokens Claude uses when responding. Lower effort trades thoroughness for speed and cost savings.",
80
+ description:
81
+ 'Controls how many tokens Claude uses when responding. Lower effort trades thoroughness for speed and cost savings.',
84
82
  },
85
83
  ];
86
84
  }
@@ -103,12 +101,12 @@ export function buildClaudeThinkingBudgetOption(model: string): ModelOptionInfoI
103
101
  if (!isClaudeVersionGTE(model, 3, 7) || supportsAdaptiveThinking(model)) return [];
104
102
  return [
105
103
  {
106
- name: "thinking_budget_tokens",
104
+ name: 'thinking_budget_tokens',
107
105
  type: OptionType.numeric,
108
106
  min: 1024,
109
107
  integer: true,
110
108
  step: 1024,
111
- description: "Token budget for extended thinking. Enables thinking when set.",
109
+ description: 'Token budget for extended thinking. Enables thinking when set.',
112
110
  },
113
111
  ];
114
112
  }
@@ -124,7 +122,7 @@ export function buildClaudeIncludeThoughtsOption(model: string): ModelOptionInfo
124
122
  if (!isClaudeVersionGTE(model, 3, 7)) return [];
125
123
  return [
126
124
  {
127
- name: "include_thoughts",
125
+ name: 'include_thoughts',
128
126
  type: OptionType.boolean,
129
127
  default: false,
130
128
  description: "Include the model's thinking content in the response.",
@@ -137,8 +135,5 @@ export function buildClaudeIncludeThoughtsOption(model: string): ModelOptionInfo
137
135
  * Kept for backwards compatibility — delegates to the two new helpers.
138
136
  */
139
137
  export function buildClaudeThinkingOptions(model: string): ModelOptionInfoItem[] {
140
- return [
141
- ...buildClaudeThinkingBudgetOption(model),
142
- ...buildClaudeIncludeThoughtsOption(model),
143
- ];
138
+ return [...buildClaudeThinkingBudgetOption(model), ...buildClaudeIncludeThoughtsOption(model)];
144
139
  }