Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidToken = errors.New("invalid token") ErrEmptyResponse = errors.New("empty response") )
View Source
var ErrUnexpectedStatusCode = errors.New("unexpected status code")
Functions ¶
This section is empty.
Types ¶
type Client ¶
func (*Client) CreateEmbedding ¶
func (c *Client) CreateEmbedding( ctx context.Context, model string, task string, r *EmbeddingRequest, ) ([][]float32, error)
CreateEmbedding creates embeddings.
func (*Client) RunInference ¶
func (c *Client) RunInference(ctx context.Context, request *InferenceRequest) (*InferenceResponse, error)
type EmbeddingRequest ¶
type EmbeddingRequest struct { Options map[string]any `json:"options"` Inputs []string `json:"inputs"` }
EmbeddingRequest is a request to create an embedding.
type InferenceRequest ¶
type InferenceRequest struct { Model string `json:"repositoryId"` Prompt string `json:"prompt"` Task InferenceTask `json:"task"` Temperature float64 `json:"temperature,omitempty"` TopP float64 `json:"top_p,omitempty"` TopK int `json:"top_k,omitempty"` MinLength int `json:"min_length,omitempty"` MaxLength int `json:"max_length,omitempty"` RepetitionPenalty float64 `json:"repetition_penalty,omitempty"` Seed int `json:"seed,omitempty"` }
type InferenceResponse ¶
type InferenceResponse struct {
Text string `json:"generated_text"`
}
type InferenceTask ¶
type InferenceTask string
InferenceTask is the type of inference task to run.
const ( InferenceTaskTextGeneration InferenceTask = "text-generation" InferenceTaskText2TextGeneration InferenceTask = "text2text-generation" )
Click to show internal directories.
Click to hide internal directories.