ollama

package
v0.0.0-...-c3aade2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRequest

type ChatRequest struct {
	Model string `json:"model"`

	Stream *bool  `json:"stream,omitempty"`
	Format string `json:"format,omitempty"`

	Messages []Message `json:"messages"`

	Options map[string]interface{} `json:"options"`
}

type ChatResponse

type ChatResponse struct {
	Model   string  `json:"model"`
	Message Message `json:"message"`

	Done bool `json:"done"`
}

type Client

type Client struct {
	*Embedder
	*Completer
}

func New

func New(url string, options ...Option) (*Client, error)

type Completer

type Completer struct {
	*Config
}

func NewCompleter

func NewCompleter(url string, options ...Option) (*Completer, error)

func (*Completer) Complete

func (c *Completer) Complete(ctx context.Context, messages []provider.Message, options *provider.CompleteOptions) (*provider.Completion, error)

type Config

type Config struct {
	// contains filtered or unexported fields
}

type Embedder

type Embedder struct {
	*Config
}

func NewEmbedder

func NewEmbedder(url string, options ...Option) (*Embedder, error)

func (*Embedder) Embed

func (e *Embedder) Embed(ctx context.Context, content string) (provider.Embeddings, error)

type EmbeddingRequest

type EmbeddingRequest struct {
	Model  string `json:"model"`
	Prompt string `json:"prompt"`
}

type EmbeddingResponse

type EmbeddingResponse struct {
	Embedding []float64 `json:"embedding"`
}

type Message

type Message struct {
	Role    MessageRole `json:"role"`
	Content string      `json:"content"`

	Images []MessageImage `json:"images,omitempty"`
}

type MessageImage

type MessageImage []byte

type MessageRole

type MessageRole string
var (
	MessageRoleSystem    MessageRole = "system"
	MessageRoleUser      MessageRole = "user"
	MessageRoleAssistant MessageRole = "assistant"
)

type ModelRequest

type ModelRequest struct {
	Name string `json:"name"`
}

type Option

type Option func(*Config)

func WithClient

func WithClient(client *http.Client) Option

func WithModel

func WithModel(model string) Option

func WithURL

func WithURL(url string) Option

type PullRequest

type PullRequest struct {
	Name   string `json:"name"`
	Stream bool   `json:"stream"`
}

type PullResponse

type PullResponse struct {
	Status string `json:"status"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL