@tanstack/ai-groq 0.5.3 → 0.5.4

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.
@@ -1,70 +1,301 @@
1
- const LLAMA_3_3_70B_VERSATILE = {
2
- name: "llama-3.3-70b-versatile"
3
- };
4
- const LLAMA_4_MAVERICK_17B_128E_INSTRUCT = {
5
- name: "meta-llama/llama-4-maverick-17b-128e-instruct"
6
- };
7
- const LLAMA_4_SCOUT_17B_16E_INSTRUCT = {
8
- name: "meta-llama/llama-4-scout-17b-16e-instruct"
9
- };
10
- const LLAMA_GUARD_4_12B = {
11
- name: "meta-llama/llama-guard-4-12b"
12
- };
13
- const LLAMA_PROMPT_GUARD_2_86M = {
14
- name: "meta-llama/llama-prompt-guard-2-86m"
15
- };
16
- const LLAMA_3_1_8B_INSTANT = {
17
- name: "llama-3.1-8b-instant"
18
- };
19
- const LLAMA_PROMPT_GUARD_2_22M = {
20
- name: "meta-llama/llama-prompt-guard-2-22m"
21
- };
22
- const GPT_OSS_120B = {
23
- name: "openai/gpt-oss-120b"
24
- };
25
- const GPT_OSS_SAFEGUARD_20B = {
26
- name: "openai/gpt-oss-safeguard-20b"
27
- };
28
- const GPT_OSS_20B = {
29
- name: "openai/gpt-oss-20b"
30
- };
31
- const KIMI_K2_INSTRUCT_0905 = {
32
- name: "moonshotai/kimi-k2-instruct-0905"
33
- };
34
- const QWEN3_32B = {
35
- name: "qwen/qwen3-32b"
36
- };
37
- const GROQ_CHAT_MODELS = [
38
- LLAMA_3_1_8B_INSTANT.name,
39
- LLAMA_3_3_70B_VERSATILE.name,
40
- LLAMA_4_MAVERICK_17B_128E_INSTRUCT.name,
41
- LLAMA_4_SCOUT_17B_16E_INSTRUCT.name,
42
- LLAMA_GUARD_4_12B.name,
43
- LLAMA_PROMPT_GUARD_2_86M.name,
44
- LLAMA_PROMPT_GUARD_2_22M.name,
45
- GPT_OSS_20B.name,
46
- GPT_OSS_120B.name,
47
- GPT_OSS_SAFEGUARD_20B.name,
48
- KIMI_K2_INSTRUCT_0905.name,
49
- QWEN3_32B.name
1
+ /**
2
+ * All supported Groq chat model identifiers.
3
+ */
4
+ var GROQ_CHAT_MODELS = [
5
+ {
6
+ name: "llama-3.1-8b-instant",
7
+ context_window: 131072,
8
+ max_completion_tokens: 131072,
9
+ pricing: {
10
+ input: { normal: .05 },
11
+ output: { normal: .08 }
12
+ },
13
+ supports: {
14
+ input: ["text"],
15
+ output: ["text"],
16
+ endpoints: ["chat"],
17
+ features: [
18
+ "streaming",
19
+ "json_object",
20
+ "tools"
21
+ ],
22
+ tools: []
23
+ }
24
+ }.name,
25
+ {
26
+ name: "llama-3.3-70b-versatile",
27
+ context_window: 131072,
28
+ max_completion_tokens: 32768,
29
+ pricing: {
30
+ input: { normal: .59 },
31
+ output: { normal: .79 }
32
+ },
33
+ supports: {
34
+ input: ["text"],
35
+ output: ["text"],
36
+ endpoints: ["chat"],
37
+ features: [
38
+ "streaming",
39
+ "tools",
40
+ "json_object"
41
+ ],
42
+ tools: []
43
+ }
44
+ }.name,
45
+ {
46
+ name: "meta-llama/llama-4-maverick-17b-128e-instruct",
47
+ context_window: 131072,
48
+ max_completion_tokens: 8192,
49
+ pricing: {
50
+ input: { normal: .2 },
51
+ output: { normal: .6 }
52
+ },
53
+ supports: {
54
+ input: ["text", "image"],
55
+ output: ["text"],
56
+ endpoints: ["chat"],
57
+ features: [
58
+ "streaming",
59
+ "tools",
60
+ "json_object",
61
+ "json_schema",
62
+ "vision"
63
+ ],
64
+ tools: []
65
+ }
66
+ }.name,
67
+ {
68
+ name: "meta-llama/llama-4-scout-17b-16e-instruct",
69
+ context_window: 131072,
70
+ max_completion_tokens: 8192,
71
+ pricing: {
72
+ input: { normal: .05 },
73
+ output: { normal: .08 }
74
+ },
75
+ supports: {
76
+ input: ["text", "image"],
77
+ output: ["text"],
78
+ endpoints: ["chat"],
79
+ features: [
80
+ "streaming",
81
+ "tools",
82
+ "json_object"
83
+ ],
84
+ tools: []
85
+ }
86
+ }.name,
87
+ {
88
+ name: "meta-llama/llama-guard-4-12b",
89
+ context_window: 131072,
90
+ max_completion_tokens: 1024,
91
+ pricing: {
92
+ input: { normal: .2 },
93
+ output: { normal: .2 }
94
+ },
95
+ supports: {
96
+ input: ["text", "image"],
97
+ output: ["text"],
98
+ endpoints: ["chat"],
99
+ features: [
100
+ "streaming",
101
+ "json_object",
102
+ "content_moderation",
103
+ "vision"
104
+ ],
105
+ tools: []
106
+ }
107
+ }.name,
108
+ {
109
+ name: "meta-llama/llama-prompt-guard-2-86m",
110
+ context_window: 512,
111
+ max_completion_tokens: 512,
112
+ pricing: {
113
+ input: { normal: .04 },
114
+ output: { normal: .04 }
115
+ },
116
+ supports: {
117
+ input: ["text"],
118
+ output: ["text"],
119
+ endpoints: ["chat"],
120
+ features: [
121
+ "streaming",
122
+ "content_moderation",
123
+ "json_object"
124
+ ],
125
+ tools: []
126
+ }
127
+ }.name,
128
+ {
129
+ name: "meta-llama/llama-prompt-guard-2-22m",
130
+ context_window: 512,
131
+ max_completion_tokens: 512,
132
+ pricing: {
133
+ input: { normal: .03 },
134
+ output: { normal: .03 }
135
+ },
136
+ supports: {
137
+ input: ["text"],
138
+ output: ["text"],
139
+ endpoints: ["chat"],
140
+ features: ["streaming", "content_moderation"],
141
+ tools: []
142
+ }
143
+ }.name,
144
+ {
145
+ name: "openai/gpt-oss-20b",
146
+ context_window: 131072,
147
+ max_completion_tokens: 65536,
148
+ pricing: {
149
+ input: {
150
+ normal: .075,
151
+ cached: .037
152
+ },
153
+ output: { normal: .3 }
154
+ },
155
+ supports: {
156
+ input: ["text"],
157
+ output: ["text"],
158
+ endpoints: ["chat"],
159
+ features: [
160
+ "streaming",
161
+ "browser_search",
162
+ "code_execution",
163
+ "json_object",
164
+ "json_schema",
165
+ "reasoning",
166
+ "tools"
167
+ ],
168
+ tools: []
169
+ }
170
+ }.name,
171
+ {
172
+ name: "openai/gpt-oss-120b",
173
+ context_window: 131072,
174
+ max_completion_tokens: 65536,
175
+ pricing: {
176
+ input: {
177
+ normal: .15,
178
+ cached: .075
179
+ },
180
+ output: { normal: .6 }
181
+ },
182
+ supports: {
183
+ input: ["text"],
184
+ output: ["text"],
185
+ endpoints: ["chat"],
186
+ features: [
187
+ "streaming",
188
+ "json_object",
189
+ "json_schema",
190
+ "tools",
191
+ "browser_search",
192
+ "code_execution",
193
+ "reasoning"
194
+ ],
195
+ tools: []
196
+ }
197
+ }.name,
198
+ {
199
+ name: "openai/gpt-oss-safeguard-20b",
200
+ context_window: 131072,
201
+ max_completion_tokens: 65536,
202
+ pricing: {
203
+ input: {
204
+ normal: .075,
205
+ cached: .037
206
+ },
207
+ output: { normal: .3 }
208
+ },
209
+ supports: {
210
+ input: ["text"],
211
+ output: ["text"],
212
+ endpoints: ["chat"],
213
+ features: [
214
+ "streaming",
215
+ "tools",
216
+ "browser_search",
217
+ "code_execution",
218
+ "json_object",
219
+ "json_schema",
220
+ "reasoning",
221
+ "content_moderation"
222
+ ],
223
+ tools: []
224
+ }
225
+ }.name,
226
+ {
227
+ name: "moonshotai/kimi-k2-instruct-0905",
228
+ context_window: 262144,
229
+ max_completion_tokens: 16384,
230
+ pricing: {
231
+ input: {
232
+ normal: 1,
233
+ cached: .5
234
+ },
235
+ output: { normal: 3 }
236
+ },
237
+ supports: {
238
+ input: ["text"],
239
+ output: ["text"],
240
+ endpoints: ["chat"],
241
+ features: [
242
+ "streaming",
243
+ "tools",
244
+ "json_object",
245
+ "json_schema"
246
+ ],
247
+ tools: []
248
+ }
249
+ }.name,
250
+ {
251
+ name: "qwen/qwen3-32b",
252
+ context_window: 131072,
253
+ max_completion_tokens: 40960,
254
+ pricing: {
255
+ input: { normal: .29 },
256
+ output: { normal: .59 }
257
+ },
258
+ supports: {
259
+ input: ["text"],
260
+ output: ["text"],
261
+ endpoints: ["chat"],
262
+ features: [
263
+ "streaming",
264
+ "json_object",
265
+ "tools",
266
+ "reasoning"
267
+ ],
268
+ tools: []
269
+ }
270
+ }.name
50
271
  ];
51
- const GROQ_TRANSCRIPTION_MODELS = [
52
- "whisper-large-v3-turbo",
53
- "whisper-large-v3"
54
- ];
55
- const ORPHEUS_V1_ENGLISH = {
56
- name: "canopylabs/orpheus-v1-english"
57
- };
58
- const ORPHEUS_ARABIC_SAUDI = {
59
- name: "canopylabs/orpheus-arabic-saudi"
60
- };
61
- const GROQ_TTS_MODELS = [
62
- ORPHEUS_V1_ENGLISH.name,
63
- ORPHEUS_ARABIC_SAUDI.name
64
- ];
65
- export {
66
- GROQ_CHAT_MODELS,
67
- GROQ_TRANSCRIPTION_MODELS,
68
- GROQ_TTS_MODELS
69
- };
70
- //# sourceMappingURL=model-meta.js.map
272
+ /**
273
+ * All supported Groq transcription model identifiers.
274
+ */
275
+ var GROQ_TRANSCRIPTION_MODELS = ["whisper-large-v3-turbo", "whisper-large-v3"];
276
+ /**
277
+ * All supported Groq TTS model identifiers.
278
+ */
279
+ var GROQ_TTS_MODELS = [{
280
+ name: "canopylabs/orpheus-v1-english",
281
+ pricing: { input: { normal: 22 } },
282
+ supports: {
283
+ input: ["text"],
284
+ output: ["audio"],
285
+ endpoints: ["tts"],
286
+ features: []
287
+ }
288
+ }.name, {
289
+ name: "canopylabs/orpheus-arabic-saudi",
290
+ pricing: { input: { normal: 40 } },
291
+ supports: {
292
+ input: ["text"],
293
+ output: ["audio"],
294
+ endpoints: ["tts"],
295
+ features: []
296
+ }
297
+ }.name];
298
+ //#endregion
299
+ export { GROQ_CHAT_MODELS, GROQ_TRANSCRIPTION_MODELS, GROQ_TTS_MODELS };
300
+
301
+ //# sourceMappingURL=model-meta.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model-meta.js","sources":["../../src/model-meta.ts"],"sourcesContent":["import type { GroqTextProviderOptions } from './text/text-provider-options'\nimport type { GroqTTSProviderOptions } from './audio/tts-provider-options'\n\n/**\n * Internal metadata structure describing a Groq model's capabilities and pricing.\n */\ninterface ModelMeta<TProviderOptions = unknown> {\n name: string\n context_window?: number\n max_completion_tokens?: number\n pricing: {\n input?: { normal: number; cached?: number }\n output?: { normal: number }\n }\n supports: {\n input: Array<'text' | 'image' | 'audio'>\n output: Array<'text' | 'audio'>\n endpoints: Array<'chat' | 'tts' | 'transcription' | 'batch'>\n\n features: Array<\n | 'streaming'\n | 'tools'\n | 'json_object'\n | 'browser_search'\n | 'code_execution'\n | 'reasoning'\n | 'content_moderation'\n | 'json_schema'\n | 'vision'\n >\n tools?: ReadonlyArray<never>\n }\n /**\n * Type-level description of which provider options this model supports.\n */\n providerOptions?: TProviderOptions\n}\n\nconst LLAMA_3_3_70B_VERSATILE = {\n name: 'llama-3.3-70b-versatile',\n context_window: 131_072,\n max_completion_tokens: 32_768,\n pricing: {\n input: {\n normal: 0.59,\n },\n output: {\n normal: 0.79,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'tools', 'json_object'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_4_MAVERICK_17B_128E_INSTRUCT = {\n name: 'meta-llama/llama-4-maverick-17b-128e-instruct',\n context_window: 131_072,\n max_completion_tokens: 8_192,\n pricing: {\n input: {\n normal: 0.2,\n },\n output: {\n normal: 0.6,\n },\n },\n supports: {\n input: ['text', 'image'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'tools', 'json_object', 'json_schema', 'vision'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_4_SCOUT_17B_16E_INSTRUCT = {\n name: 'meta-llama/llama-4-scout-17b-16e-instruct',\n context_window: 131_072,\n max_completion_tokens: 8_192,\n pricing: {\n input: {\n normal: 0.05,\n },\n output: {\n normal: 0.08,\n },\n },\n supports: {\n input: ['text', 'image'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'tools', 'json_object'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_GUARD_4_12B = {\n name: 'meta-llama/llama-guard-4-12b',\n context_window: 131_072,\n max_completion_tokens: 1024,\n pricing: {\n input: {\n normal: 0.2,\n },\n output: {\n normal: 0.2,\n },\n },\n supports: {\n input: ['text', 'image'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'json_object', 'content_moderation', 'vision'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_PROMPT_GUARD_2_86M = {\n name: 'meta-llama/llama-prompt-guard-2-86m',\n context_window: 512,\n max_completion_tokens: 512,\n pricing: {\n input: {\n normal: 0.04,\n },\n output: {\n normal: 0.04,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'content_moderation', 'json_object'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_3_1_8B_INSTANT = {\n name: 'llama-3.1-8b-instant',\n context_window: 131_072,\n max_completion_tokens: 131_072,\n pricing: {\n input: {\n normal: 0.05,\n },\n output: {\n normal: 0.08,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'json_object', 'tools'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_PROMPT_GUARD_2_22M = {\n name: 'meta-llama/llama-prompt-guard-2-22m',\n context_window: 512,\n max_completion_tokens: 512,\n pricing: {\n input: {\n normal: 0.03,\n },\n output: {\n normal: 0.03,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'content_moderation'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst GPT_OSS_120B = {\n name: 'openai/gpt-oss-120b',\n context_window: 131_072,\n max_completion_tokens: 65_536,\n pricing: {\n input: {\n normal: 0.15,\n cached: 0.075,\n },\n output: {\n normal: 0.6,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: [\n 'streaming',\n 'json_object',\n 'json_schema',\n 'tools',\n 'browser_search',\n 'code_execution',\n 'reasoning',\n ],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst GPT_OSS_SAFEGUARD_20B = {\n name: 'openai/gpt-oss-safeguard-20b',\n context_window: 131_072,\n max_completion_tokens: 65_536,\n pricing: {\n input: {\n normal: 0.075,\n cached: 0.037,\n },\n output: {\n normal: 0.3,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: [\n 'streaming',\n 'tools',\n 'browser_search',\n 'code_execution',\n 'json_object',\n 'json_schema',\n 'reasoning',\n 'content_moderation',\n ],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst GPT_OSS_20B = {\n name: 'openai/gpt-oss-20b',\n context_window: 131_072,\n max_completion_tokens: 65_536,\n pricing: {\n input: {\n normal: 0.075,\n cached: 0.037,\n },\n output: {\n normal: 0.3,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: [\n 'streaming',\n 'browser_search',\n 'code_execution',\n 'json_object',\n 'json_schema',\n 'reasoning',\n 'tools',\n ],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst KIMI_K2_INSTRUCT_0905 = {\n name: 'moonshotai/kimi-k2-instruct-0905',\n context_window: 262_144,\n max_completion_tokens: 16_384,\n pricing: {\n input: {\n normal: 1,\n cached: 0.5,\n },\n output: {\n normal: 3,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'tools', 'json_object', 'json_schema'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst QWEN3_32B = {\n name: 'qwen/qwen3-32b',\n context_window: 131_072,\n max_completion_tokens: 40_960,\n pricing: {\n input: {\n normal: 0.29,\n },\n output: {\n normal: 0.59,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'json_object', 'tools', 'reasoning'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\n/**\n * All supported Groq chat model identifiers.\n */\nexport const GROQ_CHAT_MODELS = [\n LLAMA_3_1_8B_INSTANT.name,\n LLAMA_3_3_70B_VERSATILE.name,\n LLAMA_4_MAVERICK_17B_128E_INSTRUCT.name,\n LLAMA_4_SCOUT_17B_16E_INSTRUCT.name,\n LLAMA_GUARD_4_12B.name,\n LLAMA_PROMPT_GUARD_2_86M.name,\n LLAMA_PROMPT_GUARD_2_22M.name,\n GPT_OSS_20B.name,\n GPT_OSS_120B.name,\n GPT_OSS_SAFEGUARD_20B.name,\n KIMI_K2_INSTRUCT_0905.name,\n QWEN3_32B.name,\n] as const\n\n/**\n * Union type of all supported Groq chat model names.\n */\nexport type GroqChatModels = (typeof GROQ_CHAT_MODELS)[number]\n\n/**\n * Type-only map from Groq chat model name to its supported input modalities.\n */\nexport type GroqModelInputModalitiesByName = {\n [LLAMA_3_1_8B_INSTANT.name]: typeof LLAMA_3_1_8B_INSTANT.supports.input\n [LLAMA_3_3_70B_VERSATILE.name]: typeof LLAMA_3_3_70B_VERSATILE.supports.input\n [LLAMA_4_MAVERICK_17B_128E_INSTRUCT.name]: typeof LLAMA_4_MAVERICK_17B_128E_INSTRUCT.supports.input\n [LLAMA_4_SCOUT_17B_16E_INSTRUCT.name]: typeof LLAMA_4_SCOUT_17B_16E_INSTRUCT.supports.input\n [LLAMA_GUARD_4_12B.name]: typeof LLAMA_GUARD_4_12B.supports.input\n [LLAMA_PROMPT_GUARD_2_86M.name]: typeof LLAMA_PROMPT_GUARD_2_86M.supports.input\n [LLAMA_PROMPT_GUARD_2_22M.name]: typeof LLAMA_PROMPT_GUARD_2_22M.supports.input\n [GPT_OSS_20B.name]: typeof GPT_OSS_20B.supports.input\n [GPT_OSS_120B.name]: typeof GPT_OSS_120B.supports.input\n [GPT_OSS_SAFEGUARD_20B.name]: typeof GPT_OSS_SAFEGUARD_20B.supports.input\n [KIMI_K2_INSTRUCT_0905.name]: typeof KIMI_K2_INSTRUCT_0905.supports.input\n [QWEN3_32B.name]: typeof QWEN3_32B.supports.input\n}\n\n/**\n * Type-only map from Groq chat model name to its provider options type.\n */\nexport type GroqChatModelProviderOptionsByName = {\n [K in (typeof GROQ_CHAT_MODELS)[number]]: GroqTextProviderOptions\n}\n\n/**\n * Type-only map from Groq chat model name to its supported provider tools.\n * Groq exposes no provider-specific tool factories, so every model gets an\n * empty tuple. This ensures that passing an Anthropic/OpenAI ProviderTool to\n * a Groq adapter produces a compile-time type error.\n */\nexport type GroqChatModelToolCapabilitiesByName = {\n [LLAMA_3_1_8B_INSTANT.name]: typeof LLAMA_3_1_8B_INSTANT.supports.tools\n [LLAMA_3_3_70B_VERSATILE.name]: typeof LLAMA_3_3_70B_VERSATILE.supports.tools\n [LLAMA_4_MAVERICK_17B_128E_INSTRUCT.name]: typeof LLAMA_4_MAVERICK_17B_128E_INSTRUCT.supports.tools\n [LLAMA_4_SCOUT_17B_16E_INSTRUCT.name]: typeof LLAMA_4_SCOUT_17B_16E_INSTRUCT.supports.tools\n [LLAMA_GUARD_4_12B.name]: typeof LLAMA_GUARD_4_12B.supports.tools\n [LLAMA_PROMPT_GUARD_2_86M.name]: typeof LLAMA_PROMPT_GUARD_2_86M.supports.tools\n [LLAMA_PROMPT_GUARD_2_22M.name]: typeof LLAMA_PROMPT_GUARD_2_22M.supports.tools\n [GPT_OSS_20B.name]: typeof GPT_OSS_20B.supports.tools\n [GPT_OSS_120B.name]: typeof GPT_OSS_120B.supports.tools\n [GPT_OSS_SAFEGUARD_20B.name]: typeof GPT_OSS_SAFEGUARD_20B.supports.tools\n [KIMI_K2_INSTRUCT_0905.name]: typeof KIMI_K2_INSTRUCT_0905.supports.tools\n [QWEN3_32B.name]: typeof QWEN3_32B.supports.tools\n}\n\n/**\n * Type-only map from Groq TTS model name to its provider options type.\n */\nexport type GroqTTSModelProviderOptionsByName = {\n [K in GroqTTSModel]: GroqTTSProviderOptions\n}\n\n/**\n * Resolves the provider options type for a specific Groq model.\n * Checks TTS models first, then chat models, then falls back to generic options.\n */\nexport type ResolveProviderOptions<TModel extends string> =\n TModel extends GroqTTSModel\n ? GroqTTSProviderOptions\n : TModel extends keyof GroqChatModelProviderOptionsByName\n ? GroqChatModelProviderOptionsByName[TModel]\n : GroqTextProviderOptions\n\n/**\n * Resolve input modalities for a specific model.\n * If the model has explicit modalities in the map, use those; otherwise use text only.\n */\nexport type ResolveInputModalities<TModel extends string> =\n TModel extends keyof GroqModelInputModalitiesByName\n ? GroqModelInputModalitiesByName[TModel]\n : readonly ['text']\n\n/**\n * All supported Groq transcription model identifiers.\n */\nexport const GROQ_TRANSCRIPTION_MODELS = [\n 'whisper-large-v3-turbo',\n 'whisper-large-v3',\n] as const\n\n/**\n * Union type of all supported Groq transcription model names.\n */\nexport type GroqTranscriptionModel = (typeof GROQ_TRANSCRIPTION_MODELS)[number]\n\n// ============================================================================\n// TTS Models\n// ============================================================================\n\nconst ORPHEUS_V1_ENGLISH = {\n name: 'canopylabs/orpheus-v1-english',\n pricing: {\n input: {\n normal: 22,\n },\n },\n supports: {\n input: ['text'],\n output: ['audio'],\n endpoints: ['tts'],\n features: [],\n },\n} as const satisfies ModelMeta<GroqTTSProviderOptions>\n\nconst ORPHEUS_ARABIC_SAUDI = {\n name: 'canopylabs/orpheus-arabic-saudi',\n pricing: {\n input: {\n normal: 40,\n },\n },\n supports: {\n input: ['text'],\n output: ['audio'],\n endpoints: ['tts'],\n features: [],\n },\n} as const satisfies ModelMeta<GroqTTSProviderOptions>\n\n/**\n * All supported Groq TTS model identifiers.\n */\nexport const GROQ_TTS_MODELS = [\n ORPHEUS_V1_ENGLISH.name,\n ORPHEUS_ARABIC_SAUDI.name,\n] as const\n\n/**\n * Union type of all supported Groq TTS model names.\n */\nexport type GroqTTSModel = (typeof GROQ_TTS_MODELS)[number]\n"],"names":[],"mappings":"AAsCA,MAAM,0BAA0B;AAAA,EAC9B,MAAM;AAkBR;AAEA,MAAM,qCAAqC;AAAA,EACzC,MAAM;AAkBR;AAEA,MAAM,iCAAiC;AAAA,EACrC,MAAM;AAkBR;AAEA,MAAM,oBAAoB;AAAA,EACxB,MAAM;AAkBR;AAEA,MAAM,2BAA2B;AAAA,EAC/B,MAAM;AAkBR;AAEA,MAAM,uBAAuB;AAAA,EAC3B,MAAM;AAkBR;AAEA,MAAM,2BAA2B;AAAA,EAC/B,MAAM;AAkBR;AAEA,MAAM,eAAe;AAAA,EACnB,MAAM;AA2BR;AAEA,MAAM,wBAAwB;AAAA,EAC5B,MAAM;AA4BR;AAEA,MAAM,cAAc;AAAA,EAClB,MAAM;AA2BR;AAEA,MAAM,wBAAwB;AAAA,EAC5B,MAAM;AAmBR;AAEA,MAAM,YAAY;AAAA,EAChB,MAAM;AAkBR;AAKO,MAAM,mBAAmB;AAAA,EAC9B,qBAAqB;AAAA,EACrB,wBAAwB;AAAA,EACxB,mCAAmC;AAAA,EACnC,+BAA+B;AAAA,EAC/B,kBAAkB;AAAA,EAClB,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,UAAU;AACZ;AAmFO,MAAM,4BAA4B;AAAA,EACvC;AAAA,EACA;AACF;AAWA,MAAM,qBAAqB;AAAA,EACzB,MAAM;AAYR;AAEA,MAAM,uBAAuB;AAAA,EAC3B,MAAM;AAYR;AAKO,MAAM,kBAAkB;AAAA,EAC7B,mBAAmB;AAAA,EACnB,qBAAqB;AACvB;"}
1
+ {"version":3,"file":"model-meta.js","names":[],"sources":["../../src/model-meta.ts"],"sourcesContent":["import type { GroqTextProviderOptions } from './text/text-provider-options'\nimport type { GroqTTSProviderOptions } from './audio/tts-provider-options'\n\n/**\n * Internal metadata structure describing a Groq model's capabilities and pricing.\n */\ninterface ModelMeta<TProviderOptions = unknown> {\n name: string\n context_window?: number\n max_completion_tokens?: number\n pricing: {\n input?: { normal: number; cached?: number }\n output?: { normal: number }\n }\n supports: {\n input: Array<'text' | 'image' | 'audio'>\n output: Array<'text' | 'audio'>\n endpoints: Array<'chat' | 'tts' | 'transcription' | 'batch'>\n\n features: Array<\n | 'streaming'\n | 'tools'\n | 'json_object'\n | 'browser_search'\n | 'code_execution'\n | 'reasoning'\n | 'content_moderation'\n | 'json_schema'\n | 'vision'\n >\n tools?: ReadonlyArray<never>\n }\n /**\n * Type-level description of which provider options this model supports.\n */\n providerOptions?: TProviderOptions\n}\n\nconst LLAMA_3_3_70B_VERSATILE = {\n name: 'llama-3.3-70b-versatile',\n context_window: 131_072,\n max_completion_tokens: 32_768,\n pricing: {\n input: {\n normal: 0.59,\n },\n output: {\n normal: 0.79,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'tools', 'json_object'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_4_MAVERICK_17B_128E_INSTRUCT = {\n name: 'meta-llama/llama-4-maverick-17b-128e-instruct',\n context_window: 131_072,\n max_completion_tokens: 8_192,\n pricing: {\n input: {\n normal: 0.2,\n },\n output: {\n normal: 0.6,\n },\n },\n supports: {\n input: ['text', 'image'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'tools', 'json_object', 'json_schema', 'vision'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_4_SCOUT_17B_16E_INSTRUCT = {\n name: 'meta-llama/llama-4-scout-17b-16e-instruct',\n context_window: 131_072,\n max_completion_tokens: 8_192,\n pricing: {\n input: {\n normal: 0.05,\n },\n output: {\n normal: 0.08,\n },\n },\n supports: {\n input: ['text', 'image'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'tools', 'json_object'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_GUARD_4_12B = {\n name: 'meta-llama/llama-guard-4-12b',\n context_window: 131_072,\n max_completion_tokens: 1024,\n pricing: {\n input: {\n normal: 0.2,\n },\n output: {\n normal: 0.2,\n },\n },\n supports: {\n input: ['text', 'image'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'json_object', 'content_moderation', 'vision'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_PROMPT_GUARD_2_86M = {\n name: 'meta-llama/llama-prompt-guard-2-86m',\n context_window: 512,\n max_completion_tokens: 512,\n pricing: {\n input: {\n normal: 0.04,\n },\n output: {\n normal: 0.04,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'content_moderation', 'json_object'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_3_1_8B_INSTANT = {\n name: 'llama-3.1-8b-instant',\n context_window: 131_072,\n max_completion_tokens: 131_072,\n pricing: {\n input: {\n normal: 0.05,\n },\n output: {\n normal: 0.08,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'json_object', 'tools'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst LLAMA_PROMPT_GUARD_2_22M = {\n name: 'meta-llama/llama-prompt-guard-2-22m',\n context_window: 512,\n max_completion_tokens: 512,\n pricing: {\n input: {\n normal: 0.03,\n },\n output: {\n normal: 0.03,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'content_moderation'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst GPT_OSS_120B = {\n name: 'openai/gpt-oss-120b',\n context_window: 131_072,\n max_completion_tokens: 65_536,\n pricing: {\n input: {\n normal: 0.15,\n cached: 0.075,\n },\n output: {\n normal: 0.6,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: [\n 'streaming',\n 'json_object',\n 'json_schema',\n 'tools',\n 'browser_search',\n 'code_execution',\n 'reasoning',\n ],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst GPT_OSS_SAFEGUARD_20B = {\n name: 'openai/gpt-oss-safeguard-20b',\n context_window: 131_072,\n max_completion_tokens: 65_536,\n pricing: {\n input: {\n normal: 0.075,\n cached: 0.037,\n },\n output: {\n normal: 0.3,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: [\n 'streaming',\n 'tools',\n 'browser_search',\n 'code_execution',\n 'json_object',\n 'json_schema',\n 'reasoning',\n 'content_moderation',\n ],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst GPT_OSS_20B = {\n name: 'openai/gpt-oss-20b',\n context_window: 131_072,\n max_completion_tokens: 65_536,\n pricing: {\n input: {\n normal: 0.075,\n cached: 0.037,\n },\n output: {\n normal: 0.3,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: [\n 'streaming',\n 'browser_search',\n 'code_execution',\n 'json_object',\n 'json_schema',\n 'reasoning',\n 'tools',\n ],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst KIMI_K2_INSTRUCT_0905 = {\n name: 'moonshotai/kimi-k2-instruct-0905',\n context_window: 262_144,\n max_completion_tokens: 16_384,\n pricing: {\n input: {\n normal: 1,\n cached: 0.5,\n },\n output: {\n normal: 3,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'tools', 'json_object', 'json_schema'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\nconst QWEN3_32B = {\n name: 'qwen/qwen3-32b',\n context_window: 131_072,\n max_completion_tokens: 40_960,\n pricing: {\n input: {\n normal: 0.29,\n },\n output: {\n normal: 0.59,\n },\n },\n supports: {\n input: ['text'],\n output: ['text'],\n endpoints: ['chat'],\n features: ['streaming', 'json_object', 'tools', 'reasoning'],\n tools: [] as const,\n },\n} as const satisfies ModelMeta<GroqTextProviderOptions>\n\n/**\n * All supported Groq chat model identifiers.\n */\nexport const GROQ_CHAT_MODELS = [\n LLAMA_3_1_8B_INSTANT.name,\n LLAMA_3_3_70B_VERSATILE.name,\n LLAMA_4_MAVERICK_17B_128E_INSTRUCT.name,\n LLAMA_4_SCOUT_17B_16E_INSTRUCT.name,\n LLAMA_GUARD_4_12B.name,\n LLAMA_PROMPT_GUARD_2_86M.name,\n LLAMA_PROMPT_GUARD_2_22M.name,\n GPT_OSS_20B.name,\n GPT_OSS_120B.name,\n GPT_OSS_SAFEGUARD_20B.name,\n KIMI_K2_INSTRUCT_0905.name,\n QWEN3_32B.name,\n] as const\n\n/**\n * Union type of all supported Groq chat model names.\n */\nexport type GroqChatModels = (typeof GROQ_CHAT_MODELS)[number]\n\n/**\n * Type-only map from Groq chat model name to its supported input modalities.\n */\nexport type GroqModelInputModalitiesByName = {\n [LLAMA_3_1_8B_INSTANT.name]: typeof LLAMA_3_1_8B_INSTANT.supports.input\n [LLAMA_3_3_70B_VERSATILE.name]: typeof LLAMA_3_3_70B_VERSATILE.supports.input\n [LLAMA_4_MAVERICK_17B_128E_INSTRUCT.name]: typeof LLAMA_4_MAVERICK_17B_128E_INSTRUCT.supports.input\n [LLAMA_4_SCOUT_17B_16E_INSTRUCT.name]: typeof LLAMA_4_SCOUT_17B_16E_INSTRUCT.supports.input\n [LLAMA_GUARD_4_12B.name]: typeof LLAMA_GUARD_4_12B.supports.input\n [LLAMA_PROMPT_GUARD_2_86M.name]: typeof LLAMA_PROMPT_GUARD_2_86M.supports.input\n [LLAMA_PROMPT_GUARD_2_22M.name]: typeof LLAMA_PROMPT_GUARD_2_22M.supports.input\n [GPT_OSS_20B.name]: typeof GPT_OSS_20B.supports.input\n [GPT_OSS_120B.name]: typeof GPT_OSS_120B.supports.input\n [GPT_OSS_SAFEGUARD_20B.name]: typeof GPT_OSS_SAFEGUARD_20B.supports.input\n [KIMI_K2_INSTRUCT_0905.name]: typeof KIMI_K2_INSTRUCT_0905.supports.input\n [QWEN3_32B.name]: typeof QWEN3_32B.supports.input\n}\n\n/**\n * Type-only map from Groq chat model name to its provider options type.\n */\nexport type GroqChatModelProviderOptionsByName = {\n [K in (typeof GROQ_CHAT_MODELS)[number]]: GroqTextProviderOptions\n}\n\n/**\n * Type-only map from Groq chat model name to its supported provider tools.\n * Groq exposes no provider-specific tool factories, so every model gets an\n * empty tuple. This ensures that passing an Anthropic/OpenAI ProviderTool to\n * a Groq adapter produces a compile-time type error.\n */\nexport type GroqChatModelToolCapabilitiesByName = {\n [LLAMA_3_1_8B_INSTANT.name]: typeof LLAMA_3_1_8B_INSTANT.supports.tools\n [LLAMA_3_3_70B_VERSATILE.name]: typeof LLAMA_3_3_70B_VERSATILE.supports.tools\n [LLAMA_4_MAVERICK_17B_128E_INSTRUCT.name]: typeof LLAMA_4_MAVERICK_17B_128E_INSTRUCT.supports.tools\n [LLAMA_4_SCOUT_17B_16E_INSTRUCT.name]: typeof LLAMA_4_SCOUT_17B_16E_INSTRUCT.supports.tools\n [LLAMA_GUARD_4_12B.name]: typeof LLAMA_GUARD_4_12B.supports.tools\n [LLAMA_PROMPT_GUARD_2_86M.name]: typeof LLAMA_PROMPT_GUARD_2_86M.supports.tools\n [LLAMA_PROMPT_GUARD_2_22M.name]: typeof LLAMA_PROMPT_GUARD_2_22M.supports.tools\n [GPT_OSS_20B.name]: typeof GPT_OSS_20B.supports.tools\n [GPT_OSS_120B.name]: typeof GPT_OSS_120B.supports.tools\n [GPT_OSS_SAFEGUARD_20B.name]: typeof GPT_OSS_SAFEGUARD_20B.supports.tools\n [KIMI_K2_INSTRUCT_0905.name]: typeof KIMI_K2_INSTRUCT_0905.supports.tools\n [QWEN3_32B.name]: typeof QWEN3_32B.supports.tools\n}\n\n/**\n * Type-only map from Groq TTS model name to its provider options type.\n */\nexport type GroqTTSModelProviderOptionsByName = {\n [K in GroqTTSModel]: GroqTTSProviderOptions\n}\n\n/**\n * Resolves the provider options type for a specific Groq model.\n * Checks TTS models first, then chat models, then falls back to generic options.\n */\nexport type ResolveProviderOptions<TModel extends string> =\n TModel extends GroqTTSModel\n ? GroqTTSProviderOptions\n : TModel extends keyof GroqChatModelProviderOptionsByName\n ? GroqChatModelProviderOptionsByName[TModel]\n : GroqTextProviderOptions\n\n/**\n * Resolve input modalities for a specific model.\n * If the model has explicit modalities in the map, use those; otherwise use text only.\n */\nexport type ResolveInputModalities<TModel extends string> =\n TModel extends keyof GroqModelInputModalitiesByName\n ? GroqModelInputModalitiesByName[TModel]\n : readonly ['text']\n\n/**\n * All supported Groq transcription model identifiers.\n */\nexport const GROQ_TRANSCRIPTION_MODELS = [\n 'whisper-large-v3-turbo',\n 'whisper-large-v3',\n] as const\n\n/**\n * Union type of all supported Groq transcription model names.\n */\nexport type GroqTranscriptionModel = (typeof GROQ_TRANSCRIPTION_MODELS)[number]\n\n// ============================================================================\n// TTS Models\n// ============================================================================\n\nconst ORPHEUS_V1_ENGLISH = {\n name: 'canopylabs/orpheus-v1-english',\n pricing: {\n input: {\n normal: 22,\n },\n },\n supports: {\n input: ['text'],\n output: ['audio'],\n endpoints: ['tts'],\n features: [],\n },\n} as const satisfies ModelMeta<GroqTTSProviderOptions>\n\nconst ORPHEUS_ARABIC_SAUDI = {\n name: 'canopylabs/orpheus-arabic-saudi',\n pricing: {\n input: {\n normal: 40,\n },\n },\n supports: {\n input: ['text'],\n output: ['audio'],\n endpoints: ['tts'],\n features: [],\n },\n} as const satisfies ModelMeta<GroqTTSProviderOptions>\n\n/**\n * All supported Groq TTS model identifiers.\n */\nexport const GROQ_TTS_MODELS = [\n ORPHEUS_V1_ENGLISH.name,\n ORPHEUS_ARABIC_SAUDI.name,\n] as const\n\n/**\n * Union type of all supported Groq TTS model names.\n */\nexport type GroqTTSModel = (typeof GROQ_TTS_MODELS)[number]\n"],"mappings":"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"}
@@ -1,29 +1,34 @@
1
1
  import { makeGroqStructuredOutputCompatible } from "../utils/schema-converter.js";
2
+ //#region src/tools/function-tool.ts
3
+ /**
4
+ * Converts a standard Tool to Groq ChatCompletionTool format.
5
+ *
6
+ * Tool schemas are already converted to JSON Schema in the ai layer.
7
+ * We apply Groq-specific transformations for strict mode:
8
+ * - All properties in required array
9
+ * - Optional fields made nullable
10
+ * - additionalProperties: false
11
+ */
2
12
  function convertFunctionToolToAdapterFormat(tool) {
3
- const inputSchema = tool.inputSchema ?? {
4
- type: "object",
5
- properties: {},
6
- required: []
7
- };
8
- if (inputSchema.type === "object" && !inputSchema.properties) {
9
- inputSchema.properties = {};
10
- }
11
- const jsonSchema = makeGroqStructuredOutputCompatible(
12
- inputSchema,
13
- inputSchema.required || []
14
- );
15
- jsonSchema.additionalProperties = false;
16
- return {
17
- type: "function",
18
- function: {
19
- name: tool.name,
20
- description: tool.description,
21
- parameters: jsonSchema,
22
- strict: true
23
- }
24
- };
13
+ const inputSchema = tool.inputSchema ?? {
14
+ type: "object",
15
+ properties: {},
16
+ required: []
17
+ };
18
+ if (inputSchema.type === "object" && !inputSchema.properties) inputSchema.properties = {};
19
+ const jsonSchema = makeGroqStructuredOutputCompatible(inputSchema, inputSchema.required || []);
20
+ jsonSchema.additionalProperties = false;
21
+ return {
22
+ type: "function",
23
+ function: {
24
+ name: tool.name,
25
+ description: tool.description,
26
+ parameters: jsonSchema,
27
+ strict: true
28
+ }
29
+ };
25
30
  }
26
- export {
27
- convertFunctionToolToAdapterFormat
28
- };
29
- //# sourceMappingURL=function-tool.js.map
31
+ //#endregion
32
+ export { convertFunctionToolToAdapterFormat };
33
+
34
+ //# sourceMappingURL=function-tool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"function-tool.js","sources":["../../../src/tools/function-tool.ts"],"sourcesContent":["import { makeGroqStructuredOutputCompatible } from '../utils/schema-converter'\nimport type { JSONSchema, Tool } from '@tanstack/ai'\nimport type { ChatCompletionTool } from '../message-types'\n\nexport type FunctionTool = ChatCompletionTool\n\n/**\n * Converts a standard Tool to Groq ChatCompletionTool format.\n *\n * Tool schemas are already converted to JSON Schema in the ai layer.\n * We apply Groq-specific transformations for strict mode:\n * - All properties in required array\n * - Optional fields made nullable\n * - additionalProperties: false\n */\nexport function convertFunctionToolToAdapterFormat(tool: Tool): FunctionTool {\n const inputSchema = (tool.inputSchema ?? {\n type: 'object',\n properties: {},\n required: [],\n }) as JSONSchema\n\n // Ensure object schemas always have properties (e.g. z.object({}) may produce { type: 'object' } without properties)\n if (inputSchema.type === 'object' && !inputSchema.properties) {\n inputSchema.properties = {}\n }\n\n const jsonSchema = makeGroqStructuredOutputCompatible(\n inputSchema,\n inputSchema.required || [],\n )\n\n jsonSchema.additionalProperties = false\n\n return {\n type: 'function',\n function: {\n name: tool.name,\n description: tool.description,\n parameters: jsonSchema,\n strict: true,\n },\n } satisfies FunctionTool\n}\n"],"names":[],"mappings":";AAeO,SAAS,mCAAmC,MAA0B;AAC3E,QAAM,cAAe,KAAK,eAAe;AAAA,IACvC,MAAM;AAAA,IACN,YAAY,CAAA;AAAA,IACZ,UAAU,CAAA;AAAA,EAAC;AAIb,MAAI,YAAY,SAAS,YAAY,CAAC,YAAY,YAAY;AAC5D,gBAAY,aAAa,CAAA;AAAA,EAC3B;AAEA,QAAM,aAAa;AAAA,IACjB;AAAA,IACA,YAAY,YAAY,CAAA;AAAA,EAAC;AAG3B,aAAW,uBAAuB;AAElC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,UAAU;AAAA,MACR,MAAM,KAAK;AAAA,MACX,aAAa,KAAK;AAAA,MAClB,YAAY;AAAA,MACZ,QAAQ;AAAA,IAAA;AAAA,EACV;AAEJ;"}
1
+ {"version":3,"file":"function-tool.js","names":[],"sources":["../../../src/tools/function-tool.ts"],"sourcesContent":["import { makeGroqStructuredOutputCompatible } from '../utils/schema-converter'\nimport type { JSONSchema, Tool } from '@tanstack/ai'\nimport type { ChatCompletionTool } from '../message-types'\n\nexport type FunctionTool = ChatCompletionTool\n\n/**\n * Converts a standard Tool to Groq ChatCompletionTool format.\n *\n * Tool schemas are already converted to JSON Schema in the ai layer.\n * We apply Groq-specific transformations for strict mode:\n * - All properties in required array\n * - Optional fields made nullable\n * - additionalProperties: false\n */\nexport function convertFunctionToolToAdapterFormat(tool: Tool): FunctionTool {\n const inputSchema = (tool.inputSchema ?? {\n type: 'object',\n properties: {},\n required: [],\n }) as JSONSchema\n\n // Ensure object schemas always have properties (e.g. z.object({}) may produce { type: 'object' } without properties)\n if (inputSchema.type === 'object' && !inputSchema.properties) {\n inputSchema.properties = {}\n }\n\n const jsonSchema = makeGroqStructuredOutputCompatible(\n inputSchema,\n inputSchema.required || [],\n )\n\n jsonSchema.additionalProperties = false\n\n return {\n type: 'function',\n function: {\n name: tool.name,\n description: tool.description,\n parameters: jsonSchema,\n strict: true,\n },\n } satisfies FunctionTool\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAgB,mCAAmC,MAA0B;CAC3E,MAAM,cAAe,KAAK,eAAe;EACvC,MAAM;EACN,YAAY,CAAC;EACb,UAAU,CAAC;CACb;CAGA,IAAI,YAAY,SAAS,YAAY,CAAC,YAAY,YAChD,YAAY,aAAa,CAAC;CAG5B,MAAM,aAAa,mCACjB,aACA,YAAY,YAAY,CAAC,CAC3B;CAEA,WAAW,uBAAuB;CAElC,OAAO;EACL,MAAM;EACN,UAAU;GACR,MAAM,KAAK;GACX,aAAa,KAAK;GAClB,YAAY;GACZ,QAAQ;EACV;CACF;AACF"}
@@ -1,7 +1,3 @@
1
1
  import { convertFunctionToolToAdapterFormat } from "./function-tool.js";
2
2
  import { convertToolsToProviderFormat } from "./tool-converter.js";
3
- export {
4
- convertFunctionToolToAdapterFormat,
5
- convertToolsToProviderFormat
6
- };
7
- //# sourceMappingURL=index.js.map
3
+ export { convertFunctionToolToAdapterFormat, convertToolsToProviderFormat };
@@ -1,10 +1,15 @@
1
1
  import { convertFunctionToolToAdapterFormat } from "./function-tool.js";
2
+ //#region src/tools/tool-converter.ts
3
+ /**
4
+ * Converts an array of standard Tools to Groq-specific format.
5
+ * Groq uses an OpenAI-compatible API, so we primarily support function tools.
6
+ */
2
7
  function convertToolsToProviderFormat(tools) {
3
- return tools.map((tool) => {
4
- return convertFunctionToolToAdapterFormat(tool);
5
- });
8
+ return tools.map((tool) => {
9
+ return convertFunctionToolToAdapterFormat(tool);
10
+ });
6
11
  }
7
- export {
8
- convertToolsToProviderFormat
9
- };
10
- //# sourceMappingURL=tool-converter.js.map
12
+ //#endregion
13
+ export { convertToolsToProviderFormat };
14
+
15
+ //# sourceMappingURL=tool-converter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-converter.js","sources":["../../../src/tools/tool-converter.ts"],"sourcesContent":["import { convertFunctionToolToAdapterFormat } from './function-tool'\nimport type { FunctionTool } from './function-tool'\nimport type { Tool } from '@tanstack/ai'\n\n/**\n * Converts an array of standard Tools to Groq-specific format.\n * Groq uses an OpenAI-compatible API, so we primarily support function tools.\n */\nexport function convertToolsToProviderFormat(\n tools: Array<Tool>,\n): Array<FunctionTool> {\n return tools.map((tool) => {\n return convertFunctionToolToAdapterFormat(tool)\n })\n}\n"],"names":[],"mappings":";AAQO,SAAS,6BACd,OACqB;AACrB,SAAO,MAAM,IAAI,CAAC,SAAS;AACzB,WAAO,mCAAmC,IAAI;AAAA,EAChD,CAAC;AACH;"}
1
+ {"version":3,"file":"tool-converter.js","names":[],"sources":["../../../src/tools/tool-converter.ts"],"sourcesContent":["import { convertFunctionToolToAdapterFormat } from './function-tool'\nimport type { FunctionTool } from './function-tool'\nimport type { Tool } from '@tanstack/ai'\n\n/**\n * Converts an array of standard Tools to Groq-specific format.\n * Groq uses an OpenAI-compatible API, so we primarily support function tools.\n */\nexport function convertToolsToProviderFormat(\n tools: Array<Tool>,\n): Array<FunctionTool> {\n return tools.map((tool) => {\n return convertFunctionToolToAdapterFormat(tool)\n })\n}\n"],"mappings":";;;;;;AAQA,SAAgB,6BACd,OACqB;CACrB,OAAO,MAAM,KAAK,SAAS;EACzB,OAAO,mCAAmC,IAAI;CAChD,CAAC;AACH"}
@@ -1,21 +1,28 @@
1
1
  import { getApiKeyFromEnv } from "@tanstack/ai-utils";
2
+ //#region src/utils/client.ts
3
+ /**
4
+ * Gets Groq API key from environment variables
5
+ * @throws Error if GROQ_API_KEY is not found
6
+ */
2
7
  function getGroqApiKeyFromEnv() {
3
- try {
4
- return getApiKeyFromEnv("GROQ_API_KEY");
5
- } catch {
6
- throw new Error(
7
- "GROQ_API_KEY is required. Please set it in your environment variables or use the factory function with an explicit API key."
8
- );
9
- }
8
+ try {
9
+ return getApiKeyFromEnv("GROQ_API_KEY");
10
+ } catch {
11
+ throw new Error("GROQ_API_KEY is required. Please set it in your environment variables or use the factory function with an explicit API key.");
12
+ }
10
13
  }
14
+ /**
15
+ * Returns a Groq client config with Groq's OpenAI-compatible base URL
16
+ * applied when not already set. The Groq endpoint accepts the OpenAI SDK
17
+ * verbatim, so the adapter drives it via the OpenAI SDK with this baseURL.
18
+ */
11
19
  function withGroqDefaults(config) {
12
- return {
13
- ...config,
14
- baseURL: config.baseURL || "https://api.groq.com/openai/v1"
15
- };
20
+ return {
21
+ ...config,
22
+ baseURL: config.baseURL || "https://api.groq.com/openai/v1"
23
+ };
16
24
  }
17
- export {
18
- getGroqApiKeyFromEnv,
19
- withGroqDefaults
20
- };
21
- //# sourceMappingURL=client.js.map
25
+ //#endregion
26
+ export { getGroqApiKeyFromEnv, withGroqDefaults };
27
+
28
+ //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sources":["../../../src/utils/client.ts"],"sourcesContent":["import { getApiKeyFromEnv } from '@tanstack/ai-utils'\nimport type { ClientOptions } from 'openai'\n\nexport interface GroqClientConfig extends Omit<ClientOptions, 'apiKey'> {\n apiKey: string\n}\n\n/**\n * Gets Groq API key from environment variables\n * @throws Error if GROQ_API_KEY is not found\n */\nexport function getGroqApiKeyFromEnv(): string {\n try {\n return getApiKeyFromEnv('GROQ_API_KEY')\n } catch {\n throw new Error(\n 'GROQ_API_KEY is required. Please set it in your environment variables or use the factory function with an explicit API key.',\n )\n }\n}\n\n/**\n * Returns a Groq client config with Groq's OpenAI-compatible base URL\n * applied when not already set. The Groq endpoint accepts the OpenAI SDK\n * verbatim, so the adapter drives it via the OpenAI SDK with this baseURL.\n */\nexport function withGroqDefaults(config: GroqClientConfig): GroqClientConfig {\n return {\n ...config,\n baseURL: config.baseURL || 'https://api.groq.com/openai/v1',\n }\n}\n"],"names":[],"mappings":";AAWO,SAAS,uBAA+B;AAC7C,MAAI;AACF,WAAO,iBAAiB,cAAc;AAAA,EACxC,QAAQ;AACN,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACF;AAOO,SAAS,iBAAiB,QAA4C;AAC3E,SAAO;AAAA,IACL,GAAG;AAAA,IACH,SAAS,OAAO,WAAW;AAAA,EAAA;AAE/B;"}
1
+ {"version":3,"file":"client.js","names":[],"sources":["../../../src/utils/client.ts"],"sourcesContent":["import { getApiKeyFromEnv } from '@tanstack/ai-utils'\nimport type { ClientOptions } from 'openai'\n\nexport interface GroqClientConfig extends Omit<ClientOptions, 'apiKey'> {\n apiKey: string\n}\n\n/**\n * Gets Groq API key from environment variables\n * @throws Error if GROQ_API_KEY is not found\n */\nexport function getGroqApiKeyFromEnv(): string {\n try {\n return getApiKeyFromEnv('GROQ_API_KEY')\n } catch {\n throw new Error(\n 'GROQ_API_KEY is required. Please set it in your environment variables or use the factory function with an explicit API key.',\n )\n }\n}\n\n/**\n * Returns a Groq client config with Groq's OpenAI-compatible base URL\n * applied when not already set. The Groq endpoint accepts the OpenAI SDK\n * verbatim, so the adapter drives it via the OpenAI SDK with this baseURL.\n */\nexport function withGroqDefaults(config: GroqClientConfig): GroqClientConfig {\n return {\n ...config,\n baseURL: config.baseURL || 'https://api.groq.com/openai/v1',\n }\n}\n"],"mappings":";;;;;;AAWA,SAAgB,uBAA+B;CAC7C,IAAI;EACF,OAAO,iBAAiB,cAAc;CACxC,QAAQ;EACN,MAAM,IAAI,MACR,6HACF;CACF;AACF;;;;;;AAOA,SAAgB,iBAAiB,QAA4C;CAC3E,OAAO;EACL,GAAG;EACH,SAAS,OAAO,WAAW;CAC7B;AACF"}
@@ -1,5 +1,3 @@
1
- import { transformNullsToUndefined } from '@tanstack/ai-utils';
2
- export { transformNullsToUndefined };
3
1
  /**
4
2
  * Transform a JSON schema to be compatible with Groq's structured output requirements.
5
3
  *