@@ -951,7 +951,7 @@ function convertResponsesTools(
951951 model,
952952 } ) ;
953953 return sortTransportToolsByName ( tools ) . map ( ( tool ) : FunctionTool => {
954- const base = {
954+ const result = {
955955 type : "function" as const ,
956956 name : tool . name ,
957957 description : tool . description ,
@@ -960,8 +960,11 @@ function convertResponsesTools(
960960 strict === true ,
961961 model . compat ,
962962 ) as Record < string , unknown > ,
963- } ;
964- return strict === undefined ? ( base as FunctionTool ) : { ...base , strict } ;
963+ } as FunctionTool ;
964+ if ( strict !== undefined ) {
965+ result . strict = strict ;
966+ }
967+ return result ;
965968 } ) ;
966969}
967970
@@ -2686,19 +2689,29 @@ function convertTools(
26862689 model,
26872690 } ,
26882691 ) ;
2689- return sortTransportToolsByName ( tools ) . map ( ( tool ) => ( {
2690- type : "function" ,
2691- function : {
2692+ return sortTransportToolsByName ( tools ) . map ( ( tool ) => {
2693+ const functionTool : {
2694+ name : string ;
2695+ description : string | undefined ;
2696+ parameters : ReturnType < typeof normalizeOpenAIStrictToolParameters > ;
2697+ strict ?: boolean ;
2698+ } = {
26922699 name : tool . name ,
26932700 description : tool . description ,
26942701 parameters : normalizeOpenAIStrictToolParameters (
26952702 tool . parameters ,
26962703 strict === true ,
26972704 model . compat ,
26982705 ) ,
2699- ...( strict === undefined ? { } : { strict } ) ,
2700- } ,
2701- } ) ) ;
2706+ } ;
2707+ if ( strict !== undefined ) {
2708+ functionTool . strict = strict ;
2709+ }
2710+ return {
2711+ type : "function" ,
2712+ function : functionTool ,
2713+ } ;
2714+ } ) ;
27022715}
27032716
27042717function compareTransportToolText ( left : string | undefined , right : string | undefined ) : number {
0 commit comments