@@ -79,9 +79,14 @@ func (s *session) FromUser(ctx context.Context, prompt string, opts ...llm.Opt)
7979 response .seq [len (response .seq )- 1 ] = user
8080 }
8181
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+
8287 // Call the 'chat' method
8388 client := s .model .client
84- r , err := client .Chat (ctx , response , response . opts ... )
89+ r , err := client .Chat (ctx , response , chatopts ... )
8590 if err != nil {
8691 return nil , err
8792 } else {
@@ -93,7 +98,7 @@ func (s *session) FromUser(ctx context.Context, prompt string, opts ...llm.Opt)
9398}
9499
95100// 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 ) {
97102 // Make a new session
98103 response := new (session )
99104 response .model = s .model
@@ -107,8 +112,13 @@ func (s *session) FromTool(ctx context.Context, call string, result any) (llm.Co
107112 response .seq [len (response .seq )- 1 ] = message
108113 }
109114
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+
110120 // 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 ... )
112122 if err != nil {
113123 return nil , err
114124 } else {
0 commit comments