mistral

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: MIT Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	CallbacksHandler callbacks.Handler
	// contains filtered or unexported fields
}

Model encapsulates an instantiated Mistral client, the client options used to instantiate the client, and a callback handler provided by Langchain Go.

func New

func New(opts ...Option) (*Model, error)

Instantiates a new Mistral Model.

func (*Model) Call

func (m *Model) Call(ctx context.Context, prompt string, options ...llms.CallOption) (string, error)

Call implements the langchaingo llms.Model interface.

func (*Model) GenerateContent

func (m *Model) GenerateContent(ctx context.Context, langchainMessages []llms.MessageContent, options ...llms.CallOption) (*llms.ContentResponse, error)

GenerateContent implements the langchaingo llms.Model interface.

type Option

type Option func(*clientOptions)

func WithAPIKey

func WithAPIKey(apiKey string) Option

Passes the API Key (token) to the Mistral client. Defaults to os.getEnv("MISTRAL_API_KEY").

func WithCallbacksHandler

func WithCallbacksHandler(callbacksHandler callbacks.Handler) Option

Sets the Langchain callbacks handler to use for the Model being instantiated. Defaults to callbacks.SimpleHandler.

func WithEndpoint

func WithEndpoint(endpoint string) Option

Sets the API endpoint for the Model being instantiated, defaults to "https://api.mistral.ai" (subject to change; this default is pulled from the mistral-go client library, https://github.com/Gage-Technologies/mistral-go).

func WithMaxRetries

func WithMaxRetries(maxRetries int) Option

Sets the maximum number of retries the client is permitted to perform, used in case a call to the model's API fails.

func WithModel

func WithModel(model string) Option

Sets the model name for the Model being instantiated. Defaults to "open-mistral-7b". See https://docs.mistral.ai/platform/endpoints/ for a full list of supported models.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

Sets the timeout duration for the client. This determines how long the client will wait for a response from the model's API before timing out.

Jump to

Keyboard shortcuts

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