generate

package
v0.0.0-...-0d1764f Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BestOfSequence

type BestOfSequence struct {
	FinishReason       string           `json:"finish_reason"`
	GeneratedInference string           `json:"generated_text"`
	GeneratedTokens    int              `json:"generated_tokens"`
	Prefill            []PrefillElement `json:"prefill"`
	Seed               int              `json:"seed"`
	Tokens             []Token          `json:"tokens"`
}

type Client

type Client struct {
	*delphiclient.Client
}

func NewClient

func NewClient(name, address string) *Client

func (*Client) Generate

func (c *Client) Generate(ctx context.Context, inferenceRequest GenerateInferenceRequest) (GeneratedInferenceResponse, error)

func (*Client) HealthCheck

func (c *Client) HealthCheck(ctx context.Context) (*ErrorResponse, error)

type ErrorResponse

type ErrorResponse struct {
	Error     string `json:"error"`
	ErrorType string `json:"error_type"`
}

type GenerateInferenceRequest

type GenerateInferenceRequest struct {
	Inputs     string                        `json:"inputs"`
	Parameters InferenceGenerationParameters `json:"parameters"`
}

type GeneratedInferenceResponse

type GeneratedInferenceResponse struct {
	Details            GeneratedInferenceResponseDetails `json:"details"`
	GeneratedInference string                            `json:"generated_text"`
}

func (*GeneratedInferenceResponse) ConcatenateTokens

func (resp *GeneratedInferenceResponse) ConcatenateTokens() string

type GeneratedInferenceResponseDetails

type GeneratedInferenceResponseDetails struct {
	BestOfSequences []BestOfSequence `json:"best_of_sequences"`
	FinishReason    string           `json:"finish_reason"`
	GeneratedTokens int              `json:"generated_tokens"`
	Prefill         []PrefillElement `json:"prefill"`
	Seed            int              `json:"seed"`
	Tokens          []Token          `json:"tokens"`
}

type InferenceGenerationParameters

type InferenceGenerationParameters struct {
	BestOf               int      `json:"best_of"`
	DecoderInputeDetails bool     `json:"decoder_input_details"`
	Details              bool     `json:"details"`
	DoSample             bool     `json:"do_sample"`
	MaxNewTokens         int      `json:"max_new_tokens"`
	RepetitionPenalty    float32  `json:"repetition_penalty"`
	ReturnFullText       bool     `json:"return_full_text"`
	Seed                 *string  `json:"seed"` // verify type of this example value was null
	Stop                 []string `json:"stop"`
	Temperature          float32  `json:"temperature"`
	TopK                 float32  `json:"top_k"` // verify type, example vaulue was int but peers were floats
	TopP                 float32  `json:"top_p"`
	Truncate             *string  `json:"truncate"` // verify type of this example value was null
	TypicalP             float32  `json:"typical_p"`
	Watermark            bool     `json:"watermark"`
}

type PrefillElement

type PrefillElement struct {
	ID      int     `json:"id"`
	LogProb float32 `json:"logprob"`
	Text    string  `json:"text"`
}

type Token

type Token struct {
	ID      int     `json:"id"`
	LogProb float32 `json:"logprob"`
	Special bool    `json:"special"`
	Text    string  `json:"text"`
}

Jump to

Keyboard shortcuts

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