Documentation
¶
Index ¶
- Constants
- type Client
- type CreateEmbeddingRequest
- type CreateEmbeddingResponse
- type Embedding
- type MistralEmbeddingFunction
- func (e *MistralEmbeddingFunction) EmbedDocuments(ctx context.Context, documents []string) ([]*types.Embedding, error)
- func (e *MistralEmbeddingFunction) EmbedQuery(ctx context.Context, document string) (*types.Embedding, error)
- func (e *MistralEmbeddingFunction) EmbedRecords(ctx context.Context, records []*types.Record, force bool) error
- type Option
Constants ¶
View Source
const ( DefaultEmbeddingModel = "mistral-embed" ModelContextVar = "model" APIKeyEnvVar = "MISTRAL_API_KEY" DefaultBaseURL = "https://api.mistral.ai" EmbeddingsEndpoint = "/v1/embeddings" DefaultMaxBatchSize = 100 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { DefaultModel string Client *http.Client DefaultContext *context.Context MaxBatchSize int EmbeddingEndpoint string DefaultHeaders map[string]string // contains filtered or unexported fields }
func NewMistralClient ¶
func (*Client) CreateEmbedding ¶
type CreateEmbeddingRequest ¶
type CreateEmbeddingRequest struct { Model string `json:"model"` Input []string `json:"input"` EncodingFormat string `json:"encoding_format,omitempty"` }
func (*CreateEmbeddingRequest) JSON ¶
func (c *CreateEmbeddingRequest) JSON() (string, error)
type CreateEmbeddingResponse ¶
type MistralEmbeddingFunction ¶
type MistralEmbeddingFunction struct {
// contains filtered or unexported fields
}
func NewMistralEmbeddingFunction ¶
func NewMistralEmbeddingFunction(opts ...Option) (*MistralEmbeddingFunction, error)
func (*MistralEmbeddingFunction) EmbedDocuments ¶
func (*MistralEmbeddingFunction) EmbedQuery ¶
func (*MistralEmbeddingFunction) EmbedRecords ¶
type Option ¶
func WithBaseURL ¶
WithBaseURL sets the base URL for the client
func WithDefaultModel ¶
WithDefaultModel sets the default model for the client
func WithEnvAPIKey ¶
func WithEnvAPIKey() Option
WithEnvAPIKey sets the API key for the client from the environment variable GOOGLE_API_KEY
func WithHTTPClient ¶
WithHTTPClient sets the generative AI client for the client
func WithMaxBatchSize ¶
WithMaxBatchSize sets the max batch size for the client - this acts as a limit for the number of embeddings that can be sent in a single request
Click to show internal directories.
Click to hide internal directories.