ollama

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(config Config) *Client

func (*Client) SendPrompt

func (c *Client) SendPrompt(ctx context.Context, prompt string) (string, error)

func (*Client) SendRequest

func (c *Client) SendRequest(ctx context.Context, prompt string, stream bool, callback func(string)) (string, error)

func (*Client) StreamPrompt

func (c *Client) StreamPrompt(ctx context.Context, prompt string, callback func(string)) error

type Config

type Config struct {
	Host     string
	Port     int
	Model    string
	Timeout  time.Duration
	MaxRetry int
	Client   *http.Client
}

type Request

type Request struct {
	Model   string `json:"model"`
	Prompt  string `json:"prompt"`
	Stream  bool   `json:"stream,omitempty"`
	NumPred int    `json:"num_predict,omitempty"`
}

type Response

type Response struct {
	Response string `json:"response"`
	Done     bool   `json:"done,omitempty"`
	Error    string `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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