File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
libs/providers/langchain-openai/src/chat_models/tests Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ import { describe , it , expect } from "vitest" ;
2+ import { ChatOpenAIResponses } from "../responses" ;
3+
4+ describe ( "strict tool-calling configuration" , ( ) => {
5+ it ( "falls back to supportsStrictToolCalling when strict is undefined" , ( ) => {
6+ const model = new ChatOpenAIResponses ( {
7+ model : "gpt-4o" ,
8+ supportsStrictToolCalling : true ,
9+ } ) ;
10+
11+ const params = model . invocationParams ( {
12+ tools : [
13+ {
14+ type : "function" ,
15+ function : {
16+ name : "test_func" ,
17+ description : "testing" ,
18+ parameters : { type : "object" , properties : { } } ,
19+ } ,
20+ } ,
21+ ] ,
22+ } ) ;
23+
24+ expect ( ( params as any ) . strict ) . toBeUndefined ( ) ;
25+
26+ expect ( ( params . tools as any ) [ 0 ] . strict ) . toBe ( true ) ;
27+ } ) ;
28+
29+ it ( "respects user-provided strict option" , ( ) => {
30+ const model = new ChatOpenAIResponses ( {
31+ model : "gpt-4o" ,
32+ supportsStrictToolCalling : true ,
33+ } ) ;
34+
35+ const params = model . invocationParams ( {
36+ strict : false ,
37+ tools : [
38+ {
39+ type : "function" ,
40+ function : {
41+ name : "test_func" ,
42+ description : "testing" ,
43+ parameters : { type : "object" , properties : { } } ,
44+ } ,
45+ } ,
46+ ] ,
47+ } ) ;
48+
49+ expect ( ( params as any ) . strict ) . toBeUndefined ( ) ;
50+
51+ expect ( ( params . tools as any ) [ 0 ] . strict ) . toBe ( false ) ;
52+ } ) ;
53+ } ) ;
You can’t perform that action at this time.
0 commit comments