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
356356 }
357357 }
358358
359+ toolMapping := map [string ]string {}
359360 for _ , tool := range messageRequest .Tools {
360361 var params any = tool .Function .Parameters
361362 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
365366 }
366367 }
367368
369+ if tool .Function .ToolID != "" {
370+ toolMapping [tool .Function .Name ] = tool .Function .ToolID
371+ }
372+
368373 request .Tools = append (request .Tools , openai.Tool {
369374 Type : openai .ToolTypeFunction ,
370375 Function : & openai.FunctionDefinition {
@@ -378,7 +383,10 @@ func (c *Client) Call(ctx context.Context, messageRequest types.CompletionReques
378383 id := counter .Next ()
379384 status <- types.CompletionStatus {
380385 CompletionID : id ,
381- Request : request ,
386+ Request : map [string ]any {
387+ "chatCompletion" : request ,
388+ "toolMapping" : toolMapping ,
389+ },
382390 }
383391
384392 var cacheResponse bool
You can’t perform that action at this time.
0 commit comments