Files
mistral-go-sdk/doc.go
vikingowl ea47d14b38 feat: v0.2.0 — sync with upstream Python SDK v2.0.4
Add ToolReferenceChunk, ToolFileChunk, BuiltInConnector enum,
ReferenceID union type (int|string), GuardrailConfig with v1/v2
moderation, ConnectorTool for custom connectors, and guardrails
field on chat/agents/conversation requests.

Add AudioTranscriptionRealtime and AudioSpeech to ModelCapabilities.

Move GuardrailConfig from agents/ to chat/ as shared base type.
Remove bundled OpenAPI spec; SDK now tracks upstream Python SDK.

BREAKING: ReferenceChunk.ReferenceIDs changed from []int to
[]ReferenceID. Use IntRef(n) / StringRef(s) constructors.
2026-03-17 11:23:58 +01:00

52 lines
1.5 KiB
Go

// Package mistral provides an idiomatic Go client for the Mistral AI API.
//
// Create a client with your API key, then call methods for each endpoint:
//
// client := mistral.NewClient("sk-...")
//
// // Chat completion
// resp, err := client.ChatComplete(ctx, &chat.CompletionRequest{
// Model: "mistral-small-latest",
// Messages: []chat.Message{&chat.UserMessage{Content: chat.TextContent("Hello!")}},
// })
//
// // Streaming
// stream, err := client.ChatCompleteStream(ctx, req)
// defer stream.Close()
// for stream.Next() {
// chunk := stream.Current()
// fmt.Print(chunk.Choices[0].Delta.Content)
// }
//
// # Configuration
//
// Use functional options to configure the client:
//
// client := mistral.NewClient("sk-...",
// mistral.WithTimeout(30 * time.Second),
// mistral.WithRetry(3, 500*time.Millisecond),
// )
//
// # Error Handling
//
// API errors are returned as *[APIError] values. Use sentinel checkers
// for common cases:
//
// if mistral.IsRateLimit(err) {
// // back off and retry
// }
//
// # Sub-packages
//
// Types are organized into sub-packages by domain: [chat], [agents],
// [conversation], [embedding], [model], [file], [finetune], [batch],
// [ocr], [audio], [library], [moderation], [classification], and [fim].
// All service methods live directly on [Client].
//
// # Reference
//
// This SDK tracks the official Mistral Python SDK
// (https://github.com/mistralai/client-python) as its upstream reference
// for API surface and type definitions.
package mistral