File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -99,11 +99,6 @@ static function () {
9999
100100 $ new_contents = $ contents ;
101101
102- $ tools = new Tools ();
103- if ( ! empty ( $ this ->tools ) ) {
104- $ tools ->add_function_declarations_tool ( $ this ->tools );
105- }
106-
107102 try {
108103 $ service = ai_services ()->get_available_service (
109104 [
@@ -116,6 +111,20 @@ static function () {
116111 ]
117112 );
118113
114+ $ all_tools = $ this ->tools ;
115+
116+ $ tools = new Tools ();
117+
118+ if ( ! empty ( $ all_tools ) ) {
119+ if ( 'openai ' === $ service ->get_service_slug () ) {
120+ $ all_tools = array_slice ( $ all_tools , 0 , 128 );
121+ } elseif ( 'google ' === $ service ->get_service_slug () ) {
122+ $ all_tools = array_slice ( $ all_tools , 0 , 512 );
123+ }
124+
125+ $ tools ->add_function_declarations_tool ( $ all_tools );
126+ }
127+
119128 /**
120129 * Text generation model.
121130 *
You can’t perform that action at this time.
0 commit comments