@@ -79,9 +79,14 @@ func (s *session) FromUser(ctx context.Context, prompt string, opts ...llm.Opt)
79
79
response .seq [len (response .seq )- 1 ] = user
80
80
}
81
81
82
+ // The options come from the session options and the user options
83
+ chatopts := make ([]llm.Opt , 0 , len (s .opts )+ len (opts ))
84
+ chatopts = append (chatopts , s .opts ... )
85
+ chatopts = append (chatopts , opts ... )
86
+
82
87
// Call the 'chat' method
83
88
client := s .model .client
84
- r , err := client .Chat (ctx , response , response . opts ... )
89
+ r , err := client .Chat (ctx , response , chatopts ... )
85
90
if err != nil {
86
91
return nil , err
87
92
} else {
@@ -93,7 +98,7 @@ func (s *session) FromUser(ctx context.Context, prompt string, opts ...llm.Opt)
93
98
}
94
99
95
100
// Generate a response from a tool calling result
96
- func (s * session ) FromTool (ctx context.Context , call string , result any ) (llm.Context , error ) {
101
+ func (s * session ) FromTool (ctx context.Context , call string , result any , opts ... llm. Opt ) (llm.Context , error ) {
97
102
// Make a new session
98
103
response := new (session )
99
104
response .model = s .model
@@ -107,8 +112,13 @@ func (s *session) FromTool(ctx context.Context, call string, result any) (llm.Co
107
112
response .seq [len (response .seq )- 1 ] = message
108
113
}
109
114
115
+ // The options come from the session options and the user options
116
+ chatopts := make ([]llm.Opt , 0 , len (s .opts )+ len (opts ))
117
+ chatopts = append (chatopts , s .opts ... )
118
+ chatopts = append (chatopts , opts ... )
119
+
110
120
// Call the 'chat' method
111
- r , err := s .model .client .Chat (ctx , response , response . opts ... )
121
+ r , err := s .model .client .Chat (ctx , response , chatopts ... )
112
122
if err != nil {
113
123
return nil , err
114
124
} else {
0 commit comments