File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export namespace Agent {
1414 mode : z . union ( [ z . literal ( "subagent" ) , z . literal ( "primary" ) , z . literal ( "all" ) ] ) ,
1515 topP : z . number ( ) . optional ( ) ,
1616 temperature : z . number ( ) . optional ( ) ,
17+ options : z . record ( z . any ( ) ) ,
1718 model : z
1819 . object ( {
1920 modelID : z . string ( ) ,
@@ -39,15 +40,18 @@ export namespace Agent {
3940 todoread : false ,
4041 todowrite : false ,
4142 } ,
43+ options : { } ,
4244 mode : "subagent" ,
4345 } ,
4446 build : {
4547 name : "build" ,
4648 tools : { } ,
49+ options : { } ,
4750 mode : "primary" ,
4851 } ,
4952 plan : {
5053 name : "plan" ,
54+ options : { } ,
5155 tools : {
5256 write : false ,
5357 edit : false ,
@@ -66,6 +70,7 @@ export namespace Agent {
6670 item = result [ key ] = {
6771 name : key ,
6872 mode : "all" ,
73+ options : { } ,
6974 tools : { } ,
7075 }
7176 if ( value . model ) item . model = Provider . parseModel ( value . model )
@@ -79,6 +84,11 @@ export namespace Agent {
7984 if ( value . temperature != undefined ) item . temperature = value . temperature
8085 if ( value . top_p != undefined ) item . topP = value . top_p
8186 if ( value . mode ) item . mode = value . mode
87+ if ( value . options )
88+ item . options = {
89+ ...item . options ,
90+ ...value . options ,
91+ }
8292 }
8393 return result
8494 } )
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ export namespace Config {
173173 tools : z . record ( z . string ( ) , z . boolean ( ) ) . optional ( ) ,
174174 disable : z . boolean ( ) . optional ( ) ,
175175 description : z . string ( ) . optional ( ) . describe ( "Description of when to use the agent" ) ,
176+ options : z . record ( z . string ( ) , z . any ( ) ) . optional ( ) . describe ( "Additional model options passed through to provider" ) ,
176177 mode : z . union ( [ z . literal ( "subagent" ) , z . literal ( "primary" ) , z . literal ( "all" ) ] ) . optional ( ) ,
177178 } )
178179 . openapi ( {
Original file line number Diff line number Diff line change @@ -852,20 +852,24 @@ export namespace Session {
852852 tools [ key ] = item
853853 }
854854
855- const params = {
856- temperature : model . info . temperature
857- ? ( agent . temperature ?? ProviderTransform . temperature ( input . providerID , input . modelID ) )
858- : undefined ,
859- topP : agent . topP ?? ProviderTransform . topP ( input . providerID , input . modelID ) ,
860- }
861- await Plugin . trigger (
855+ const params = await Plugin . trigger (
862856 "chat.params" ,
863857 {
864858 model : model . info ,
865859 provider : await Provider . getProvider ( input . providerID ) ,
866860 message : userMsg ,
867861 } ,
868- params ,
862+ {
863+ temperature : model . info . temperature
864+ ? ( agent . temperature ?? ProviderTransform . temperature ( input . providerID , input . modelID ) )
865+ : undefined ,
866+ topP : agent . topP ?? ProviderTransform . topP ( input . providerID , input . modelID ) ,
867+ options : {
868+ ...ProviderTransform . options ( input . providerID , input . modelID ) ,
869+ ...model . info . options ,
870+ ...agent . options ,
871+ } ,
872+ } ,
869873 )
870874 const stream = streamText ( {
871875 onError ( e ) {
@@ -946,10 +950,7 @@ export namespace Session {
946950 return false
947951 } ,
948952 providerOptions : {
949- [ input . providerID ] : {
950- ...ProviderTransform . options ( input . providerID , input . modelID ) ,
951- ...model . info . options ,
952- } ,
953+ [ input . providerID ] : params . options ,
953954 } ,
954955 temperature : params . temperature ,
955956 topP : params . topP ,
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export interface Hooks {
1919 */
2020 "chat.params" ?: (
2121 input : { model : Model ; provider : Provider ; message : UserMessage } ,
22- output : { temperature : number ; topP : number } ,
22+ output : { temperature : number ; topP : number ; options : Record < string , any > } ,
2323 ) => Promise < void >
2424 "permission.ask" ?: ( input : Permission , output : { status : "ask" | "deny" | "allow" } ) => Promise < void >
2525 "tool.execute.before" ?: (
You can’t perform that action at this time.
0 commit comments