ollama

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: CC0-1.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hallucinate added in v1.10.0

func Hallucinate[T valid.Interface](ctx context.Context, c *Client, opts HallucinateOpts) (*T, error)

Hallucinate prompts the model to hallucinate a "valid" JSON response to the given input.

Types

type Client

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

func NewClient

func NewClient(baseURL string) *Client

func NewLocalClient

func NewLocalClient() *Client

func (*Client) Chat

func (*Client) Embeddings added in v1.10.0

func (c *Client) Embeddings(ctx context.Context, er *EmbedRequest) (*EmbedResponse, error)

type CompleteRequest

type CompleteRequest struct {
	Model    string         `json:"model"`
	Messages []Message      `json:"messages"`
	Format   *string        `json:"format,omitempty"`
	Template *string        `json:"template,omitempty"`
	Stream   bool           `json:"stream"`
	Options  map[string]any `json:"options"`
}

type CompleteResponse

type CompleteResponse struct {
	Model              string    `json:"model"`
	CreatedAt          time.Time `json:"created_at"`
	Message            Message   `json:"message"`
	Done               bool      `json:"done"`
	TotalDuration      float64   `json:"total_duration"`
	LoadDuration       float64   `json:"load_duration"`
	PromptEvalCount    int64     `json:"prompt_eval_count"`
	PromptEvalDuration int64     `json:"prompt_eval_duration"`
	EvalCount          int64     `json:"eval_count"`
	EvalDuration       int64     `json:"eval_duration"`
}

type EmbedRequest added in v1.10.0

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

	Options map[string]any `json:"options"`
}

type EmbedResponse added in v1.10.0

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

type HallucinateOpts added in v1.10.0

type HallucinateOpts struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
}

HallucinateOpts contains the options for the Hallucinate function.

type Message

type Message struct {
	Content string   `json:"content"`
	Role    string   `json:"role"`
	Images  [][]byte `json:"images"`
}

Jump to

Keyboard shortcuts

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