cohere

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cohere provides Cohere API v2 integration for the LLM gateway.

Index

Constants

This section is empty.

Variables

View Source
var Registration = providers.Registration{
	Type:                        "cohere",
	New:                         New,
	PassthroughSemanticEnricher: passthroughSemanticEnricher,
	Discovery: providers.DiscoveryConfig{
		DefaultBaseURL: defaultBaseURL,
	},
}

Registration provides factory registration for the Cohere provider.

Functions

func New

New creates a Cohere provider using the shared resilience and observability settings.

Types

type Provider

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

Provider implements Cohere's native v2 chat and embedding APIs.

func (*Provider) ChatCompletion

func (p *Provider) ChatCompletion(ctx context.Context, req *core.ChatRequest) (*core.ChatResponse, error)

ChatCompletion translates an OpenAI-compatible chat request to Cohere v2.

func (*Provider) CreateSpeech

CreateSpeech reports that Cohere has no text-to-speech API. AudioProvider currently groups speech and transcription into one optional capability, so a transcription-only provider must still implement this method.

func (*Provider) CreateTranscription

func (p *Provider) CreateTranscription(ctx context.Context, req *core.AudioTranscriptionRequest) (*core.AudioResponse, error)

CreateTranscription translates the OpenAI-compatible multipart request to Cohere's native POST /v2/audio/transcriptions endpoint.

func (*Provider) Embeddings

Embeddings translates OpenAI-compatible embedding requests to Cohere v2.

func (*Provider) ListModels

func (p *Provider) ListModels(ctx context.Context) (*core.ModelsResponse, error)

ListModels returns Cohere's model catalog in OpenAI-compatible form.

func (*Provider) Passthrough

Passthrough forwards a Cohere-native request without typed translation.

func (*Provider) Responses

Responses translates the OpenAI Responses API through Cohere chat.

func (*Provider) SetBaseURL

func (p *Provider) SetBaseURL(baseURL string)

SetBaseURL changes the Cohere API base URL.

func (*Provider) StreamChatCompletion

func (p *Provider) StreamChatCompletion(ctx context.Context, req *core.ChatRequest) (io.ReadCloser, error)

StreamChatCompletion translates Cohere's event stream to OpenAI chat chunks.

func (*Provider) StreamResponses

func (p *Provider) StreamResponses(ctx context.Context, req *core.ResponsesRequest) (io.ReadCloser, error)

StreamResponses translates a streaming OpenAI Responses request through Cohere chat.

Jump to

Keyboard shortcuts

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