mistral

package module
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 31 Imported by: 0

README

mistral-go-sdk

The most complete Go client for the Mistral AI API.

Go Reference Go Version License

Why This SDK?

Zero dependencies. The entire SDK — including tests — uses only the Go standard library. No go.sum, no transitive dependency tree to audit, no version conflicts, no supply chain risk.

Full API coverage. 169 methods across every Mistral endpoint — including Workflows (with worker introspection and connector bindings), Connectors, Audio Speech/Voices, Conversations (including human-in-the-loop tool confirmations), Agents CRUD, Libraries, OCR, Observability (events, judges, datasets, campaigns, fields), Fine-tuning, and Batch Jobs. No other Go SDK covers Workflows, Conversations, Connectors, or Observability.

Typed streaming. A generic pull-based Stream[T] iterator — no channels, no goroutines, no leaks. Just Next() / Current() / Err() / Close().

Forward-compatible. Unknown types (UnknownEntry, UnknownEvent, UnknownMessage, UnknownChunk, UnknownAgentTool, workflow UnknownEvent) capture raw JSON instead of returning errors. When Mistral ships a new message role or event type, your code keeps running — it doesn't panic.

Hand-written, not generated. Idiomatic Go with sealed interfaces, discriminated unions, and functional options — not a Speakeasy/OpenAPI auto-gen dump with any everywhere.

Test-driven. 297 tests with race detection clean. Every endpoint tested against mock servers; integration tests against the real API.

Install

go get github.com/VikingOwl91/mistral-go-sdk

Quick Start

Chat Completion
package main

import (
    "context"
    "fmt"
    "log"

    mistral "github.com/VikingOwl91/mistral-go-sdk"
    "github.com/VikingOwl91/mistral-go-sdk/chat"
)

func main() {
    client := mistral.NewClient("sk-your-api-key")

    resp, err := client.ChatComplete(context.Background(), &chat.CompletionRequest{
        Model: "mistral-small-latest",
        Messages: []chat.Message{
            &chat.UserMessage{Content: chat.TextContent("What is the capital of France?")},
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(resp.Choices[0].Message.Content)
}
Streaming
stream, err := client.ChatCompleteStream(ctx, &chat.CompletionRequest{
    Model: "mistral-small-latest",
    Messages: []chat.Message{
        &chat.UserMessage{Content: chat.TextContent("Tell me a joke.")},
    },
})
if err != nil {
    log.Fatal(err)
}
defer stream.Close()

for stream.Next() {
    chunk := stream.Current()
    if len(chunk.Choices) > 0 {
        fmt.Print(chunk.Choices[0].Delta.Content)
    }
}
if err := stream.Err(); err != nil {
    log.Fatal(err)
}
Tool Calling
resp, err := client.ChatComplete(ctx, &chat.CompletionRequest{
    Model: "mistral-small-latest",
    Messages: []chat.Message{
        &chat.UserMessage{Content: chat.TextContent("What's the weather in Paris?")},
    },
    Tools: []chat.Tool{{
        Type: "function",
        Function: chat.Function{
            Name:        "get_weather",
            Description: "Get weather for a city",
            Parameters: map[string]any{
                "type": "object",
                "properties": map[string]any{
                    "city": map[string]any{"type": "string"},
                },
                "required": []string{"city"},
            },
        },
    }},
})
Conversations
import "github.com/VikingOwl91/mistral-go-sdk/conversation"

resp, err := client.StartConversation(ctx, &conversation.StartRequest{
    AgentID: "ag-your-agent-id",
    Inputs:  conversation.TextInputs("Hello, agent!"),
})

// Stream events
stream, err := client.AppendConversationStream(ctx, resp.ConversationID, &conversation.AppendRequest{
    Inputs: conversation.TextInputs("Follow-up question"),
})
defer stream.Close()
for stream.Next() {
    event := stream.Current()
    // handle typed events
}

API Coverage

169 public methods on Client, grouped by domain:

Domain Methods
Chat ChatComplete, ChatCompleteStream
FIM FIMComplete, FIMCompleteStream
Agents (completions) AgentsComplete, AgentsCompleteStream
Agents (CRUD) CreateAgent, ListAgents, GetAgent, UpdateAgent, DeleteAgent, UpdateAgentVersion, ListAgentVersions, GetAgentVersion, SetAgentAlias, ListAgentAliases, DeleteAgentAlias
Connectors CreateConnector, ListConnectors, GetConnector, UpdateConnector, DeleteConnector, GetConnectorAuthURL, ListConnectorTools, CallConnectorTool
Conversations StartConversation, StartConversationStream, AppendConversation, AppendConversationStream, RestartConversation, RestartConversationStream, GetConversation, ListConversations, DeleteConversation, GetConversationHistory, GetConversationMessages
Models ListModels, GetModel, DeleteModel
Files UploadFile, ListFiles, GetFile, DeleteFile, GetFileContent, GetFileURL
Embeddings CreateEmbeddings
Fine-tuning CreateFineTuningJob, ListFineTuningJobs, GetFineTuningJob, CancelFineTuningJob, StartFineTuningJob, UpdateFineTunedModel, ArchiveFineTunedModel, UnarchiveFineTunedModel
Batch CreateBatchJob, ListBatchJobs, GetBatchJob, CancelBatchJob, DeleteBatchJob
OCR OCR
Audio (transcription) Transcribe, TranscribeStream
Audio (speech) Speech, SpeechStream
Audio (voices) ListVoices, CreateVoice, GetVoice, UpdateVoice, DeleteVoice, GetVoiceSampleAudio
Libraries CreateLibrary, ListLibraries, GetLibrary, UpdateLibrary, DeleteLibrary, UploadDocument, ListDocuments, GetDocument, UpdateDocument, DeleteDocument, GetDocumentTextContent, GetDocumentStatus, GetDocumentSignedURL, GetDocumentExtractedTextSignedURL, ReprocessDocument, ListLibrarySharing, ShareLibrary, UnshareLibrary
Moderation Moderate, ModerateChat
Classification Classify, ClassifyChat
Observability (campaigns) CreateCampaign, ListCampaigns, GetCampaign, DeleteCampaign, GetCampaignStatus, ListCampaignEvents
Observability (events) SearchChatCompletionEvents, SearchChatCompletionEventIDs, GetChatCompletionEvent, GetSimilarChatCompletionEvents, JudgeChatCompletionEvent
Observability (fields) GetChatCompletionFields, GetChatCompletionFieldOptions, GetChatCompletionFieldOptionsCounts
Observability (judges) CreateJudge, ListJudges, GetJudge, UpdateJudge, DeleteJudge, JudgeConversation
Observability (datasets) CreateDataset, ListDatasets, GetDataset, UpdateDataset, DeleteDataset, ExportDatasetToJSONL, ListDatasetRecords, CreateDatasetRecord, GetDatasetRecord, UpdateDatasetRecordPayload, UpdateDatasetRecordProperties, DeleteDatasetRecord, BulkDeleteDatasetRecords, JudgeDatasetRecord, ImportDatasetFromCampaign, ImportDatasetFromExplorer, ImportDatasetFromFile, ImportDatasetFromPlayground, ImportDatasetFromDataset, ListDatasetTasks, GetDatasetTask
Workflows (CRUD) ListWorkflows, GetWorkflow, UpdateWorkflow, ArchiveWorkflow, UnarchiveWorkflow, ExecuteWorkflow, ExecuteWorkflowAndWait
Workflows (registrations) ListWorkflowRegistrations, GetWorkflowRegistration, ExecuteWorkflowRegistration
Workflows (executions) GetWorkflowExecution, GetWorkflowExecutionHistory, StreamWorkflowExecution, SignalWorkflowExecution, QueryWorkflowExecution, UpdateWorkflowExecution, TerminateWorkflowExecution, CancelWorkflowExecution, ResetWorkflowExecution, BatchCancelWorkflowExecutions, BatchTerminateWorkflowExecutions
Workflows (trace) GetWorkflowExecutionTraceOTel, GetWorkflowExecutionTraceSummary, GetWorkflowExecutionTraceEvents
Workflows (events) StreamWorkflowEvents, ListWorkflowEvents
Workflows (deployments) ListWorkflowDeployments, GetWorkflowDeployment
Workflows (metrics) GetWorkflowMetrics
Workflows (runs) ListWorkflowRuns, GetWorkflowRun, GetWorkflowRunHistory
Workflows (schedules) ListWorkflowSchedules, ScheduleWorkflow, UnscheduleWorkflow
Workflows (workers) GetWorkflowWorkerInfo

Comparison

There is no official Go SDK from Mistral AI (only Python and TypeScript). The main community options:

Feature mistral-go-sdk Gage-Technologies robertjkeck2 AuxData-ai
Chat / Streaming Yes Yes Yes Yes
FIM Yes Yes No Yes
Embeddings Yes Yes Yes Yes
Tool calling Yes No No No
Agents (completions + CRUD) Yes No No No
Connectors (MCP) Yes No No No
Conversations API Yes No No No
Libraries / Documents Yes No No No
Fine-tuning / Batch Yes No No No
OCR Yes No No Yes
Audio (transcription + TTS + voices) Yes No No No
Workflows API Yes No No No
Observability (beta) Yes No No No
Moderation / Classification Yes No No No
Vision (multimodal) Yes No No Yes
Zero dependencies Yes test-only (testify) test-only (testify) test-only (testify)
Forward-compatible types Yes No No No
Last updated 2026 Jun 2024 Jan 2024 ~2025 (fork of Gage)

Configuration

client := mistral.NewClient("sk-...",
    mistral.WithBaseURL("https://custom-endpoint.example.com"),
    mistral.WithHTTPClient(customHTTPClient),
    mistral.WithTimeout(30 * time.Second),
    mistral.WithRetry(3, 500*time.Millisecond),
)
Option Description
WithBaseURL(url) Override the API base URL (default: https://api.mistral.ai)
WithHTTPClient(client) Use a custom *http.Client
WithTimeout(d) Set HTTP client timeout (default: 120s)
WithRetry(n, delay) Enable retry with exponential backoff + jitter on 429/5xx

Error Handling

resp, err := client.ChatComplete(ctx, req)
if err != nil {
    var apiErr *mistral.APIError
    if errors.As(err, &apiErr) {
        fmt.Printf("Status: %d, Message: %s\n", apiErr.StatusCode, apiErr.Message)
    }

    if mistral.IsRateLimit(err) {
        // 429 — back off and retry
    }
    if mistral.IsNotFound(err) {
        // 404 — resource not found
    }
    if mistral.IsAuth(err) {
        // 401 — invalid API key
    }
}

Upstream Reference

This SDK tracks the official Mistral OpenAPI spec as its primary reference for API surface and type definitions. A daily GitHub Action monitors the spec for changes and opens an issue when updates are detected.

The Mistral Python SDK is used as a secondary reference for implementation patterns.

SDK Version Upstream Python SDK Upstream OpenAPI
v1.4.0 v2.4.3 (excl. RAG ingestion-pipeline beta) v1.0.0
v1.3.0 v2.3.0 v0.1.104
v1.2.1 v2.2.0 —
v1.2.0 v2.2.0 —
v1.1.0 v2.1.3 —
v1.0.0 v2.0.4 —

License

MIT

Documentation

Overview

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, connector, conversation, embedding, model, file, finetune, batch, ocr, audio, library, moderation, classification, fim, and observability. 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.

Index

Examples

Constants

View Source
const Version = "1.3.0"

Version is the SDK version string.

Variables

This section is empty.

Functions

func IsAuth

func IsAuth(err error) bool

IsAuth returns true if the error is a 401 Unauthorized error.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the error is a 404 Not Found error.

Example
package main

import (
	"context"
	"fmt"

	mistral "github.com/VikingOwl91/mistral-go-sdk"
)

func main() {
	client := mistral.NewClient("sk-your-api-key")

	_, err := client.GetModel(context.Background(), "nonexistent-model")
	if mistral.IsNotFound(err) {
		fmt.Println("Model not found")
	}
}

func IsRateLimit

func IsRateLimit(err error) bool

IsRateLimit returns true if the error is a 429 Too Many Requests error.

Example
package main

import (
	"context"
	"fmt"

	mistral "github.com/VikingOwl91/mistral-go-sdk"
	"github.com/VikingOwl91/mistral-go-sdk/chat"
)

func main() {
	client := mistral.NewClient("sk-your-api-key")

	_, err := client.ChatComplete(context.Background(), &chat.CompletionRequest{
		Model: "mistral-small-latest",
		Messages: []chat.Message{
			&chat.UserMessage{Content: chat.TextContent("Hi")},
		},
	})
	if mistral.IsRateLimit(err) {
		fmt.Println("Rate limited — back off and retry")
	}
}

Types

type APIError

type APIError struct {
	StatusCode int    `json:"-"`
	Type       string `json:"type,omitempty"`
	Message    string `json:"message"`
	Param      string `json:"param,omitempty"`
	Code       string `json:"code,omitempty"`
}

APIError represents an error response from the Mistral API.

func (*APIError) Error

func (e *APIError) Error() string

type AudioStream

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

AudioStream wraps the generic Stream to provide typed audio events.

func (*AudioStream) Close

func (s *AudioStream) Close() error

Close releases the underlying connection.

func (*AudioStream) Current

func (s *AudioStream) Current() audio.StreamEvent

Current returns the most recently read event.

func (*AudioStream) Err

func (s *AudioStream) Err() error

Err returns any error encountered during streaming.

func (*AudioStream) Next

func (s *AudioStream) Next() bool

Next advances to the next event. Returns false when done or on error.

type Client

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

Client is a Mistral AI API client.

func NewClient

func NewClient(apiKey string, opts ...Option) *Client

NewClient creates a new Mistral AI client with the given API key.

Example
package main

import (
	mistral "github.com/VikingOwl91/mistral-go-sdk"
)

func main() {
	client := mistral.NewClient("sk-your-api-key")
	_ = client // use client to call API methods
}

func (*Client) AgentsComplete

func (c *Client) AgentsComplete(ctx context.Context, req *agents.CompletionRequest) (*chat.CompletionResponse, error)

AgentsComplete sends an agents completion request.

func (*Client) AgentsCompleteStream

func (c *Client) AgentsCompleteStream(ctx context.Context, req *agents.CompletionRequest) (*Stream[chat.CompletionChunk], error)

AgentsCompleteStream sends an agents request and returns a stream of chunks.

func (*Client) AppendConversation

func (c *Client) AppendConversation(ctx context.Context, conversationID string, req *conversation.AppendRequest) (*conversation.Response, error)

AppendConversation appends inputs to an existing conversation.

func (*Client) AppendConversationStream

func (c *Client) AppendConversationStream(ctx context.Context, conversationID string, req *conversation.AppendRequest) (*EventStream, error)

AppendConversationStream appends to a conversation and returns a stream of events.

func (*Client) ArchiveFineTunedModel

func (c *Client) ArchiveFineTunedModel(ctx context.Context, modelID string) (*finetune.ArchiveFTModelOut, error)

ArchiveFineTunedModel archives a fine-tuned model.

func (*Client) ArchiveWorkflow

func (c *Client) ArchiveWorkflow(ctx context.Context, workflowIdentifier string) (*workflow.WorkflowArchiveResponse, error)

ArchiveWorkflow archives a workflow.

func (*Client) BatchCancelWorkflowExecutions

func (c *Client) BatchCancelWorkflowExecutions(ctx context.Context, req *workflow.BatchExecutionBody) (*workflow.BatchExecutionResponse, error)

BatchCancelWorkflowExecutions cancels multiple workflow executions.

func (*Client) BatchTerminateWorkflowExecutions

func (c *Client) BatchTerminateWorkflowExecutions(ctx context.Context, req *workflow.BatchExecutionBody) (*workflow.BatchExecutionResponse, error)

BatchTerminateWorkflowExecutions terminates multiple workflow executions.

func (*Client) BulkDeleteDatasetRecords

func (c *Client) BulkDeleteDatasetRecords(ctx context.Context, req *observability.BulkDeleteRecordsRequest) error

BulkDeleteDatasetRecords deletes multiple dataset records.

func (*Client) CallConnectorTool

func (c *Client) CallConnectorTool(ctx context.Context, idOrName, toolName string, req *connector.CallToolRequest) (*connector.CallToolResponse, error)

CallConnectorTool invokes a tool on a connector.

func (*Client) CancelBatchJob

func (c *Client) CancelBatchJob(ctx context.Context, jobID string) (*batch.JobOut, error)

CancelBatchJob requests cancellation of a batch job.

func (*Client) CancelFineTuningJob

func (c *Client) CancelFineTuningJob(ctx context.Context, jobID string) (*finetune.JobOut, error)

CancelFineTuningJob requests cancellation of a fine-tuning job.

func (*Client) CancelWorkflowExecution

func (c *Client) CancelWorkflowExecution(ctx context.Context, executionID string) error

CancelWorkflowExecution cancels a workflow execution.

func (*Client) ChatComplete

func (c *Client) ChatComplete(ctx context.Context, req *chat.CompletionRequest) (*chat.CompletionResponse, error)

ChatComplete sends a chat completion request and returns the full response.

Example
package main

import (
	"context"
	"fmt"
	"log"

	mistral "github.com/VikingOwl91/mistral-go-sdk"
	"github.com/VikingOwl91/mistral-go-sdk/chat"
)

func main() {
	client := mistral.NewClient("sk-your-api-key")

	resp, err := client.ChatComplete(context.Background(), &chat.CompletionRequest{
		Model: "mistral-small-latest",
		Messages: []chat.Message{
			&chat.UserMessage{Content: chat.TextContent("What is the capital of France?")},
		},
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(resp.Choices[0].Message.Content)
}

func (*Client) ChatCompleteStream

func (c *Client) ChatCompleteStream(ctx context.Context, req *chat.CompletionRequest) (*Stream[chat.CompletionChunk], error)

ChatCompleteStream sends a chat completion request and returns a stream of completion chunks. The caller must call Close() on the returned stream.

Example
package main

import (
	"context"
	"fmt"
	"log"

	mistral "github.com/VikingOwl91/mistral-go-sdk"
	"github.com/VikingOwl91/mistral-go-sdk/chat"
)

func main() {
	client := mistral.NewClient("sk-your-api-key")

	stream, err := client.ChatCompleteStream(context.Background(), &chat.CompletionRequest{
		Model: "mistral-small-latest",
		Messages: []chat.Message{
			&chat.UserMessage{Content: chat.TextContent("Tell me a short joke.")},
		},
	})
	if err != nil {
		log.Fatal(err)
	}
	defer stream.Close()

	for stream.Next() {
		chunk := stream.Current()
		if len(chunk.Choices) > 0 {
			fmt.Print(chunk.Choices[0].Delta.Content)
		}
	}
	if err := stream.Err(); err != nil {
		log.Fatal(err)
	}
}

func (*Client) Classify

Classify sends a text classification request.

func (*Client) ClassifyChat

ClassifyChat sends a chat classification request.

func (*Client) CreateAgent

func (c *Client) CreateAgent(ctx context.Context, req *agents.CreateRequest) (*agents.Agent, error)

CreateAgent creates a new agent.

func (*Client) CreateBatchJob

func (c *Client) CreateBatchJob(ctx context.Context, req *batch.JobIn) (*batch.JobOut, error)

CreateBatchJob creates a new batch inference job.

func (*Client) CreateCampaign

CreateCampaign creates a new observability campaign.

func (*Client) CreateConnector

func (c *Client) CreateConnector(ctx context.Context, req *connector.CreateRequest) (*connector.Connector, error)

CreateConnector registers a new MCP connector.

func (*Client) CreateDataset

CreateDataset creates a new observability dataset.

func (*Client) CreateDatasetRecord

func (c *Client) CreateDatasetRecord(ctx context.Context, datasetID string, req *observability.CreateRecordRequest) (*observability.DatasetRecord, error)

CreateDatasetRecord creates a record in a dataset.

func (*Client) CreateEmbeddings

func (c *Client) CreateEmbeddings(ctx context.Context, req *embedding.Request) (*embedding.Response, error)

CreateEmbeddings sends an embedding request and returns the response.

Example
package main

import (
	"context"
	"fmt"
	"log"

	mistral "github.com/VikingOwl91/mistral-go-sdk"
	"github.com/VikingOwl91/mistral-go-sdk/embedding"
)

func main() {
	client := mistral.NewClient("sk-your-api-key")

	resp, err := client.CreateEmbeddings(context.Background(), &embedding.Request{
		Model: "mistral-embed",
		Input: []string{"Hello world"},
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("Embedding dimension: %d\n", len(resp.Data[0].Embedding))
}

func (*Client) CreateFineTuningJob

func (c *Client) CreateFineTuningJob(ctx context.Context, req *finetune.JobIn) (*finetune.JobOut, error)

CreateFineTuningJob creates a new fine-tuning job.

func (*Client) CreateJudge

CreateJudge creates a new observability judge.

func (*Client) CreateLibrary

func (c *Client) CreateLibrary(ctx context.Context, req *library.CreateRequest) (*library.Library, error)

CreateLibrary creates a new document library.

func (*Client) CreateVoice

func (c *Client) CreateVoice(ctx context.Context, req *audio.VoiceCreateRequest) (*audio.VoiceResponse, error)

CreateVoice creates a custom voice.

func (*Client) DeleteAgent

func (c *Client) DeleteAgent(ctx context.Context, agentID string) error

DeleteAgent deletes an agent.

func (*Client) DeleteAgentAlias

func (c *Client) DeleteAgentAlias(ctx context.Context, agentID string, alias string) error

DeleteAgentAlias deletes an agent version alias.

func (*Client) DeleteBatchJob

func (c *Client) DeleteBatchJob(ctx context.Context, jobID string) (*batch.DeleteResponse, error)

DeleteBatchJob deletes a batch job.

func (*Client) DeleteCampaign

func (c *Client) DeleteCampaign(ctx context.Context, campaignID string) error

DeleteCampaign deletes a campaign.

func (*Client) DeleteConnector

func (c *Client) DeleteConnector(ctx context.Context, idOrName string) error

DeleteConnector deletes a connector.

func (*Client) DeleteConversation

func (c *Client) DeleteConversation(ctx context.Context, conversationID string) error

DeleteConversation deletes a conversation.

func (*Client) DeleteDataset

func (c *Client) DeleteDataset(ctx context.Context, datasetID string) error

DeleteDataset deletes a dataset.

func (*Client) DeleteDatasetRecord

func (c *Client) DeleteDatasetRecord(ctx context.Context, recordID string) error

DeleteDatasetRecord deletes a dataset record.

func (*Client) DeleteDocument

func (c *Client) DeleteDocument(ctx context.Context, libraryID, documentID string) error

DeleteDocument deletes a document from a library.

func (*Client) DeleteFile

func (c *Client) DeleteFile(ctx context.Context, fileID string) (*file.DeleteResponse, error)

DeleteFile deletes a file by ID.

func (*Client) DeleteJudge

func (c *Client) DeleteJudge(ctx context.Context, judgeID string) error

DeleteJudge deletes a judge.

func (*Client) DeleteLibrary

func (c *Client) DeleteLibrary(ctx context.Context, libraryID string) (*library.Library, error)

DeleteLibrary deletes a library and all its documents.

func (*Client) DeleteModel

func (c *Client) DeleteModel(ctx context.Context, modelID string) (*model.DeleteModelOut, error)

DeleteModel deletes a fine-tuned model by ID.

func (*Client) DeleteVoice

func (c *Client) DeleteVoice(ctx context.Context, voiceID string) error

DeleteVoice deletes a voice.

func (*Client) ExecuteWorkflow

func (c *Client) ExecuteWorkflow(ctx context.Context, workflowIdentifier string, req *workflow.ExecutionRequest) (*workflow.ExecutionResponse, error)

ExecuteWorkflow executes a workflow.

func (*Client) ExecuteWorkflowAndWait

func (c *Client) ExecuteWorkflowAndWait(ctx context.Context, workflowIdentifier string, req *workflow.ExecutionRequest) (*workflow.ExecutionResponse, error)

ExecuteWorkflowAndWait executes a workflow and polls until completion.

func (*Client) ExecuteWorkflowRegistration deprecated

func (c *Client) ExecuteWorkflowRegistration(ctx context.Context, registrationID string, req *workflow.ExecutionRequest) (*workflow.ExecutionResponse, error)

ExecuteWorkflowRegistration executes a workflow via its registration.

Deprecated: Use ExecuteWorkflow instead. This method will be removed in a future release.

func (*Client) ExportDatasetToJSONL

func (c *Client) ExportDatasetToJSONL(ctx context.Context, datasetID string) (*observability.ExportDatasetResponse, error)

ExportDatasetToJSONL exports a dataset to JSONL format.

func (*Client) FIMComplete

func (c *Client) FIMComplete(ctx context.Context, req *fim.CompletionRequest) (*chat.CompletionResponse, error)

FIMComplete sends a Fill-In-the-Middle completion request.

func (*Client) FIMCompleteStream

func (c *Client) FIMCompleteStream(ctx context.Context, req *fim.CompletionRequest) (*Stream[chat.CompletionChunk], error)

FIMCompleteStream sends a FIM request and returns a stream of chunks.

func (*Client) GetAgent

func (c *Client) GetAgent(ctx context.Context, agentID string) (*agents.Agent, error)

GetAgent retrieves an agent by ID.

func (*Client) GetAgentVersion

func (c *Client) GetAgentVersion(ctx context.Context, agentID string, version string) (*agents.Agent, error)

GetAgentVersion retrieves a specific version of an agent.

func (*Client) GetBatchJob

func (c *Client) GetBatchJob(ctx context.Context, jobID string) (*batch.JobOut, error)

GetBatchJob retrieves a batch job by ID.

func (*Client) GetCampaign

func (c *Client) GetCampaign(ctx context.Context, campaignID string) (*observability.Campaign, error)

GetCampaign retrieves a campaign by ID.

func (*Client) GetCampaignStatus

func (c *Client) GetCampaignStatus(ctx context.Context, campaignID string) (*observability.CampaignStatusResponse, error)

GetCampaignStatus retrieves the status of a campaign.

func (*Client) GetChatCompletionEvent

func (c *Client) GetChatCompletionEvent(ctx context.Context, eventID string) (*observability.ChatCompletionEvent, error)

GetChatCompletionEvent retrieves a chat completion event by ID.

func (*Client) GetChatCompletionFieldOptions added in v1.4.0

func (c *Client) GetChatCompletionFieldOptions(ctx context.Context, fieldName string, operator observability.FieldOperator) (*observability.ChatCompletionFieldOptions, error)

GetChatCompletionFieldOptions returns the distinct values seen for the given field, filtered by the requested operator.

func (*Client) GetChatCompletionFieldOptionsCounts added in v1.4.0

func (c *Client) GetChatCompletionFieldOptionsCounts(ctx context.Context, fieldName string, req *observability.FieldOptionCountsRequest) (*observability.FieldOptionCounts, error)

GetChatCompletionFieldOptionsCounts returns per-value event counts for the given field, optionally filtered by the supplied filter payload.

func (*Client) GetChatCompletionFields added in v1.4.0

func (c *Client) GetChatCompletionFields(ctx context.Context) (*observability.ChatCompletionFields, error)

GetChatCompletionFields returns the searchable field definitions and groups for chat-completion observability events.

func (*Client) GetConnector

func (c *Client) GetConnector(ctx context.Context, idOrName string) (*connector.Connector, error)

GetConnector retrieves a connector by ID or name.

func (*Client) GetConnectorAuthURL

func (c *Client) GetConnectorAuthURL(ctx context.Context, idOrName string, appReturnURL *string) (*connector.AuthURLResponse, error)

GetConnectorAuthURL returns the OAuth2 authorization URL for a connector.

func (*Client) GetConversation

func (c *Client) GetConversation(ctx context.Context, conversationID string) (*conversation.Conversation, error)

GetConversation retrieves conversation metadata.

func (*Client) GetConversationHistory

func (c *Client) GetConversationHistory(ctx context.Context, conversationID string) (*conversation.History, error)

GetConversationHistory returns the full history of a conversation.

func (*Client) GetConversationMessages

func (c *Client) GetConversationMessages(ctx context.Context, conversationID string) (*conversation.Messages, error)

GetConversationMessages returns the messages of a conversation.

func (*Client) GetDataset

func (c *Client) GetDataset(ctx context.Context, datasetID string) (*observability.Dataset, error)

GetDataset retrieves a dataset by ID.

func (*Client) GetDatasetRecord

func (c *Client) GetDatasetRecord(ctx context.Context, recordID string) (*observability.DatasetRecord, error)

GetDatasetRecord retrieves a dataset record by ID.

func (*Client) GetDatasetTask

func (c *Client) GetDatasetTask(ctx context.Context, datasetID, taskID string) (*observability.DatasetImportTask, error)

GetDatasetTask retrieves an import task by ID.

func (*Client) GetDocument

func (c *Client) GetDocument(ctx context.Context, libraryID, documentID string) (*library.Document, error)

GetDocument retrieves a document's metadata.

func (*Client) GetDocumentExtractedTextSignedURL

func (c *Client) GetDocumentExtractedTextSignedURL(ctx context.Context, libraryID, documentID string) (string, error)

GetDocumentExtractedTextSignedURL retrieves a signed URL for the extracted text.

func (*Client) GetDocumentSignedURL

func (c *Client) GetDocumentSignedURL(ctx context.Context, libraryID, documentID string) (string, error)

GetDocumentSignedURL retrieves a signed URL for downloading a document.

func (*Client) GetDocumentStatus

func (c *Client) GetDocumentStatus(ctx context.Context, libraryID, documentID string) (*library.ProcessingStatusOut, error)

GetDocumentStatus retrieves the processing status of a document.

func (*Client) GetDocumentTextContent

func (c *Client) GetDocumentTextContent(ctx context.Context, libraryID, documentID string) (*library.DocumentTextContent, error)

GetDocumentTextContent retrieves the extracted text of a document.

func (*Client) GetFile

func (c *Client) GetFile(ctx context.Context, fileID string) (*file.File, error)

GetFile retrieves file metadata by ID.

func (*Client) GetFileContent

func (c *Client) GetFileContent(ctx context.Context, fileID string) (io.ReadCloser, error)

GetFileContent downloads the raw content of a file. The caller must close the returned ReadCloser.

func (*Client) GetFileURL

func (c *Client) GetFileURL(ctx context.Context, fileID string, expiryHours int) (*file.SignedURL, error)

GetFileURL returns a signed URL for downloading a file. Expiry is in hours (default 24 if 0).

func (*Client) GetFineTuningJob

func (c *Client) GetFineTuningJob(ctx context.Context, jobID string) (*finetune.JobOut, error)

GetFineTuningJob retrieves a fine-tuning job by ID.

func (*Client) GetJudge

func (c *Client) GetJudge(ctx context.Context, judgeID string) (*observability.Judge, error)

GetJudge retrieves a judge by ID.

func (*Client) GetLibrary

func (c *Client) GetLibrary(ctx context.Context, libraryID string) (*library.Library, error)

GetLibrary retrieves a library by ID.

func (*Client) GetModel

func (c *Client) GetModel(ctx context.Context, modelID string) (*model.ModelCard, error)

GetModel retrieves a specific model by ID.

func (*Client) GetSimilarChatCompletionEvents

func (c *Client) GetSimilarChatCompletionEvents(ctx context.Context, eventID string, params *observability.PaginationParams) (*observability.SimilarEventsResponse, error)

GetSimilarChatCompletionEvents retrieves events similar to a given event.

func (*Client) GetVoice

func (c *Client) GetVoice(ctx context.Context, voiceID string) (*audio.VoiceResponse, error)

GetVoice retrieves a voice by ID.

func (*Client) GetVoiceSampleAudio

func (c *Client) GetVoiceSampleAudio(ctx context.Context, voiceID string) (*http.Response, error)

GetVoiceSampleAudio retrieves the sample audio for a voice. Returns the raw HTTP response; the caller must close the body.

func (*Client) GetWorkflow

func (c *Client) GetWorkflow(ctx context.Context, workflowIdentifier string) (*workflow.Workflow, error)

GetWorkflow retrieves a workflow by identifier.

func (*Client) GetWorkflowDeployment

func (c *Client) GetWorkflowDeployment(ctx context.Context, deploymentID string) (*workflow.Deployment, error)

GetWorkflowDeployment retrieves a workflow deployment by ID.

func (*Client) GetWorkflowExecution

func (c *Client) GetWorkflowExecution(ctx context.Context, executionID string) (*workflow.ExecutionResponse, error)

GetWorkflowExecution retrieves a workflow execution by ID.

func (*Client) GetWorkflowExecutionHistory

func (c *Client) GetWorkflowExecutionHistory(ctx context.Context, executionID string, decodePayloads *bool) (json.RawMessage, error)

GetWorkflowExecutionHistory retrieves the history of a workflow execution.

func (*Client) GetWorkflowExecutionTraceEvents

func (c *Client) GetWorkflowExecutionTraceEvents(ctx context.Context, executionID string, params *workflow.TraceEventsParams) (*workflow.TraceEventsResponse, error)

GetWorkflowExecutionTraceEvents retrieves the trace events for a workflow execution.

func (*Client) GetWorkflowExecutionTraceOTel

func (c *Client) GetWorkflowExecutionTraceOTel(ctx context.Context, executionID string) (*workflow.TraceOTelResponse, error)

GetWorkflowExecutionTraceOTel retrieves the OpenTelemetry trace for a workflow execution.

func (*Client) GetWorkflowExecutionTraceSummary

func (c *Client) GetWorkflowExecutionTraceSummary(ctx context.Context, executionID string) (*workflow.TraceSummaryResponse, error)

GetWorkflowExecutionTraceSummary retrieves the trace summary for a workflow execution.

func (*Client) GetWorkflowMetrics

func (c *Client) GetWorkflowMetrics(ctx context.Context, workflowName string, params *workflow.MetricsParams) (*workflow.Metrics, error)

GetWorkflowMetrics retrieves performance metrics for a workflow.

func (*Client) GetWorkflowRegistration

func (c *Client) GetWorkflowRegistration(ctx context.Context, registrationID string, params *workflow.RegistrationGetParams) (*workflow.Registration, error)

GetWorkflowRegistration retrieves a workflow registration by ID.

func (*Client) GetWorkflowRun

func (c *Client) GetWorkflowRun(ctx context.Context, runID string) (*workflow.Run, error)

GetWorkflowRun retrieves a workflow run by ID.

func (*Client) GetWorkflowRunHistory

func (c *Client) GetWorkflowRunHistory(ctx context.Context, runID string) (json.RawMessage, error)

GetWorkflowRunHistory retrieves the history of a workflow run.

func (*Client) GetWorkflowWorkerInfo

func (c *Client) GetWorkflowWorkerInfo(ctx context.Context) (*workflow.WorkerInfo, error)

GetWorkflowWorkerInfo returns the scheduler URL, namespace, and TLS setting the API expects custom workers to connect with.

Most callers using managed deployments do not need this — see Registration.DeploymentID. It is exposed for users running custom workers.

func (*Client) ImportDatasetFromCampaign

func (c *Client) ImportDatasetFromCampaign(ctx context.Context, datasetID string, req *observability.ImportFromCampaignRequest) (*observability.DatasetImportTask, error)

ImportDatasetFromCampaign imports records from a campaign.

func (*Client) ImportDatasetFromDataset

func (c *Client) ImportDatasetFromDataset(ctx context.Context, datasetID string, req *observability.ImportFromDatasetRequest) (*observability.DatasetImportTask, error)

ImportDatasetFromDataset imports records from another dataset.

func (*Client) ImportDatasetFromExplorer

func (c *Client) ImportDatasetFromExplorer(ctx context.Context, datasetID string, req *observability.ImportFromExplorerRequest) (*observability.DatasetImportTask, error)

ImportDatasetFromExplorer imports records from explorer events.

func (*Client) ImportDatasetFromFile

func (c *Client) ImportDatasetFromFile(ctx context.Context, datasetID string, req *observability.ImportFromFileRequest) (*observability.DatasetImportTask, error)

ImportDatasetFromFile imports records from a file.

func (*Client) ImportDatasetFromPlayground

func (c *Client) ImportDatasetFromPlayground(ctx context.Context, datasetID string, req *observability.ImportFromPlaygroundRequest) (*observability.DatasetImportTask, error)

ImportDatasetFromPlayground imports records from playground conversations.

func (*Client) JudgeChatCompletionEvent

func (c *Client) JudgeChatCompletionEvent(ctx context.Context, eventID string, req *observability.JudgeEventRequest) (json.RawMessage, error)

JudgeChatCompletionEvent judges a chat completion event.

func (*Client) JudgeConversation

func (c *Client) JudgeConversation(ctx context.Context, judgeID string, req *observability.JudgeConversationRequest) (json.RawMessage, error)

JudgeConversation performs live judging on a conversation.

func (*Client) JudgeDatasetRecord

func (c *Client) JudgeDatasetRecord(ctx context.Context, recordID string, req *observability.JudgeRecordRequest) (json.RawMessage, error)

JudgeDatasetRecord judges a dataset record.

func (*Client) ListAgentAliases

func (c *Client) ListAgentAliases(ctx context.Context, agentID string) ([]agents.AliasResponse, error)

ListAgentAliases lists all version aliases for an agent.

func (*Client) ListAgentVersions

func (c *Client) ListAgentVersions(ctx context.Context, agentID string, params *agents.ListVersionsParams) ([]agents.Agent, error)

ListAgentVersions lists all versions of an agent.

func (*Client) ListAgents

func (c *Client) ListAgents(ctx context.Context, params *agents.ListParams) ([]agents.Agent, error)

ListAgents lists agents with optional filters and pagination.

func (*Client) ListBatchJobs

func (c *Client) ListBatchJobs(ctx context.Context, params *batch.ListParams) (*batch.JobsOut, error)

ListBatchJobs lists batch jobs with optional filters.

func (*Client) ListCampaignEvents

func (c *Client) ListCampaignEvents(ctx context.Context, campaignID string, params *observability.PaginationParams) (*observability.ListCampaignEventsResponse, error)

ListCampaignEvents lists events selected by a campaign.

func (*Client) ListCampaigns

ListCampaigns lists observability campaigns.

func (*Client) ListConnectorTools

func (c *Client) ListConnectorTools(ctx context.Context, idOrName string, params *connector.ListToolsParams) ([]connector.Tool, error)

ListConnectorTools lists tools exposed by a connector.

func (*Client) ListConnectors

func (c *Client) ListConnectors(ctx context.Context, params *connector.ListParams) ([]connector.Connector, error)

ListConnectors returns all connectors.

func (*Client) ListConversations

func (c *Client) ListConversations(ctx context.Context, params *conversation.ListParams) ([]conversation.Conversation, error)

ListConversations lists conversations with optional pagination.

func (*Client) ListDatasetRecords

func (c *Client) ListDatasetRecords(ctx context.Context, datasetID string, params *observability.PaginationParams) (*observability.ListRecordsResponse, error)

ListDatasetRecords lists records in a dataset.

func (*Client) ListDatasetTasks

func (c *Client) ListDatasetTasks(ctx context.Context, datasetID string, params *observability.PaginationParams) (*observability.ListTasksResponse, error)

ListDatasetTasks lists import tasks for a dataset.

func (*Client) ListDatasets

ListDatasets lists observability datasets.

func (*Client) ListDocuments

func (c *Client) ListDocuments(ctx context.Context, libraryID string, params *library.ListDocumentParams) (*library.ListDocumentOut, error)

ListDocuments lists documents in a library.

func (*Client) ListFiles

func (c *Client) ListFiles(ctx context.Context, params *file.ListParams) (*file.ListResponse, error)

ListFiles returns a list of uploaded files.

func (*Client) ListFineTuningJobs

func (c *Client) ListFineTuningJobs(ctx context.Context, params *finetune.ListParams) (*finetune.JobsOut, error)

ListFineTuningJobs lists fine-tuning jobs with optional filters.

func (*Client) ListJudges

ListJudges lists observability judges.

func (*Client) ListLibraries

func (c *Client) ListLibraries(ctx context.Context, params *library.ListLibraryParams) (*library.ListLibraryOut, error)

ListLibraries lists all accessible libraries.

func (*Client) ListLibrarySharing

func (c *Client) ListLibrarySharing(ctx context.Context, libraryID string) (*library.ListSharingOut, error)

ListLibrarySharing lists all sharing entries for a library.

func (*Client) ListModels

func (c *Client) ListModels(ctx context.Context, params *model.ListParams) (*model.ModelList, error)

ListModels returns a list of available models.

func (*Client) ListVoices

func (c *Client) ListVoices(ctx context.Context) (*audio.VoiceListResponse, error)

ListVoices returns available voices.

func (*Client) ListWorkflowDeployments

func (c *Client) ListWorkflowDeployments(ctx context.Context, params *workflow.DeploymentListParams) (*workflow.DeploymentListResponse, error)

ListWorkflowDeployments lists workflow deployments.

func (*Client) ListWorkflowEvents

func (c *Client) ListWorkflowEvents(ctx context.Context, params *workflow.EventListParams) (*workflow.EventListResponse, error)

ListWorkflowEvents lists workflow events.

func (*Client) ListWorkflowRegistrations

func (c *Client) ListWorkflowRegistrations(ctx context.Context, params *workflow.RegistrationListParams) (*workflow.RegistrationListResponse, error)

ListWorkflowRegistrations lists workflow registrations.

func (*Client) ListWorkflowRuns

func (c *Client) ListWorkflowRuns(ctx context.Context, params *workflow.RunListParams) (*workflow.ListRunsResponse, error)

ListWorkflowRuns lists workflow runs.

func (*Client) ListWorkflowSchedules

func (c *Client) ListWorkflowSchedules(ctx context.Context) (*workflow.ScheduleListResponse, error)

ListWorkflowSchedules lists workflow schedules.

func (*Client) ListWorkflows

ListWorkflows lists workflows.

func (*Client) Moderate

func (c *Client) Moderate(ctx context.Context, req *moderation.Request) (*moderation.Response, error)

Moderate sends a text moderation request.

func (*Client) ModerateChat

func (c *Client) ModerateChat(ctx context.Context, req *moderation.ChatRequest) (*moderation.Response, error)

ModerateChat sends a chat moderation request.

func (*Client) OCR

func (c *Client) OCR(ctx context.Context, req *ocr.Request) (*ocr.Response, error)

OCR performs optical character recognition on a document.

func (*Client) QueryWorkflowExecution

func (c *Client) QueryWorkflowExecution(ctx context.Context, executionID string, req *workflow.QueryInvocationBody) (*workflow.QueryResponse, error)

QueryWorkflowExecution queries a workflow execution.

func (*Client) ReprocessDocument

func (c *Client) ReprocessDocument(ctx context.Context, libraryID, documentID string) error

ReprocessDocument triggers reprocessing of a document.

func (*Client) ResetWorkflowExecution

func (c *Client) ResetWorkflowExecution(ctx context.Context, executionID string, req *workflow.ResetInvocationBody) error

ResetWorkflowExecution resets a workflow execution to a specific event.

func (*Client) RestartConversation

func (c *Client) RestartConversation(ctx context.Context, conversationID string, req *conversation.RestartRequest) (*conversation.Response, error)

RestartConversation restarts a conversation from a specific entry.

func (*Client) RestartConversationStream

func (c *Client) RestartConversationStream(ctx context.Context, conversationID string, req *conversation.RestartRequest) (*EventStream, error)

RestartConversationStream restarts a conversation and returns a stream of events.

func (*Client) ScheduleWorkflow

func (c *Client) ScheduleWorkflow(ctx context.Context, req *workflow.ScheduleRequest) (*workflow.ScheduleResponse, error)

ScheduleWorkflow creates a workflow schedule.

func (*Client) SearchChatCompletionEventIDs

func (c *Client) SearchChatCompletionEventIDs(ctx context.Context, req *observability.SearchEventIDsRequest) (*observability.SearchEventIDsResponse, error)

SearchChatCompletionEventIDs searches for chat completion event IDs.

func (*Client) SearchChatCompletionEvents

func (c *Client) SearchChatCompletionEvents(ctx context.Context, req *observability.SearchEventsRequest) (*observability.SearchEventsResponse, error)

SearchChatCompletionEvents searches for chat completion events.

func (*Client) SetAgentAlias

func (c *Client) SetAgentAlias(ctx context.Context, agentID string, alias string, version int) (*agents.AliasResponse, error)

SetAgentAlias creates or updates an agent version alias.

func (*Client) ShareLibrary

func (c *Client) ShareLibrary(ctx context.Context, libraryID string, req *library.SharingRequest) (*library.SharingOut, error)

ShareLibrary creates or updates a sharing entry.

func (*Client) SignalWorkflowExecution

func (c *Client) SignalWorkflowExecution(ctx context.Context, executionID string, req *workflow.SignalInvocationBody) (*workflow.SignalResponse, error)

SignalWorkflowExecution sends a signal to a workflow execution.

func (*Client) Speech

Speech sends a text-to-speech request and returns the full response.

func (*Client) SpeechStream

func (c *Client) SpeechStream(ctx context.Context, req *audio.SpeechRequest) (*SpeechStream, error)

SpeechStream sends a text-to-speech request and returns a stream of audio events.

func (*Client) StartConversation

func (c *Client) StartConversation(ctx context.Context, req *conversation.StartRequest) (*conversation.Response, error)

StartConversation creates and starts a new conversation.

func (*Client) StartConversationStream

func (c *Client) StartConversationStream(ctx context.Context, req *conversation.StartRequest) (*EventStream, error)

StartConversationStream creates a conversation and returns a stream of events.

func (*Client) StartFineTuningJob

func (c *Client) StartFineTuningJob(ctx context.Context, jobID string) (*finetune.JobOut, error)

StartFineTuningJob starts a validated fine-tuning job.

func (*Client) StreamWorkflowEvents

func (c *Client) StreamWorkflowEvents(ctx context.Context, params *workflow.EventStreamParams) (*WorkflowEventStream, error)

StreamWorkflowEvents streams workflow events via SSE.

func (*Client) StreamWorkflowExecution

func (c *Client) StreamWorkflowExecution(ctx context.Context, executionID string, params *workflow.StreamParams) (*WorkflowEventStream, error)

StreamWorkflowExecution streams events for a workflow execution via SSE.

func (*Client) TerminateWorkflowExecution

func (c *Client) TerminateWorkflowExecution(ctx context.Context, executionID string) error

TerminateWorkflowExecution terminates a workflow execution.

func (*Client) Transcribe

func (c *Client) Transcribe(ctx context.Context, req *audio.TranscriptionRequest, filename string, file io.Reader) (*audio.TranscriptionResponse, error)

Transcribe sends an audio file for transcription. If file is non-nil, it's uploaded via multipart. Otherwise, FileURL or FileID must be set.

func (*Client) TranscribeStream

func (c *Client) TranscribeStream(ctx context.Context, req *audio.TranscriptionRequest, filename string, file io.Reader) (*AudioStream, error)

TranscribeStream sends an audio file for streaming transcription.

func (*Client) UnarchiveFineTunedModel

func (c *Client) UnarchiveFineTunedModel(ctx context.Context, modelID string) (*finetune.UnarchiveFTModelOut, error)

UnarchiveFineTunedModel unarchives a fine-tuned model.

func (*Client) UnarchiveWorkflow

func (c *Client) UnarchiveWorkflow(ctx context.Context, workflowIdentifier string) (*workflow.WorkflowArchiveResponse, error)

UnarchiveWorkflow unarchives a workflow.

func (*Client) UnscheduleWorkflow

func (c *Client) UnscheduleWorkflow(ctx context.Context, scheduleID string) error

UnscheduleWorkflow removes a workflow schedule.

func (*Client) UnshareLibrary

func (c *Client) UnshareLibrary(ctx context.Context, libraryID string, req *library.SharingDeleteRequest) (*library.SharingOut, error)

UnshareLibrary deletes a sharing entry.

func (*Client) UpdateAgent

func (c *Client) UpdateAgent(ctx context.Context, agentID string, req *agents.UpdateRequest) (*agents.Agent, error)

UpdateAgent updates an agent, creating a new version.

func (*Client) UpdateAgentVersion

func (c *Client) UpdateAgentVersion(ctx context.Context, agentID string, version int) (*agents.Agent, error)

UpdateAgentVersion switches an agent to a specific version.

func (*Client) UpdateConnector

func (c *Client) UpdateConnector(ctx context.Context, idOrName string, req *connector.UpdateRequest) (*connector.Connector, error)

UpdateConnector updates an existing connector.

func (*Client) UpdateDataset

func (c *Client) UpdateDataset(ctx context.Context, datasetID string, req *observability.UpdateDatasetRequest) (*observability.Dataset, error)

UpdateDataset updates a dataset.

func (*Client) UpdateDatasetRecordPayload

func (c *Client) UpdateDatasetRecordPayload(ctx context.Context, recordID string, req *observability.UpdateRecordPayloadRequest) (*observability.DatasetRecord, error)

UpdateDatasetRecordPayload updates a record's payload.

func (*Client) UpdateDatasetRecordProperties

func (c *Client) UpdateDatasetRecordProperties(ctx context.Context, recordID string, req *observability.UpdateRecordPropertiesRequest) (*observability.DatasetRecord, error)

UpdateDatasetRecordProperties updates a record's properties.

func (*Client) UpdateDocument

func (c *Client) UpdateDocument(ctx context.Context, libraryID, documentID string, req *library.DocumentUpdateRequest) (*library.Document, error)

UpdateDocument updates a document's metadata.

func (*Client) UpdateFineTunedModel

func (c *Client) UpdateFineTunedModel(ctx context.Context, modelID string, req *finetune.UpdateFTModelIn) (json.RawMessage, error)

UpdateFineTunedModel updates a fine-tuned model's name or description.

func (*Client) UpdateJudge

func (c *Client) UpdateJudge(ctx context.Context, judgeID string, req *observability.UpdateJudgeRequest) (*observability.Judge, error)

UpdateJudge updates a judge.

func (*Client) UpdateLibrary

func (c *Client) UpdateLibrary(ctx context.Context, libraryID string, req *library.UpdateRequest) (*library.Library, error)

UpdateLibrary updates a library's name and description.

func (*Client) UpdateVoice

func (c *Client) UpdateVoice(ctx context.Context, voiceID string, req *audio.VoiceUpdateRequest) (*audio.VoiceResponse, error)

UpdateVoice updates a voice.

func (*Client) UpdateWorkflow

func (c *Client) UpdateWorkflow(ctx context.Context, workflowIdentifier string, req *workflow.WorkflowUpdateRequest) (*workflow.Workflow, error)

UpdateWorkflow updates a workflow.

func (*Client) UpdateWorkflowExecution

func (c *Client) UpdateWorkflowExecution(ctx context.Context, executionID string, req *workflow.UpdateInvocationBody) (*workflow.UpdateResponse, error)

UpdateWorkflowExecution sends an update to a workflow execution.

func (*Client) UploadDocument

func (c *Client) UploadDocument(ctx context.Context, libraryID string, filename string, file io.Reader) (*library.Document, error)

UploadDocument uploads a document to a library.

func (*Client) UploadFile

func (c *Client) UploadFile(ctx context.Context, filename string, r io.Reader, params *file.UploadParams) (*file.File, error)

UploadFile uploads a file for use with fine-tuning, batch, or OCR.

type EventStream

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

EventStream wraps the generic Stream to provide typed conversation events.

func (*EventStream) Close

func (s *EventStream) Close() error

Close releases the underlying connection.

func (*EventStream) Current

func (s *EventStream) Current() conversation.Event

Current returns the most recently read event.

func (*EventStream) Err

func (s *EventStream) Err() error

Err returns any error encountered during streaming.

func (*EventStream) Next

func (s *EventStream) Next() bool

Next advances to the next event. Returns false when done or on error.

type Option

type Option func(*Client)

Option configures a Client.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL sets the API base URL.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets the underlying HTTP client.

func WithRetry

func WithRetry(maxRetries int, baseDelay time.Duration) Option

WithRetry configures retry behavior for transient errors.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the HTTP client timeout.

type SpeechStream

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

SpeechStream wraps the generic Stream for speech streaming events.

func (*SpeechStream) Close

func (s *SpeechStream) Close() error

Close releases the underlying connection.

func (*SpeechStream) Current

func (s *SpeechStream) Current() audio.SpeechStreamEvent

Current returns the most recently read event.

func (*SpeechStream) Err

func (s *SpeechStream) Err() error

Err returns any error encountered during streaming.

func (*SpeechStream) Next

func (s *SpeechStream) Next() bool

Next advances to the next event. Returns false when done or on error.

type Stream

type Stream[T any] struct {
	// contains filtered or unexported fields
}

Stream is a generic iterator for streaming API responses. Use Next() to advance, Current() to read the value, Err() for errors, and Close() when done.

func (*Stream[T]) Close

func (s *Stream[T]) Close() error

Close releases the underlying HTTP response body.

func (*Stream[T]) Current

func (s *Stream[T]) Current() T

Current returns the most recently read value. Only valid after Next() returns true.

func (*Stream[T]) Err

func (s *Stream[T]) Err() error

Err returns any error encountered during streaming.

func (*Stream[T]) Next

func (s *Stream[T]) Next() bool

Next advances to the next event. Returns false when the stream is exhausted or an error occurs.

type WorkflowEventStream

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

WorkflowEventStream wraps the generic Stream to provide typed workflow events with StreamPayload envelope metadata.

func (*WorkflowEventStream) Close

func (s *WorkflowEventStream) Close() error

Close releases the underlying connection.

func (*WorkflowEventStream) Current

func (s *WorkflowEventStream) Current() workflow.Event

Current returns the most recently read workflow event.

func (*WorkflowEventStream) CurrentPayload

func (s *WorkflowEventStream) CurrentPayload() *workflow.StreamPayload

CurrentPayload returns the full StreamPayload envelope of the current event.

func (*WorkflowEventStream) Err

func (s *WorkflowEventStream) Err() error

Err returns any error encountered during streaming.

func (*WorkflowEventStream) Next

func (s *WorkflowEventStream) Next() bool

Next advances to the next event. Returns false when done or on error.

Directories

Path Synopsis
Package agents provides types for the Mistral agents API, including agent CRUD operations and agent chat completions.
Package agents provides types for the Mistral agents API, including agent CRUD operations and agent chat completions.
Package audio provides types for the Mistral audio APIs.
Package audio provides types for the Mistral audio APIs.
Package batch provides types for the Mistral batch jobs API.
Package batch provides types for the Mistral batch jobs API.
Package chat provides types for the Mistral chat completion API.
Package chat provides types for the Mistral chat completion API.
Package classification provides types for the Mistral classification API.
Package classification provides types for the Mistral classification API.
Package connector provides types for the Mistral connectors API.
Package connector provides types for the Mistral connectors API.
Package conversation provides types for the Mistral conversations API.
Package conversation provides types for the Mistral conversations API.
Package embedding provides types for the Mistral embeddings API.
Package embedding provides types for the Mistral embeddings API.
Package file provides types for the Mistral files API, including upload, download, and metadata operations.
Package file provides types for the Mistral files API, including upload, download, and metadata operations.
Package fim provides types for the Mistral Fill-in-the-Middle (FIM) completion API, used for code infilling tasks.
Package fim provides types for the Mistral Fill-in-the-Middle (FIM) completion API, used for code infilling tasks.
Package finetune provides types for the Mistral fine-tuning API, including job creation, monitoring, and model archiving.
Package finetune provides types for the Mistral fine-tuning API, including job creation, monitoring, and model archiving.
Package library provides types for the Mistral document libraries API, including library and document CRUD, sharing, and processing.
Package library provides types for the Mistral document libraries API, including library and document CRUD, sharing, and processing.
Package model provides types for Mistral model listing and metadata.
Package model provides types for Mistral model listing and metadata.
Package moderation provides types for the Mistral moderation API.
Package moderation provides types for the Mistral moderation API.
Package observability provides types for the Mistral observability API (beta).
Package observability provides types for the Mistral observability API (beta).
Package ocr provides types for the Mistral OCR API, including document processing with page-level extraction.
Package ocr provides types for the Mistral OCR API, including document processing with page-level extraction.
Package workflow provides types for the Mistral workflows API.
Package workflow provides types for the Mistral workflows API.

Jump to

Keyboard shortcuts

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