Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultModel = "smollm"
DefaultModel is the default model for the Ollama API.
View Source
const DefaultTimeout = 30 * time.Second
DefaultTimeout is the default timeout for the Ollama API.
View Source
const DefaultURL = "http://localhost:7869/api/chat"
DefaultURL is the default endpoint for the Ollama API.
Variables ¶
View Source
var Transformer = func(e Event) (*prompts.ChatCompletionResponse, error) { return &prompts.ChatCompletionResponse{ Model: e.Model, Choices: []prompts.ChatCompletionChoice{ { Message: prompts.Index{ Role: prompts.Role(e.Message.Role), Content: e.Message.Content, }, }, }, }, nil }
Transformer is a function that transforms an Event into a ChatCompletionResponse.
Functions ¶
Types ¶
type Event ¶
type Event struct {
Model string `json:"model"`
CreatedAt string `json:"created_at"`
Message struct {
Role string `json:"role"`
Content string `json:"content"`
Images []struct {
URL string `json:"url"`
Size int `json:"size"`
} `json:"images"`
} `json:"message"`
Done bool `json:"done"`
}
Event is the structure of the event stream response from the Ollama API.
type Ollama ¶
type Ollama struct {
// contains filtered or unexported fields
}
Ollama is a chat model.
func (*Ollama) SendCompletionRequest ¶
func (o *Ollama) SendCompletionRequest(ctx context.Context, req *prompts.ChatCompletionRequest) (*prompts.ChatCompletionResponse, error)
SendCompletionRequest sends a completion request to the Perplexity API.
func (*Ollama) SendStreamCompletionRequest ¶
func (o *Ollama) SendStreamCompletionRequest(ctx context.Context, req *prompts.ChatCompletionRequest, cb ...func(res *prompts.ChatCompletionResponse) error) error
SendStreamCompletionRequest sends a streamed completion request to the Ollama. nolint:gocyclo
Click to show internal directories.
Click to hide internal directories.