Add Connectors, Audio Speech/Voices, Audio Realtime types, and Observability (beta). 41 new service methods, 116 total. Breaking: ListModels and UploadFile signatures changed (pass nil for previous behavior).
39 lines
671 B
Go
39 lines
671 B
Go
package mistral
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
// Version is the SDK version string.
|
|
const Version = "1.1.0"
|
|
|
|
const (
|
|
defaultBaseURL = "https://api.mistral.ai"
|
|
defaultTimeout = 120 * time.Second
|
|
)
|
|
|
|
// Client is a Mistral AI API client.
|
|
type Client struct {
|
|
apiKey string
|
|
baseURL string
|
|
httpClient *http.Client
|
|
maxRetries int
|
|
retryDelay time.Duration
|
|
}
|
|
|
|
// NewClient creates a new Mistral AI client with the given API key.
|
|
func NewClient(apiKey string, opts ...Option) *Client {
|
|
c := &Client{
|
|
apiKey: apiKey,
|
|
baseURL: defaultBaseURL,
|
|
httpClient: &http.Client{
|
|
Timeout: defaultTimeout,
|
|
},
|
|
}
|
|
for _, opt := range opts {
|
|
opt(c)
|
|
}
|
|
return c
|
|
}
|