This repository was archived by the owner on Nov 14, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +58
-35
lines changed Expand file tree Collapse file tree 5 files changed +58
-35
lines changed Original file line number Diff line number Diff line change @@ -421,43 +421,71 @@ export const modelsByProvider: ModelsByProviderInclCosts = {
421421 id : 'llama-3.1-70b-versatile' ,
422422 provider : GROQ ,
423423 promptCost : 0.59 ,
424- completionCost : 0.79
424+ completionCost : 0.79 ,
425+ toolSupport : {
426+ toolChoice : true ,
427+ parallelToolCalls : true
428+ }
425429 } ,
426430 {
427431 id : 'llama-3.1-8b-instant' ,
428432 provider : GROQ ,
429433 promptCost : 0.59 ,
430- completionCost : 0.79
434+ completionCost : 0.79 ,
435+ toolSupport : {
436+ toolChoice : true ,
437+ parallelToolCalls : true
438+ }
431439 } ,
432440 {
433441 id : 'llama3-70b-8192' ,
434442 provider : GROQ ,
435443 promptCost : 0.59 ,
436- completionCost : 0.79
444+ completionCost : 0.79 ,
445+ toolSupport : {
446+ toolChoice : true ,
447+ parallelToolCalls : true
448+ }
437449 } ,
438450 {
439451 id : 'llama3-8b-8192' ,
440452 provider : GROQ ,
441453 promptCost : 0.05 ,
442- completionCost : 0.1
454+ completionCost : 0.1 ,
455+ toolSupport : {
456+ toolChoice : true ,
457+ parallelToolCalls : true
458+ }
443459 } ,
444460 {
445461 id : 'mixtral-8x7b-32768' ,
446462 provider : GROQ ,
447463 promptCost : 0.27 ,
448- completionCost : 0.27
464+ completionCost : 0.27 ,
465+ toolSupport : {
466+ toolChoice : true ,
467+ parallelToolCalls : false
468+ }
449469 } ,
450470 {
451471 id : 'gemma2-9b-it' ,
452472 provider : GROQ ,
453473 promptCost : 0.2 ,
454- completionCost : 0.2
474+ completionCost : 0.2 ,
475+ toolSupport : {
476+ toolChoice : true ,
477+ parallelToolCalls : false
478+ }
455479 } ,
456480 {
457481 id : 'gemma-7b-it' ,
458482 provider : GROQ ,
459483 promptCost : 0.07 ,
460- completionCost : 0.07
484+ completionCost : 0.07 ,
485+ toolSupport : {
486+ toolChoice : true ,
487+ parallelToolCalls : false
488+ }
461489 }
462490 ] ,
463491 [ GOOGLE ] : [
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import transformToProviderRequest from '../utils/provider-handlers/transfrom-to-
55import { applyJsonModeIfEnabled , handleLlmError } from './utils' ;
66import type { ModelParams } from 'types/providers' ;
77import type { Message } from 'types/pipe' ;
8+ import { addToolsToParams } from '../utils/add-tools-to-params' ;
89
910export async function callGroq ( {
1011 pipe,
@@ -24,6 +25,7 @@ export async function callGroq({
2425 baseURL : 'https://api.groq.com/openai/v1'
2526 } ) ;
2627 applyJsonModeIfEnabled ( modelParams , pipe ) ;
28+ addToolsToParams ( modelParams , pipe ) ;
2729
2830 // Transform params according to provider's format
2931 const transformedRequestParams = transformToProviderRequest ( {
Original file line number Diff line number Diff line change @@ -38,5 +38,17 @@ export const GroqChatCompleteConfig: ProviderConfig = {
3838 default : 1 ,
3939 max : 1 ,
4040 min : 1
41+ } ,
42+ parallel_tool_calls : {
43+ param : 'parallel_tool_calls' ,
44+ default : false
45+ } ,
46+ tool_choice : {
47+ param : 'tool_choice' ,
48+ default : 'none'
49+ } ,
50+ tools : {
51+ param : 'tools' ,
52+ default : [ ]
4153 }
4254} ;
Original file line number Diff line number Diff line change 1- import { getSupportedToolSettings , hasToolSupport } from './has-tool-support' ;
1+ import { hasModelToolSupport } from './has-tool-support' ;
22import type { ModelParams } from 'types/providers' ;
33
44export function addToolsToParams ( modelParams : ModelParams , pipe : any ) {
55 if ( ! pipe . functions . length ) return ;
66
77 // Check if the model supports tool calls
8- const hasToolCallSupport = hasToolSupport ( {
9- modelName : pipe . model . name ,
10- provider : pipe . model . provider
11- } ) ;
8+ const { hasToolChoiceSupport, hasParallelToolCallSupport } =
9+ hasModelToolSupport ( {
10+ modelName : pipe . model . name ,
11+ provider : pipe . model . provider
12+ } ) ;
1213
13- if ( hasToolCallSupport ) {
14- const { hasParallelToolCallSupport, hasToolChoiceSupport } =
15- getSupportedToolSettings ( {
16- modelName : pipe . model . name ,
17- provider : pipe . model . provider
18- } ) ;
14+ const hasToolSupport = hasToolChoiceSupport || hasParallelToolCallSupport ;
1915
16+ if ( hasToolSupport ) {
2017 if ( hasParallelToolCallSupport ) {
2118 modelParams . parallel_tool_calls = pipe . model . parallel_tool_calls ;
2219 }
Original file line number Diff line number Diff line change 11import { modelsByProvider } from '@/data/models' ;
22
3- export function hasToolSupport ( {
3+ export function hasModelToolSupport ( {
44 provider,
55 modelName
66} : {
@@ -10,23 +10,7 @@ export function hasToolSupport({
1010 const toolSupportedModels = modelsByProvider [ provider ] . filter (
1111 model => model . toolSupport
1212 ) ;
13- const hasToolCallSupport = toolSupportedModels
14- . flatMap ( model => model . id )
15- . includes ( modelName ) ;
1613
17- return hasToolCallSupport ;
18- }
19-
20- export function getSupportedToolSettings ( {
21- provider,
22- modelName
23- } : {
24- modelName : string ;
25- provider : string ;
26- } ) {
27- const toolSupportedModels = modelsByProvider [ provider ] . filter (
28- model => model . toolSupport
29- ) ;
3014 const providerModel = toolSupportedModels . find (
3115 model => model . id === modelName
3216 ) ;
You can’t perform that action at this time.
0 commit comments