cohere

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	APIKey     string
	Model      string
	BaseURL    string
	Timeout    time.Duration
	MaxRetries int
	BatchSize  int
}

type EmbeddingData

type EmbeddingData struct {
	Embedding []float32 `json:"embedding"`
	Index     int       `json:"index"`
}

type EmbeddingRequest

type EmbeddingRequest struct {
	Model     string   `json:"model"`
	Texts     []string `json:"texts"`
	InputType string   `json:"input_type,omitempty"`
	Truncate  string   `json:"truncate,omitempty"`
}

type EmbeddingResponse

type EmbeddingResponse struct {
	ID         string          `json:"id"`
	Embeddings []EmbeddingData `json:"embeddings"`
	Model      string          `json:"model"`
	Texts      []string        `json:"texts"`
}

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

type Provider

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

func New

func New(config Config) (*Provider, error)

func (*Provider) Dimension

func (p *Provider) Dimension() int

func (*Provider) Embed

func (p *Provider) Embed(ctx context.Context, texts []string) ([][]float32, error)

Jump to

Keyboard shortcuts

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