Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Ollama ¶ added in v1.1.45
type Ollama struct {
Model string `json:"model"`
URL string `json:"url"`
Auth string `json:"auth"`
Type string `json:"type"`
// contains filtered or unexported fields
}
Ollama represents an Ollama instance.
func NewOllama ¶ added in v1.1.45
func NewOllama(url string, opts ...OllamaOption) *Ollama
NewOllama creates a new instance of Ollama with the given URL and options.
func (*Ollama) HandleChat ¶ added in v1.1.45
func (o *Ollama) HandleChat() http.HandlerFunc
HandleChat returns an HTTP handler function that handles chat requests.
func (*Ollama) HandlePushContext ¶ added in v1.2.8
func (o *Ollama) HandlePushContext() http.HandlerFunc
HandlePushContext is a handler that pushes context to the Ollama instance.
type OllamaOption ¶ added in v1.1.45
type OllamaOption func(o *Ollama)
OllamaOption is a function that configures an Ollama instance.
func WithOllamaAuth ¶ added in v1.2.8
func WithOllamaAuth(auth string) OllamaOption
WithOllamaAuth sets the auth for the Ollama instance.
func WithOllamaContextSize ¶ added in v1.2.8
func WithOllamaContextSize(size uint32) OllamaOption
WithOllamaContextSize sets the context size for the Ollama instance.
func WithOllamaModel ¶ added in v1.1.45
func WithOllamaModel(model string) OllamaOption
WithOllamaModel sets the model for the Ollama instance.
func WithOllamaType ¶ added in v1.2.8
func WithOllamaType(t string) OllamaOption
WithOllamaType sets the type for the Ollama instance.
type OllamaResponse ¶ added in v1.2.8
type OllamaResponse struct {
CreatedAt time.Time `json:"created_at"`
Done bool `json:"done"`
DoneReason string `json:"done_reason"`
EvalCount int `json:"eval_count"`
EvalDuration int64 `json:"eval_duration"`
LoadDuration int `json:"load_duration"`
Message *Message `json:"message"`
Model string `json:"model"`
PromptEvalCount int `json:"prompt_eval_count"`
PromptEvalDuration int `json:"prompt_eval_duration"`
TotalDuration int64 `json:"total_duration"`
}
OllamaResponse is a struct representing an Ollama response.
type OpenAIAPIResponse ¶ added in v1.2.8
type OpenAIAPIResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int `json:"created"`
Model string `json:"model"`
SystemFingerprint string `json:"system_fingerprint"`
Choices []struct {
Index int `json:"index"`
Delta struct {
Content string `json:"content"`
} `json:"delta"`
Logprobs interface{} `json:"logprobs"`
FinishReason interface{} `json:"finish_reason"`
} `json:"choices"`
}
OpenAIAPIResponse is a struct representing an OpenAI API response.