@llumiverse/common 1.3.0 → 1.4.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.
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,46 +1,112 @@
1
- import { ModelModalities } from "../types.js";
1
+ import type { ModelModalities } from '../types.js';
2
2
 
3
3
  // Record of Vertex AI model capabilities keyed by model ID (last path segment, lowercased)
4
- const RECORD_MODEL_CAPABILITIES: Record<string, { input: ModelModalities; output: ModelModalities; tool_support?: boolean }> = {
5
- "gemini-2.0-flash-lite-001": { input: { text: true, image: true, video: true, audio: true, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false },
4
+ const RECORD_MODEL_CAPABILITIES: Record<
5
+ string,
6
+ { input: ModelModalities; output: ModelModalities; tool_support?: boolean }
7
+ > = {
8
+ 'gemini-2.0-flash-lite-001': {
9
+ input: { text: true, image: true, video: true, audio: true, embed: false },
10
+ output: { text: true, image: false, video: false, audio: false, embed: false },
11
+ tool_support: false,
12
+ },
6
13
  };
7
14
 
8
15
  // Populate RECORD_FAMILY_CAPABILITIES as a const record (lowest common denominator for each family)
9
- const RECORD_FAMILY_CAPABILITIES: Record<string, { input: ModelModalities; output: ModelModalities; tool_support?: boolean }> = {
10
- "gemini": { input: { text: true, image: true, video: true, audio: true, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true },
11
- "gemini-2.5-flash-image": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: true, video: false, audio: false, embed: false }, tool_support: false },
12
- "gemini-3.0-pro-image": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: true, video: false, audio: false, embed: false }, tool_support: false },
13
- "gemini-3.0-flash-image": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: true, video: false, audio: false, embed: false }, tool_support: false },
14
- 'imagen': { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: false, image: true, video: false, audio: false, embed: false }, tool_support: false },
15
- "imagen-3.0": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: false, image: true, video: false, audio: false, embed: false }, tool_support: false },
16
- "imagen-3.0-capability": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: false, image: true, video: false, audio: false, embed: false }, tool_support: false },
17
- "imagen-4.0": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: false, image: true, video: false, audio: false, embed: false }, tool_support: false },
18
- "imagen-4.0-capability": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: false, image: true, video: false, audio: false, embed: false }, tool_support: false },
19
- "claude": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true },
20
- "llama": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true },
21
- "llama-2": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false },
22
- "llama-3.2": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true },
23
- "llama-4": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true },
16
+ const RECORD_FAMILY_CAPABILITIES: Record<
17
+ string,
18
+ { input: ModelModalities; output: ModelModalities; tool_support?: boolean }
19
+ > = {
20
+ gemini: {
21
+ input: { text: true, image: true, video: true, audio: true, embed: false },
22
+ output: { text: true, image: false, video: false, audio: false, embed: false },
23
+ tool_support: true,
24
+ },
25
+ 'gemini-2.5-flash-image': {
26
+ input: { text: true, image: true, video: false, audio: false, embed: false },
27
+ output: { text: true, image: true, video: false, audio: false, embed: false },
28
+ tool_support: false,
29
+ },
30
+ 'gemini-3.0-pro-image': {
31
+ input: { text: true, image: true, video: false, audio: false, embed: false },
32
+ output: { text: true, image: true, video: false, audio: false, embed: false },
33
+ tool_support: false,
34
+ },
35
+ 'gemini-3.0-flash-image': {
36
+ input: { text: true, image: true, video: false, audio: false, embed: false },
37
+ output: { text: true, image: true, video: false, audio: false, embed: false },
38
+ tool_support: false,
39
+ },
40
+ imagen: {
41
+ input: { text: true, image: true, video: false, audio: false, embed: false },
42
+ output: { text: false, image: true, video: false, audio: false, embed: false },
43
+ tool_support: false,
44
+ },
45
+ 'imagen-3.0': {
46
+ input: { text: true, image: false, video: false, audio: false, embed: false },
47
+ output: { text: false, image: true, video: false, audio: false, embed: false },
48
+ tool_support: false,
49
+ },
50
+ 'imagen-3.0-capability': {
51
+ input: { text: true, image: true, video: false, audio: false, embed: false },
52
+ output: { text: false, image: true, video: false, audio: false, embed: false },
53
+ tool_support: false,
54
+ },
55
+ 'imagen-4.0': {
56
+ input: { text: true, image: false, video: false, audio: false, embed: false },
57
+ output: { text: false, image: true, video: false, audio: false, embed: false },
58
+ tool_support: false,
59
+ },
60
+ 'imagen-4.0-capability': {
61
+ input: { text: true, image: true, video: false, audio: false, embed: false },
62
+ output: { text: false, image: true, video: false, audio: false, embed: false },
63
+ tool_support: false,
64
+ },
65
+ claude: {
66
+ input: { text: true, image: true, video: false, audio: false, embed: false },
67
+ output: { text: true, image: false, video: false, audio: false, embed: false },
68
+ tool_support: true,
69
+ },
70
+ llama: {
71
+ input: { text: true, image: false, video: false, audio: false, embed: false },
72
+ output: { text: true, image: false, video: false, audio: false, embed: false },
73
+ tool_support: true,
74
+ },
75
+ 'llama-2': {
76
+ input: { text: true, image: false, video: false, audio: false, embed: false },
77
+ output: { text: true, image: false, video: false, audio: false, embed: false },
78
+ tool_support: false,
79
+ },
80
+ 'llama-3.2': {
81
+ input: { text: true, image: true, video: false, audio: false, embed: false },
82
+ output: { text: true, image: false, video: false, audio: false, embed: false },
83
+ tool_support: true,
84
+ },
85
+ 'llama-4': {
86
+ input: { text: true, image: true, video: false, audio: false, embed: false },
87
+ output: { text: true, image: false, video: false, audio: false, embed: false },
88
+ tool_support: true,
89
+ },
24
90
  };
25
91
 
26
92
  // Fallback pattern lists for inferring modalities and tool support
27
- const IMAGE_INPUT_MODELS = ["image"];
28
- const VIDEO_INPUT_MODELS = ["video"];
29
- const AUDIO_INPUT_MODELS = ["audio"];
30
- const TEXT_INPUT_MODELS = ["text"];
31
- const IMAGE_OUTPUT_MODELS = ["image"];
32
- const VIDEO_OUTPUT_MODELS = ["video"];
33
- const AUDIO_OUTPUT_MODELS = ["audio"];
34
- const TEXT_OUTPUT_MODELS = ["text"];
35
- const EMBEDDING_OUTPUT_MODELS = ["embed"];
36
- const TOOL_SUPPORT_MODELS = ["tool", "sonnet", "opus", "gemini", "claude"];
93
+ const IMAGE_INPUT_MODELS = ['image'];
94
+ const VIDEO_INPUT_MODELS = ['video'];
95
+ const AUDIO_INPUT_MODELS = ['audio'];
96
+ const TEXT_INPUT_MODELS = ['text'];
97
+ const IMAGE_OUTPUT_MODELS = ['image'];
98
+ const VIDEO_OUTPUT_MODELS = ['video'];
99
+ const AUDIO_OUTPUT_MODELS = ['audio'];
100
+ const TEXT_OUTPUT_MODELS = ['text'];
101
+ const EMBEDDING_OUTPUT_MODELS = ['embed'];
102
+ const TOOL_SUPPORT_MODELS = ['tool', 'sonnet', 'opus', 'gemini', 'claude'];
37
103
 
38
104
  function modelMatches(modelName: string, patterns: string[]): boolean {
39
- return patterns.some(pattern => modelName.includes(pattern));
105
+ return patterns.some((pattern) => modelName.includes(pattern));
40
106
  }
41
107
 
42
108
  function normalizeVertexAIModelName(modelName: string): string {
43
- const segments = modelName.toLowerCase().split("/");
109
+ const segments = modelName.toLowerCase().split('/');
44
110
  return segments[segments.length - 1];
45
111
  }
46
112
 
@@ -48,11 +114,15 @@ function normalizeVertexAIModelName(modelName: string): string {
48
114
  * Get the full ModelCapabilities for a Vertex AI model.
49
115
  * Checks RECORD_MODEL_CAPABILITIES first, then falls back to pattern-based inference.
50
116
  */
51
- export function getModelCapabilitiesVertexAI(model: string): { input: ModelModalities; output: ModelModalities; tool_support?: boolean } {
117
+ export function getModelCapabilitiesVertexAI(model: string): {
118
+ input: ModelModalities;
119
+ output: ModelModalities;
120
+ tool_support?: boolean;
121
+ } {
52
122
  const normalized = normalizeVertexAIModelName(model);
53
123
  const record = RECORD_MODEL_CAPABILITIES[normalized];
54
124
  if (record) return record;
55
- let bestFamilyKey = undefined;
125
+ let bestFamilyKey: string | undefined;
56
126
  let bestFamilyLength = 0;
57
127
  for (const key of Object.keys(RECORD_FAMILY_CAPABILITIES)) {
58
128
  if (normalized.startsWith(key) && key.length > bestFamilyLength) {
@@ -68,15 +138,15 @@ export function getModelCapabilitiesVertexAI(model: string): { input: ModelModal
68
138
  image: modelMatches(normalized, IMAGE_INPUT_MODELS) || undefined,
69
139
  video: modelMatches(normalized, VIDEO_INPUT_MODELS) || undefined,
70
140
  audio: modelMatches(normalized, AUDIO_INPUT_MODELS) || undefined,
71
- embed: false
141
+ embed: false,
72
142
  };
73
143
  const output: ModelModalities = {
74
144
  text: modelMatches(normalized, TEXT_OUTPUT_MODELS) || undefined,
75
145
  image: modelMatches(normalized, IMAGE_OUTPUT_MODELS) || undefined,
76
146
  video: modelMatches(normalized, VIDEO_OUTPUT_MODELS) || undefined,
77
147
  audio: modelMatches(normalized, AUDIO_OUTPUT_MODELS) || undefined,
78
- embed: modelMatches(normalized, EMBEDDING_OUTPUT_MODELS) || undefined
148
+ embed: modelMatches(normalized, EMBEDDING_OUTPUT_MODELS) || undefined,
79
149
  };
80
150
  const tool_support = modelMatches(normalized, TOOL_SUPPORT_MODELS) || undefined;
81
151
  return { input, output, tool_support };
82
- }
152
+ }
package/src/capability.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { getModelCapabilitiesAnthropic } from "./capability/anthropic.js";
2
- import { getModelCapabilitiesAzureFoundry } from "./capability/azure_foundry.js";
3
- import { getModelCapabilitiesBedrock } from "./capability/bedrock.js";
4
- import { getModelCapabilitiesOpenAI } from "./capability/openai.js";
5
- import { getModelCapabilitiesVertexAI } from "./capability/vertexai.js";
6
- import { type ModelCapabilities, type ModelModalities, Providers } from "./types.js";
1
+ import { getModelCapabilitiesAnthropic } from './capability/anthropic.js';
2
+ import { getModelCapabilitiesAzureFoundry } from './capability/azure_foundry.js';
3
+ import { getModelCapabilitiesBedrock } from './capability/bedrock.js';
4
+ import { getModelCapabilitiesOpenAI } from './capability/openai.js';
5
+ import { getModelCapabilitiesVertexAI } from './capability/vertexai.js';
6
+ import { type ModelCapabilities, type ModelModalities, Providers } from './types.js';
7
7
 
8
8
  export function getModelCapabilities(model: string, provider?: string | Providers): ModelCapabilities {
9
9
  //Check for locations/<location>/ prefix and remove it
10
- if (model.startsWith("locations/")) {
11
- const parts = model.split("/");
10
+ if (model.startsWith('locations/')) {
11
+ const parts = model.split('/');
12
12
  if (parts.length >= 3) {
13
- model = parts.slice(2).join("/");
13
+ model = parts.slice(2).join('/');
14
14
  }
15
15
  }
16
16
  const capabilities = _getModelCapabilities(model, provider);
@@ -47,28 +47,28 @@ function _getModelCapabilities(model: string, provider?: string | Providers): Mo
47
47
  case Providers.xai:
48
48
  // xAI (Grok) models support tool use and are text-based
49
49
  return {
50
- input: { text: true, image: model.includes("vision") },
50
+ input: { text: true, image: model.includes('vision') },
51
51
  output: { text: true },
52
52
  tool_support: true,
53
53
  tool_support_streaming: false, // Conservative - may work but not tested
54
54
  };
55
55
  default:
56
56
  // Guess the provider based on the model name
57
- if (model.startsWith("gpt")) {
57
+ if (model.startsWith('gpt')) {
58
58
  return getModelCapabilitiesOpenAI(model);
59
- } else if (model.startsWith("claude")) {
59
+ } else if (model.startsWith('claude')) {
60
60
  return getModelCapabilitiesAnthropic(model);
61
- } else if (model.startsWith("grok")) {
61
+ } else if (model.startsWith('grok')) {
62
62
  // xAI Grok models
63
63
  return {
64
- input: { text: true, image: model.includes("vision") },
64
+ input: { text: true, image: model.includes('vision') },
65
65
  output: { text: true },
66
66
  tool_support: true,
67
67
  tool_support_streaming: false,
68
68
  };
69
- } else if (model.startsWith("publishers/")) {
69
+ } else if (model.startsWith('publishers/')) {
70
70
  return getModelCapabilitiesVertexAI(model);
71
- } else if (model.startsWith("arn:aws")) {
71
+ } else if (model.startsWith('arn:aws')) {
72
72
  return getModelCapabilitiesBedrock(model);
73
73
  }
74
74
  // Fallback to a generic model with no capabilities
@@ -90,7 +90,7 @@ function getModelCapabilitiesOpenAICompatible(model: string): ModelCapabilities
90
90
  return caps;
91
91
  }
92
92
  const normalized = model.toLowerCase();
93
- const isNonToolModel = NO_TOOL_SUPPORT_PATTERNS.some(p => normalized.includes(p));
93
+ const isNonToolModel = NO_TOOL_SUPPORT_PATTERNS.some((p) => normalized.includes(p));
94
94
  return {
95
95
  input: { text: true },
96
96
  output: { text: true },
@@ -108,4 +108,4 @@ export function modelModalitiesToArray(modalities: ModelModalities): string[] {
108
108
  return Object.entries(modalities)
109
109
  .filter(([_, isSupported]) => isSupported)
110
110
  .map(([modality]) => modality);
111
- }
111
+ }
package/src/index.ts CHANGED
@@ -1,12 +1,13 @@
1
- export * from "./capability.js";
2
- export * from "./options.js";
3
- export * from "./options/anthropic.js";
4
- export * from "./options/bedrock.js";
5
- export * from "./options/context-windows.js";
6
- export * from "./options/fallback.js";
7
- export * from "./options/groq.js";
8
- export * from "./options/openai.js";
9
- export * from "./options/shared-parsing.js";
10
- export * from "./options/version-parsing.js";
11
- export * from "./options/vertexai.js";
12
- export * from "./types.js";
1
+ export * from './capability.js';
2
+ export * from './options/anthropic.js';
3
+ export * from './options/bedrock.js';
4
+ export * from './options/context-windows.js';
5
+ export * from './options/embedding.js';
6
+ export * from './options/fallback.js';
7
+ export * from './options/groq.js';
8
+ export * from './options/openai.js';
9
+ export * from './options/shared-parsing.js';
10
+ export * from './options/version-parsing.js';
11
+ export * from './options/vertexai.js';
12
+ export * from './options.js';
13
+ export * from './types.js';
@@ -1,5 +1,5 @@
1
- import { type ModelOptions, type ModelOptionsInfo, OptionType, SharedOptions } from "../types.js";
2
- import { textOptionsFallback } from "./fallback.js";
1
+ import { type ModelOptions, type ModelOptionsInfo, OptionType, SharedOptions } from '../types.js';
2
+ import { textOptionsFallback } from './fallback.js';
3
3
  import {
4
4
  buildClaudeCacheOptions,
5
5
  buildClaudeCacheTtlOptions,
@@ -7,11 +7,11 @@ import {
7
7
  buildClaudeIncludeThoughtsOption,
8
8
  buildClaudeThinkingBudgetOption,
9
9
  getClaudeMaxTokensLimit,
10
- } from "./shared-parsing.js";
11
- import { hasSamplingParameterRestriction } from "./version-parsing.js";
10
+ } from './shared-parsing.js';
11
+ import { hasSamplingParameterRestriction } from './version-parsing.js';
12
12
 
13
13
  export interface AnthropicClaudeOptions {
14
- _option_id: "anthropic-claude";
14
+ _option_id: 'anthropic-claude';
15
15
  max_tokens?: number;
16
16
  temperature?: number;
17
17
  top_p?: number;
@@ -26,24 +26,27 @@ export interface AnthropicClaudeOptions {
26
26
 
27
27
  export function getAnthropicOptions(model: string, option?: ModelOptions): ModelOptionsInfo {
28
28
  const max_tokens_limit = getClaudeMaxTokensLimit(model);
29
- const excludeOptions = ["max_tokens", "presence_penalty", "frequency_penalty"];
29
+ const excludeOptions = ['max_tokens', 'presence_penalty', 'frequency_penalty'];
30
30
  let commonOptions = textOptionsFallback.options.filter((o) => !excludeOptions.includes(o.name));
31
31
 
32
32
  const hasSamplingRestriction = hasSamplingParameterRestriction(model);
33
33
  if (hasSamplingRestriction) {
34
- commonOptions = commonOptions.filter((o) =>
35
- o.name !== SharedOptions.temperature &&
36
- o.name !== SharedOptions.top_p &&
37
- o.name !== "top_k"
34
+ commonOptions = commonOptions.filter(
35
+ (o) => o.name !== SharedOptions.temperature && o.name !== SharedOptions.top_p && o.name !== 'top_k',
38
36
  );
39
37
  }
40
38
 
41
39
  return {
42
- _option_id: "anthropic-claude",
40
+ _option_id: 'anthropic-claude',
43
41
  options: [
44
42
  {
45
- name: SharedOptions.max_tokens, type: OptionType.numeric, min: 1, max: max_tokens_limit,
46
- integer: true, step: 200, description: "The maximum number of tokens to generate",
43
+ name: SharedOptions.max_tokens,
44
+ type: OptionType.numeric,
45
+ min: 1,
46
+ max: max_tokens_limit,
47
+ integer: true,
48
+ step: 200,
49
+ description: 'The maximum number of tokens to generate',
47
50
  },
48
51
  ...commonOptions,
49
52
  ...buildClaudeEffortOptions(model),