Versions in this module Expand all Collapse all v0 v0.1.16 Jan 9, 2025 v0.1.15 Jan 9, 2025 v0.1.13 Jan 9, 2025 v0.1.12 Jan 9, 2025 Changes in this version + func ExtractJSONFromBytes(input []byte) ([]byte, error) + type ChatRequest struct + Messages []*Message + Prompt *string + Stream *bool + type ChatResponse struct + Content string + GenerationSettings GenerationSettings + Model string + Prompt string + SlotID int + Stop bool + StoppedEOS bool + StoppedLimit bool + StoppedWord bool + StoppingWord string + Timings Timings + TokensCached int + TokensEvaluated int + TokensPredicted int + Truncated bool + type ChatResponseFunc func(ChatResponse) error + type Client struct + func NewClient(ourl *url.URL, ohttp *http.Client) (*Client, error) + func (c *Client) CreateEmbedding(ctx context.Context, texts []string) (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 EmbeddingData struct + Embedding []float32 + type EmbeddingRequest struct + Content []string + type EmbeddingResponse struct + Results []EmbeddingData + type GenerateRequest struct + Context []int + Prompt string + Stream *bool + System string + Template string + type GenerateResponse struct + Context []int + CreatedAt time.Time + Done bool + EvalCount int + EvalDuration time.Duration + LoadDuration time.Duration + PromptEvalCount int + PromptEvalDuration time.Duration + Response string + TotalDuration time.Duration + type GenerateResponseFunc func(GenerateResponse) error + type GenerationSettings struct + EmbeddingSize int + FrequencyPenalty float64 + Grammar string + HTTPClient *http.Client + IgnoreEOS bool + LlamafileServerURL *url.URL + LogitBias []interface{} + MinP float64 + Mirostat int + MirostatEta float64 + MirostatTau float64 + Model string + NCtx int + NKeep int + NPredict int + NProbs int + PenalizeNL bool + PenaltyPromptTokens []interface{} + PresencePenalty float64 + RepeatLastN int + RepeatPenalty float64 + Seed uint32 + Stop []string + Stream bool + Temperature float64 + TfsZ float64 + TopK int + TopP float64 + TypicalP float64 + UsePenaltyPromptTokens bool + type ImageData []byte + type Message struct + Content string + Images []ImageData + Role string + type StatusError struct + ErrorMessage string + Status string + StatusCode int + func (e StatusError) Error() string + type Timings struct + PredictedMS float64 + PredictedN int + PredictedPerSecond float64 + PredictedPerTokenMS float64 + PromptMS float64 + PromptN int + PromptPerSecond float64 + PromptPerTokenMS float64