Documentation ¶
Index ¶
- type ChatRequest
- type ChatResponse
- type ChatResponseFunc
- type Client
- func (c *Client) CreateEmbedding(ctx context.Context, req *EmbeddingRequest) (*EmbeddingResponse, error)
- func (c *Client) Generate(ctx context.Context, req *GenerateRequest, fn GenerateResponseFunc) error
- func (c *Client) GenerateChat(ctx context.Context, req *ChatRequest, fn ChatResponseFunc) error
- type EmbeddingRequest
- type EmbeddingResponse
- type GenerateRequest
- type GenerateResponse
- type GenerateResponseFunc
- type ImageData
- type Message
- type Metrics
- type Options
- type Runner
- type StatusError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatRequest ¶ added in v0.1.13
type ChatResponse ¶ added in v0.1.13
type ChatResponseFunc ¶ added in v0.1.13
type ChatResponseFunc func(ChatResponse) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateEmbedding ¶
func (c *Client) CreateEmbedding(ctx context.Context, req *EmbeddingRequest) (*EmbeddingResponse, error)
func (*Client) Generate ¶
func (c *Client) Generate(ctx context.Context, req *GenerateRequest, fn GenerateResponseFunc) error
func (*Client) GenerateChat ¶ added in v0.1.13
func (c *Client) GenerateChat(ctx context.Context, req *ChatRequest, fn ChatResponseFunc) error
type EmbeddingRequest ¶
type EmbeddingResponse ¶
type EmbeddingResponse struct {
Embedding []float32 `json:"embedding"`
}
type GenerateRequest ¶
type GenerateRequest struct { Model string `json:"model"` Prompt string `json:"prompt"` System string `json:"system"` Template string `json:"template"` Context []int `json:"context,omitempty"` Stream *bool `json:"stream"` KeepAlive string `json:"keep_alive,omitempty"` Options Options `json:"options"` }
type GenerateResponse ¶
type GenerateResponse struct { CreatedAt time.Time `json:"created_at"` Model string `json:"model"` Response string `json:"response"` Context []int `json:"context,omitempty"` TotalDuration time.Duration `json:"total_duration,omitempty"` LoadDuration time.Duration `json:"load_duration,omitempty"` PromptEvalCount int `json:"prompt_eval_count,omitempty"` PromptEvalDuration time.Duration `json:"prompt_eval_duration,omitempty"` EvalCount int `json:"eval_count,omitempty"` EvalDuration time.Duration `json:"eval_duration,omitempty"` Done bool `json:"done"` }
func (*GenerateResponse) Summary ¶
func (r *GenerateResponse) Summary()
type GenerateResponseFunc ¶
type GenerateResponseFunc func(GenerateResponse) error
type Metrics ¶ added in v0.1.13
type Metrics struct { TotalDuration time.Duration `json:"total_duration,omitempty"` LoadDuration time.Duration `json:"load_duration,omitempty"` PromptEvalCount int `json:"prompt_eval_count,omitempty"` PromptEvalDuration time.Duration `json:"prompt_eval_duration,omitempty"` EvalCount int `json:"eval_count,omitempty"` EvalDuration time.Duration `json:"eval_duration,omitempty"` }
type Options ¶
type Options struct { Stop []string `json:"stop,omitempty"` Runner RepeatLastN int `json:"repeat_last_n,omitempty"` Seed int `json:"seed,omitempty"` TopK int `json:"top_k,omitempty"` NumKeep int `json:"num_keep,omitempty"` Mirostat int `json:"mirostat,omitempty"` NumPredict int `json:"num_predict,omitempty"` Temperature float32 `json:"temperature"` TypicalP float32 `json:"typical_p,omitempty"` RepeatPenalty float32 `json:"repeat_penalty,omitempty"` PresencePenalty float32 `json:"presence_penalty,omitempty"` FrequencyPenalty float32 `json:"frequency_penalty,omitempty"` TFSZ float32 `json:"tfs_z,omitempty"` MirostatTau float32 `json:"mirostat_tau,omitempty"` MirostatEta float32 `json:"mirostat_eta,omitempty"` TopP float32 `json:"top_p,omitempty"` PenalizeNewline bool `json:"penalize_newline,omitempty"` }
type Runner ¶
type Runner struct { NumCtx int `json:"num_ctx,omitempty"` NumBatch int `json:"num_batch,omitempty"` NumGQA int `json:"num_gqa,omitempty"` NumGPU int `json:"num_gpu,omitempty"` MainGPU int `json:"main_gpu,omitempty"` NumThread int `json:"num_thread,omitempty"` RopeFrequencyBase float32 `json:"rope_frequency_base,omitempty"` RopeFrequencyScale float32 `json:"rope_frequency_scale,omitempty"` LogitsAll bool `json:"logits_all,omitempty"` VocabOnly bool `json:"vocab_only,omitempty"` UseMMap bool `json:"use_mmap,omitempty"` UseMLock bool `json:"use_mlock,omitempty"` EmbeddingOnly bool `json:"embedding_only,omitempty"` UseNUMA bool `json:"numa,omitempty"` F16KV bool `json:"f16_kv,omitempty"` LowVRAM bool `json:"low_vram,omitempty"` }
type StatusError ¶
type StatusError struct { Status string `json:"status,omitempty"` ErrorMessage string `json:"error"` StatusCode int `json:"code,omitempty"` }
func (StatusError) Error ¶
func (e StatusError) Error() string
Click to show internal directories.
Click to hide internal directories.