Versions in this module Expand all Collapse all v0 v0.1.2 Mar 23, 2024 Changes in this version + const ASSISTANT + const DEFAULT_MODEL + const USER + var ErrBadRequest = errors.New("") + var ErrCallback = errors.New("callback cannot be empty") + var ErrDecoding = errors.New("unable to decode") + var ErrEncoding = errors.New("unable to encode") + var ErrInvoke = errors.New("unable to invoke ollama api") + var ErrMessage = errors.New("message cannot be empty") + var ErrUrl = errors.New("url cannot be empty") + func StreamPlainResponse(body io.ReadCloser, cb func(string, error)) + func StreamResponse[T any](body io.ReadCloser, cb func(*T, error)) + type ChatCallBack func(*ChatResponse, error) + type ChatMessage struct + Content string + Role Role + type ChatMetrics struct + EvalCount int + EvalDuration int + LoadDuration int + PromptEvalCount int + PromptEvalDuration int + TotalDuration int + type ChatParams struct + Format string + KeepAlive string + Options map[string]interface{} + Stream *bool + Template string + type ChatRequest struct + Messages []ChatMessage + Model string + type ChatResponse struct + CreatedAt time.Time + Done bool + Message ChatMessage + Model string + type Client struct + func New(url string) (*Client, error) + func (c *Client) Chat(model string, cb ChatCallBack, params *ChatParams, msgs ...ChatMessage) (<-chan bool, error) + func (c *Client) Completion(model string, cb CompletionCallback, msg *CompletionMessage) (<-chan bool, error) + func (c *Client) PlainChat(model string, cb PlainChatCallBack, params *ChatParams, msgs ...ChatMessage) (<-chan bool, error) + func (c *Client) PlainCompletion(model string, cb PlainCompletionCallback, msg *CompletionMessage) (<-chan bool, error) + type CompletionCallback func(*CompletionResponse, error) + type CompletionMessage struct + Images []string + Prompt string + type CompletionMetrics struct + Context []int + EvalCount int + EvalDuration int + LoadDuration int + PromptEvalCount int + PromptEvalDuration int + TotalDuration int + type CompletionParams struct + Context interface{} + Format string + KeepAlive string + Options map[string]interface{} + Raw bool + Stream *bool + System string + Template string + type CompletionRequest struct + Images []string + Model string + Prompt string + type CompletionResponse struct + CreatedAt string + Done bool + Model string + Response string + type PlainChatCallBack func(string, error) + type PlainCompletionCallback func(string, error) + type Role string v0.1.1 Mar 23, 2024