suggestionbox

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Choice

type Choice struct {
	ID       string    `json:"id"`
	Features []Feature `json:"features"`
}

type CreateModelRequest

type CreateModelRequest struct {
	Model Model `json:"model"`
}

type CreateModelResponse

type CreateModelResponse struct {

	// Error is an error message if one occurred.
	Error string `json:"error"`
}

type DeleteModelRequest

type DeleteModelRequest struct {
	ModelID string `json:"model_id"`
}

type DeleteModelResponse

type DeleteModelResponse struct {

	// Error is an error message if one occurred.
	Error string `json:"error"`
}

type Feature

type Feature struct {
	Key   string           `json:"key"`
	Type  string           `json:"type"`
	Value string           `json:"value"`
	File  remototypes.File `json:"file"`
}

func (*Feature) OpenFile

func (s *Feature) OpenFile(ctx context.Context) (io.Reader, error)

OpenFile opens the file from the response.

func (*Feature) SetFile

func (s *Feature) SetFile(ctx context.Context, filename string, r io.Reader) context.Context

SetFile sets the file for the File field.

type GetStateRequest

type GetStateRequest struct {
}

type ListModelsRequest

type ListModelsRequest struct {
}

type ListModelsResponse

type ListModelsResponse struct {
	Models []Model `json:"models"`
	// Error is an error message if one occurred.
	Error string `json:"error"`
}

type Model

type Model struct {
	ID      string       `json:"id"`
	Name    string       `json:"name"`
	Options ModelOptions `json:"options"`
	Choices []Choice     `json:"choices"`
}

type ModelOptions

type ModelOptions struct {
	RewardExpirationSeconds int     `json:"reward_expiration_seconds"`
	Ngrams                  int     `json:"ngrams"`
	Skipgrams               int     `json:"skipgrams"`
	Mode                    string  `json:"mode"`
	Epsilon                 float64 `json:"epsilon"`
	Cover                   float64 `json:"cover"`
}

type PredictRequest

type PredictRequest struct {
	ModelID string    `json:"model_id"`
	Limit   int       `json:"limit"`
	Inputs  []Feature `json:"inputs"`
}

type PredictResponse

type PredictResponse struct {
	Choices []PredictedChoice `json:"choices"`
	// Error is an error message if one occurred.
	Error string `json:"error"`
}

type PredictedChoice

type PredictedChoice struct {
	ID       string    `json:"id"`
	Features []Feature `json:"features"`
	RewardID string    `json:"reward_id"`
}

type PutStateRequest

type PutStateRequest struct {
	StateFile remototypes.File `json:"state_file"`
}

func (*PutStateRequest) SetStateFile

func (s *PutStateRequest) SetStateFile(ctx context.Context, filename string, r io.Reader) context.Context

SetStateFile sets the file for the StateFile field.

type PutStateResponse

type PutStateResponse struct {

	// Error is an error message if one occurred.
	Error string `json:"error"`
}

type RewardRequest

type RewardRequest struct {
	ModelID  string `json:"model_id"`
	RewardID string `json:"reward_id"`
	Value    int    `json:"value"`
}

type RewardResponse

type RewardResponse struct {

	// Error is an error message if one occurred.
	Error string `json:"error"`
}

type SuggestionboxClient

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

SuggestionboxClient accesses remote Suggestionbox services.

func NewSuggestionboxClient

func NewSuggestionboxClient(endpoint string, client *http.Client) *SuggestionboxClient

NewSuggestionboxClient makes a new SuggestionboxClient that will use the specified http.Client to make requests.

func (*SuggestionboxClient) CreateModel

func (*SuggestionboxClient) CreateModelMulti

func (c *SuggestionboxClient) CreateModelMulti(ctx context.Context, requests []*CreateModelRequest) ([]*CreateModelResponse, error)

func (*SuggestionboxClient) DeleteModel

func (*SuggestionboxClient) DeleteModelMulti

func (c *SuggestionboxClient) DeleteModelMulti(ctx context.Context, requests []*DeleteModelRequest) ([]*DeleteModelResponse, error)

func (*SuggestionboxClient) GetState

func (c *SuggestionboxClient) GetState(ctx context.Context, request *GetStateRequest) (io.ReadCloser, error)

func (*SuggestionboxClient) ListModels

func (*SuggestionboxClient) ListModelsMulti

func (c *SuggestionboxClient) ListModelsMulti(ctx context.Context, requests []*ListModelsRequest) ([]*ListModelsResponse, error)

func (*SuggestionboxClient) Predict

func (*SuggestionboxClient) PredictMulti

func (c *SuggestionboxClient) PredictMulti(ctx context.Context, requests []*PredictRequest) ([]*PredictResponse, error)

func (*SuggestionboxClient) PutState

func (*SuggestionboxClient) PutStateMulti

func (c *SuggestionboxClient) PutStateMulti(ctx context.Context, requests []*PutStateRequest) ([]*PutStateResponse, error)

func (*SuggestionboxClient) Reward

func (*SuggestionboxClient) RewardMulti

func (c *SuggestionboxClient) RewardMulti(ctx context.Context, requests []*RewardRequest) ([]*RewardResponse, error)

Jump to

Keyboard shortcuts

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