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