cohere

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: GPL-3.0 Imports: 9 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 implements the Provider interface against Cohere's OpenAI-compatibility endpoint (https://api.cohere.ai/compatibility/v1), reusing the openai-go SDK — no new dependency. Structured output is prompt-driven (no response_format); JSON shape comes from the system prompt's contract plus the retry-once-then-degrade pipeline (ADR-0014 §4), the same way Ollama works.

Index

Constants

View Source
const (
	Name = "cohere"

	ModelCommandRPlus = "command-r-plus"
	ModelCommandR     = "command-r"
	ModelCommandA     = "command-a-03-2025"

	DefaultModel = ModelCommandRPlus
)

Variables

This section is empty.

Functions

func IsModelSupported

func IsModelSupported(model string) bool

func Models

func Models() []string

Types

type Client

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

func (*Client) ContextWindow

func (c *Client) ContextWindow(model string) int

func (*Client) DefaultModel

func (c *Client) DefaultModel() string

func (*Client) EstimateTokens

func (c *Client) EstimateTokens(s string) int

func (*Client) Name

func (c *Client) Name() string

func (*Client) Pricing

func (c *Client) Pricing(model string) provider.Pricing

func (*Client) Review

func (c *Client) Review(ctx context.Context, req provider.Request) (provider.Response, error)

func (*Client) TestConnection

func (c *Client) TestConnection(ctx context.Context) error

Jump to

Keyboard shortcuts

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