mistral

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package mistral adapts the Mistral Conversations API to sigma.

The provider currently implements streaming text conversations, thinking chunks, function tools, server-side retrieval tools, session affinity, and base64 or URL image inputs. Code interpreter, image generation, external connectors, append, and restart are intentionally not implemented. Credentials resolve through sigma.Options.AuthResolver instead of direct environment reads.

Index

Constants

View Source
const DefaultBaseURL = "https://api.mistral.ai/v1"

Variables

View Source
var Tools = struct {
	WebSearch        func() sigma.Tool
	WebSearchPremium func() sigma.Tool
	DocumentLibrary  func(libraryIDs ...string) sigma.Tool
}{
	WebSearch:        webSearchTool,
	WebSearchPremium: webSearchPremiumTool,
	DocumentLibrary:  documentLibraryTool,
}

Tools provides factories for Mistral server-side retrieval tools.

Functions

func Register

func Register(registry *sigma.Registry, providerID sigma.ProviderID, opts ...ProviderOption) error

Register adds a Mistral Conversations text provider to registry.

func RegisterDefault

func RegisterDefault(providerID sigma.ProviderID, opts ...ProviderOption) error

RegisterDefault adds a Mistral Conversations text provider to sigma's default registry.

Types

type PayloadHook

type PayloadHook func(context.Context, sigma.Model, sigma.Request, sigma.Options, map[string]any) error

PayloadHook can inspect or mutate the Mistral request payload before it is encoded.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider adapts the Mistral Conversations API to sigma.

This provider currently implements model-backed text conversations with function and server-side retrieval tools, thinking chunks, session affinity, and base64 or URL image inputs. Code interpreter, image generation, external connectors, append, and restart are intentionally unsupported by this adapter.

func NewProvider

func NewProvider(opts ...ProviderOption) *Provider

NewProvider constructs a Mistral Conversations provider.

func (*Provider) API

func (p *Provider) API() sigma.API

API reports the Mistral Conversations API surface.

func (*Provider) Stream

func (p *Provider) Stream(ctx context.Context, model sigma.Model, req sigma.Request, opts sigma.Options) *sigma.Stream

Stream sends req to the Mistral Conversations API and emits sigma events as SSE chunks arrive.

type ProviderOption

type ProviderOption func(*Provider)

ProviderOption configures a Provider.

func WithBaseURL

func WithBaseURL(baseURL string) ProviderOption

WithBaseURL configures the provider base URL, for example an httptest server URL.

func WithHTTPClient

func WithHTTPClient(client *http.Client) ProviderOption

WithHTTPClient configures the provider fallback HTTP client.

func WithHeader

func WithHeader(key, value string) ProviderOption

WithHeader configures a provider default request header.

func WithHeaders

func WithHeaders(headers map[string]string) ProviderOption

WithHeaders configures provider default request headers.

func WithPayloadHook

func WithPayloadHook(hook PayloadHook) ProviderOption

WithPayloadHook adds a request payload hook.

func WithResponseHook

func WithResponseHook(hook ResponseHook) ProviderOption

WithResponseHook adds an HTTP response hook.

type ResponseHook

type ResponseHook func(context.Context, sigma.Model, sigma.Options, *http.Response) error

ResponseHook can inspect the Mistral HTTP response before status handling or stream parsing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL