cohereclient

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyResponse = errors.New("empty response")
	ErrModelNotFound = errors.New("model not found")
)

Functions

This section is empty.

Types

type Client

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

func New

func New(token string, baseURL string, model string, opts ...Option) (*Client, error)

func (*Client) CreateGeneration

func (c *Client) CreateGeneration(ctx context.Context, r *GenerationRequest) (*Generation, error)

func (*Client) GetNumTokens

func (c *Client) GetNumTokens(text string) int

type Doer

type Doer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs a HTTP request.

type Generation

type Generation struct {
	Text string `json:"text"`
}

type GenerationRequest

type GenerationRequest struct {
	Prompt string `json:"prompt"`
}

type Option

type Option func(*Client) error

func WithHTTPClient

func WithHTTPClient(client Doer) Option

WithHTTPClient allows setting a custom HTTP client.

Jump to

Keyboard shortcuts

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