mistral

package
v1.3.16-rc21 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MistralURL = "https://api.mistral.ai/v1/chat/completions"

Variables

View Source
var MINSTRAL_DEFAULT = Mistral{
	Model:       "mistral-large-latest",
	Temperature: 0.7,
	TopP:        1.0,
	Url:         MistralURL,
	MaxTokens:   100000,
}

Functions

This section is empty.

Types

type Call

type Call struct {
	Arguments string `json:"arguments"`
	Name      string `json:"name"`
}

type Choice

type Choice struct {
	Index int     `json:"index"`
	Delta Message `json:"delta"`
}

type Message

type Message struct {
	Content   string `json:"content"`
	Role      string `json:"role"`
	ToolCalls []struct {
		Call Call `json:"function"`
	} `json:"tool_calls"`
}

type Mistral

type Mistral struct {
	generic.StreamCompleter
	Model       string  `json:"model"`
	Url         string  `json:"url"`
	TopP        float64 `json:"top_p"`
	Temperature float64 `json:"temperature"`
	SafePrompt  bool    `json:"safe_prompt"`
	MaxTokens   int     `json:"max_tokens"`
	RandomSeed  int     `json:"random_seed"`
}

func (*Mistral) RegisterTool added in v1.3.4

func (m *Mistral) RegisterTool(tool tools.AiTool)

func (*Mistral) Setup

func (m *Mistral) Setup() error

func (*Mistral) StreamCompletions

func (m *Mistral) StreamCompletions(ctx context.Context, chat models.Chat) (chan models.CompletionEvent, error)

type MistralTool

type MistralTool struct {
	Description string            `json:"description"`
	Name        string            `json:"name"`
	Parameters  tools.InputSchema `json:"parameters"`
}

type MistralToolSuper

type MistralToolSuper struct {
	Function MistralTool `json:"function"`
	Type     string      `json:"type"`
}

type Request

type Request struct {
	MaxTokens   int                `json:"max_tokens,omitempty"`
	Messages    []models.Message   `json:"messages,omitempty"`
	Model       string             `json:"model,omitempty"`
	RandomSeed  int                `json:"random_seed,omitempty"`
	SafePrompt  bool               `json:"safe_prompt,omitempty"`
	Stream      bool               `json:"stream,omitempty"`
	Temperature float64            `json:"temperature,omitempty"`
	ToolChoice  string             `json:"tool_choice,omitempty"`
	Tools       []MistralToolSuper `json:"tools,omitempty"`
	TopP        float64            `json:"top_p,omitempty"`
}

type Response

type Response struct {
	FinishReason string   `json:"finish_reason"`
	Choices      []Choice `json:"choices"`
	Created      int      `json:"created"`
	ID           string   `json:"id"`
	Model        string   `json:"model"`
	Object       string   `json:"object"`
	Usage        Usage    `json:"usage"`
}

type Usage

type Usage struct {
	CompletionTokens int `json:"completion_tokens"`
	PromptTokens     int `json:"prompt_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

Jump to

Keyboard shortcuts

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