response

package
v1.2.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 5 Imported by: 12

Documentation

Index

Constants

View Source
const (
	ContentTypeJSON       = "application/json"
	ContentTypeStreamJSON = "application/stream+json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat added in v1.1.0

type Chat struct {
	Response
	model.NonStreamedChat
	model.StreamedChat
	// contains filtered or unexported fields
}

func (*Chat) AcceptContentType added in v1.1.0

func (c *Chat) AcceptContentType() string

func (*Chat) Decode added in v1.1.0

func (c *Chat) Decode(body io.Reader) error

func (*Chat) SetAcceptContentType added in v1.1.0

func (c *Chat) SetAcceptContentType(acceptContentType string)

func (*Chat) SetStreamCallback added in v1.1.1

func (c *Chat) SetStreamCallback(callback restclientgo.StreamCallback)

func (*Chat) StreamCallback added in v1.1.1

func (c *Chat) StreamCallback() restclientgo.StreamCallback

type Classify

type Classify struct {
	Response
	ID              string                 `json:"id"`
	Classifications []model.Classification `json:"classifications"`
}

func (*Classify) AcceptContentType

func (c *Classify) AcceptContentType() string

func (*Classify) Decode

func (c *Classify) Decode(body io.Reader) error

type Detail

type Detail struct {
	TypeURL *string `json:"typeUrl,omitempty"`
	Value   *string `json:"value,omitempty"`
}

type Detokenize

type Detokenize struct {
	Response
	Text string `json:"text"`
}

func (*Detokenize) AcceptContentType

func (d *Detokenize) AcceptContentType() string

func (*Detokenize) Decode

func (d *Detokenize) Decode(body io.Reader) error

type Embed

type Embed struct {
	Response
	ID         string      `json:"id"`
	Embeddings [][]float64 `json:"embeddings"`
	Texts      []string    `json:"texts"`
}

func (*Embed) AcceptContentType

func (e *Embed) AcceptContentType() string

func (*Embed) Decode

func (e *Embed) Decode(body io.Reader) error

type Generate

type Generate struct {
	Response
	ID          string             `json:"id"`
	Prompt      *string            `json:"prompt"`
	Generations []model.Generation `json:"generations"`
}

func (*Generate) AcceptContentType

func (g *Generate) AcceptContentType() string

func (*Generate) Decode

func (g *Generate) Decode(body io.Reader) error

type Headers

type Headers struct {
	EndpointMonthlyCallLimit   int `json:"-"`
	RatelimitLimit             int `json:"-"`
	TrialEndpointCallRemaining int `json:"-"`
	RatelimitRemaining         int `json:"-"`
	RatelimitReset             int `json:"-"`
	TrialEndpointCallLimit     int `json:"-"`
}

type ListModels added in v1.2.0

type ListModels struct {
	Response
	Models   []Model `json:"models"`
	NextPage string  `json:"next_page"`
}

func (*ListModels) AcceptContentType added in v1.2.0

func (c *ListModels) AcceptContentType() string

func (*ListModels) Decode added in v1.2.0

func (c *ListModels) Decode(body io.Reader) error

type Model added in v1.2.0

type Model struct {
	Response
	Name             string   `json:"name"`
	Endpoints        []string `json:"endpoints"`
	Finetuned        bool     `json:"finetuned"`
	ContextLength    int      `json:"context_length"`
	TokenizerURL     string   `json:"tokenizer_url"`
	DefaultEndpoints []string `json:"default_endpoints"`
}

func (*Model) AcceptContentType added in v1.2.0

func (c *Model) AcceptContentType() string

func (*Model) Decode added in v1.2.0

func (c *Model) Decode(body io.Reader) error

type Rerank

type Rerank struct {
	Response
	Results []model.RerankResult `json:"results"`
}

func (*Rerank) AcceptContentType

func (r *Rerank) AcceptContentType() string

func (*Rerank) Decode

func (r *Rerank) Decode(body io.Reader) error

type Response

type Response struct {
	Meta    model.Meta `json:"meta,omitempty"`
	Headers Headers    `json:"-"`
	Code    int        `json:"-"`
	RawBody *string    `json:"-"`
}

func (*Response) IsSuccess

func (r *Response) IsSuccess() bool

func (*Response) SetBody

func (r *Response) SetBody(body io.Reader) error

func (*Response) SetHeaders

func (r *Response) SetHeaders(headers restclientgo.Headers) error

func (*Response) SetStatusCode

func (r *Response) SetStatusCode(code int) error

type Summarize

type Summarize struct {
	Response
	ID      string `json:"id"`
	Summary string `json:"summary"`
}

func (*Summarize) AcceptContentType

func (s *Summarize) AcceptContentType() string

func (*Summarize) Decode

func (s *Summarize) Decode(body io.Reader) error

type Tokenize

type Tokenize struct {
	Response
	Tokens       []int64  `json:"tokens"`
	TokenStrings []string `json:"token_strings"`
}

func (*Tokenize) AcceptContentType

func (t *Tokenize) AcceptContentType() string

func (*Tokenize) Decode

func (t *Tokenize) Decode(body io.Reader) error

Jump to

Keyboard shortcuts

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