File tree 5 files changed +58
-35
lines changed
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 = {
421
421
id : 'llama-3.1-70b-versatile' ,
422
422
provider : GROQ ,
423
423
promptCost : 0.59 ,
424
- completionCost : 0.79
424
+ completionCost : 0.79 ,
425
+ toolSupport : {
426
+ toolChoice : true ,
427
+ parallelToolCalls : true
428
+ }
425
429
} ,
426
430
{
427
431
id : 'llama-3.1-8b-instant' ,
428
432
provider : GROQ ,
429
433
promptCost : 0.59 ,
430
- completionCost : 0.79
434
+ completionCost : 0.79 ,
435
+ toolSupport : {
436
+ toolChoice : true ,
437
+ parallelToolCalls : true
438
+ }
431
439
} ,
432
440
{
433
441
id : 'llama3-70b-8192' ,
434
442
provider : GROQ ,
435
443
promptCost : 0.59 ,
436
- completionCost : 0.79
444
+ completionCost : 0.79 ,
445
+ toolSupport : {
446
+ toolChoice : true ,
447
+ parallelToolCalls : true
448
+ }
437
449
} ,
438
450
{
439
451
id : 'llama3-8b-8192' ,
440
452
provider : GROQ ,
441
453
promptCost : 0.05 ,
442
- completionCost : 0.1
454
+ completionCost : 0.1 ,
455
+ toolSupport : {
456
+ toolChoice : true ,
457
+ parallelToolCalls : true
458
+ }
443
459
} ,
444
460
{
445
461
id : 'mixtral-8x7b-32768' ,
446
462
provider : GROQ ,
447
463
promptCost : 0.27 ,
448
- completionCost : 0.27
464
+ completionCost : 0.27 ,
465
+ toolSupport : {
466
+ toolChoice : true ,
467
+ parallelToolCalls : false
468
+ }
449
469
} ,
450
470
{
451
471
id : 'gemma2-9b-it' ,
452
472
provider : GROQ ,
453
473
promptCost : 0.2 ,
454
- completionCost : 0.2
474
+ completionCost : 0.2 ,
475
+ toolSupport : {
476
+ toolChoice : true ,
477
+ parallelToolCalls : false
478
+ }
455
479
} ,
456
480
{
457
481
id : 'gemma-7b-it' ,
458
482
provider : GROQ ,
459
483
promptCost : 0.07 ,
460
- completionCost : 0.07
484
+ completionCost : 0.07 ,
485
+ toolSupport : {
486
+ toolChoice : true ,
487
+ parallelToolCalls : false
488
+ }
461
489
}
462
490
] ,
463
491
[ GOOGLE ] : [
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import transformToProviderRequest from '../utils/provider-handlers/transfrom-to-
5
5
import { applyJsonModeIfEnabled , handleLlmError } from './utils' ;
6
6
import type { ModelParams } from 'types/providers' ;
7
7
import type { Message } from 'types/pipe' ;
8
+ import { addToolsToParams } from '../utils/add-tools-to-params' ;
8
9
9
10
export async function callGroq ( {
10
11
pipe,
@@ -24,6 +25,7 @@ export async function callGroq({
24
25
baseURL : 'https://api.groq.com/openai/v1'
25
26
} ) ;
26
27
applyJsonModeIfEnabled ( modelParams , pipe ) ;
28
+ addToolsToParams ( modelParams , pipe ) ;
27
29
28
30
// Transform params according to provider's format
29
31
const transformedRequestParams = transformToProviderRequest ( {
Original file line number Diff line number Diff line change @@ -38,5 +38,17 @@ export const GroqChatCompleteConfig: ProviderConfig = {
38
38
default : 1 ,
39
39
max : 1 ,
40
40
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 : [ ]
41
53
}
42
54
} ;
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' ;
2
2
import type { ModelParams } from 'types/providers' ;
3
3
4
4
export function addToolsToParams ( modelParams : ModelParams , pipe : any ) {
5
5
if ( ! pipe . functions . length ) return ;
6
6
7
7
// 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
+ } ) ;
12
13
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 ;
19
15
16
+ if ( hasToolSupport ) {
20
17
if ( hasParallelToolCallSupport ) {
21
18
modelParams . parallel_tool_calls = pipe . model . parallel_tool_calls ;
22
19
}
Original file line number Diff line number Diff line change 1
1
import { modelsByProvider } from '@/data/models' ;
2
2
3
- export function hasToolSupport ( {
3
+ export function hasModelToolSupport ( {
4
4
provider,
5
5
modelName
6
6
} : {
@@ -10,23 +10,7 @@ export function hasToolSupport({
10
10
const toolSupportedModels = modelsByProvider [ provider ] . filter (
11
11
model => model . toolSupport
12
12
) ;
13
- const hasToolCallSupport = toolSupportedModels
14
- . flatMap ( model => model . id )
15
- . includes ( modelName ) ;
16
13
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
- ) ;
30
14
const providerModel = toolSupportedModels . find (
31
15
model => model . id === modelName
32
16
) ;
You can’t perform that action at this time.
0 commit comments