cohere

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package cohere provides a cohere embedding provider for memoryrails.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Embedder

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

Embedder generates embeddings using Cohere's API.

func New

func New(apiKey string, opts ...Option) *Embedder

New creates a new Cohere embedder.

func (*Embedder) Dimensions

func (e *Embedder) Dimensions() int

func (*Embedder) Embed

func (e *Embedder) Embed(ctx context.Context, text string) ([]float64, error)

func (*Embedder) EmbedBatch

func (e *Embedder) EmbedBatch(ctx context.Context, texts []string) ([][]float64, error)

type Option

type Option func(*Embedder)

Option configures the embedder.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL sets a custom API URL.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets a custom HTTP client.

func WithModel

func WithModel(model string) Option

WithModel sets the model. Default: embed-v4.0.

Jump to

Keyboard shortcuts

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