@@ -16,6 +16,7 @@ import (
1616 agent "github.com/mutablelogic/go-llm/pkg/agent"
1717 anthropic "github.com/mutablelogic/go-llm/pkg/provider/anthropic"
1818 google "github.com/mutablelogic/go-llm/pkg/provider/google"
19+ mistral "github.com/mutablelogic/go-llm/pkg/provider/mistral"
1920 session "github.com/mutablelogic/go-llm/pkg/session"
2021 version "github.com/mutablelogic/go-llm/pkg/version"
2122 logger "github.com/mutablelogic/go-server/pkg/logger"
@@ -34,6 +35,7 @@ type Globals struct {
3435 // API Keys
3536 GeminiAPIKey string `name:"gemini-api-key" env:"GEMINI_API_KEY" help:"Google Gemini API key"`
3637 AnthropicAPIKey string `name:"anthropic-api-key" env:"ANTHROPIC_API_KEY" help:"Anthropic API key"`
38+ MistralAPIKey string `name:"mistral-api-key" env:"MISTRAL_API_KEY" help:"Mistral API key"`
3739 NewsAPIKey string `name:"news-api-key" env:"NEWS_API_KEY" help:"NewsAPI key"`
3840 WeatherAPIKey string `name:"weather-api-key" env:"WEATHER_API_KEY" help:"WeatherAPI key"`
3941 HAEndpoint string `name:"ha-endpoint" env:"HA_ENDPOINT" help:"Home Assistant endpoint URL"`
@@ -184,9 +186,22 @@ func (g *Globals) Agent() (agent.Agent, error) {
184186 opts = append (opts , agent .WithClient (anthropicClient ))
185187 }
186188
189+ // Add Mistral client if API key is set
190+ if g .MistralAPIKey != "" {
191+ var clientOpts []client.ClientOpt
192+ if g .Debug {
193+ clientOpts = append (clientOpts , client .OptTrace (os .Stderr , true ))
194+ }
195+ mistralClient , err := mistral .New (g .MistralAPIKey , clientOpts ... )
196+ if err != nil {
197+ return nil , fmt .Errorf ("failed to create Mistral client: %w" , err )
198+ }
199+ opts = append (opts , agent .WithClient (mistralClient ))
200+ }
201+
187202 // Check if at least one client is configured
188203 if len (opts ) == 0 {
189- return nil , fmt .Errorf ("no API keys configured. Set --gemini-api-key or --anthropic -api-key (or use environment variables)" )
204+ return nil , fmt .Errorf ("no API keys configured. Set --gemini-api-key, --anthropic-api-key, or --mistral -api-key (or use environment variables)" )
190205 }
191206
192207 return agent .NewAgent (opts ... )
0 commit comments