@@ -73,7 +73,8 @@ export class ChatOpenAIResponses<
7373 let strict : boolean | undefined ;
7474 if ( options ?. strict !== undefined ) {
7575 strict = options . strict ;
76- } else if ( this . supportsStrictToolCalling !== undefined ) {
76+ }
77+ if ( strict === undefined && this . supportsStrictToolCalling !== undefined ) {
7778 strict = this . supportsStrictToolCalling ;
7879 }
7980
@@ -90,32 +91,32 @@ export class ChatOpenAIResponses<
9091 include : options ?. include ,
9192 tools : options ?. tools ?. length
9293 ? this . _reduceChatOpenAITools ( options . tools , {
93- stream : this . streaming ,
94- strict,
95- } )
94+ stream : this . streaming ,
95+ strict,
96+ } )
9697 : undefined ,
9798 tool_choice : isBuiltInToolChoice ( options ?. tool_choice )
9899 ? options ?. tool_choice
99100 : ( ( ) => {
100- const formatted = formatToOpenAIToolChoice ( options ?. tool_choice ) ;
101- if ( typeof formatted === "object" && "type" in formatted ) {
102- if ( formatted . type === "function" ) {
103- return { type : "function" , name : formatted . function . name } ;
104- } else if ( formatted . type === "allowed_tools" ) {
105- return {
106- type : "allowed_tools" ,
107- mode : formatted . allowed_tools . mode ,
108- tools : formatted . allowed_tools . tools ,
109- } ;
110- } else if ( formatted . type === "custom" ) {
111- return {
112- type : "custom" ,
113- name : formatted . custom . name ,
114- } ;
115- }
101+ const formatted = formatToOpenAIToolChoice ( options ?. tool_choice ) ;
102+ if ( typeof formatted === "object" && "type" in formatted ) {
103+ if ( formatted . type === "function" ) {
104+ return { type : "function" , name : formatted . function . name } ;
105+ } else if ( formatted . type === "allowed_tools" ) {
106+ return {
107+ type : "allowed_tools" ,
108+ mode : formatted . allowed_tools . mode ,
109+ tools : formatted . allowed_tools . tools ,
110+ } ;
111+ } else if ( formatted . type === "custom" ) {
112+ return {
113+ type : "custom" ,
114+ name : formatted . custom . name ,
115+ } ;
116116 }
117- return undefined ;
118- } ) ( ) ,
117+ }
118+ return undefined ;
119+ } ) ( ) ,
119120 text : ( ( ) => {
120121 if ( options ?. text ) return options . text ;
121122 const format = this . _getResponseFormat ( options ?. response_format ) ;
@@ -200,10 +201,10 @@ export class ChatOpenAIResponses<
200201 id : data . id ,
201202 estimatedTokenUsage : data . usage
202203 ? {
203- promptTokens : data . usage . input_tokens ,
204- completionTokens : data . usage . output_tokens ,
205- totalTokens : data . usage . total_tokens ,
206- }
204+ promptTokens : data . usage . input_tokens ,
205+ completionTokens : data . usage . output_tokens ,
206+ totalTokens : data . usage . total_tokens ,
207+ }
207208 : undefined ,
208209 } ,
209210 } ;
0 commit comments