File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -356,6 +356,7 @@ func (c *Client) Call(ctx context.Context, messageRequest types.CompletionReques
356
356
}
357
357
}
358
358
359
+ toolMapping := map [string ]string {}
359
360
for _ , tool := range messageRequest .Tools {
360
361
var params any = tool .Function .Parameters
361
362
if tool .Function .Parameters == nil || len (tool .Function .Parameters .Properties ) == 0 {
@@ -365,6 +366,10 @@ func (c *Client) Call(ctx context.Context, messageRequest types.CompletionReques
365
366
}
366
367
}
367
368
369
+ if tool .Function .ToolID != "" {
370
+ toolMapping [tool .Function .Name ] = tool .Function .ToolID
371
+ }
372
+
368
373
request .Tools = append (request .Tools , openai.Tool {
369
374
Type : openai .ToolTypeFunction ,
370
375
Function : & openai.FunctionDefinition {
@@ -378,7 +383,10 @@ func (c *Client) Call(ctx context.Context, messageRequest types.CompletionReques
378
383
id := counter .Next ()
379
384
status <- types.CompletionStatus {
380
385
CompletionID : id ,
381
- Request : request ,
386
+ Request : map [string ]any {
387
+ "chatCompletion" : request ,
388
+ "toolMapping" : toolMapping ,
389
+ },
382
390
}
383
391
384
392
var cacheResponse bool
You can’t perform that action at this time.
0 commit comments