ollama

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

README

Run Ollama docker

$ mkdir ./tmp/ollama

$ docker run -d -v ./tmp/ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

Pull model


curl http://localhost:11434/api/pull -d '{
  "name": "phi3"
}'

curl http://localhost:11434/api/generate  -d '{
  "model": "phi3",
  "prompt": "Why is the sky blue?",
  "format": "json",
  "stream": false
}'

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OllamaFlow

func OllamaFlow(ctx *engine.Context) engine.Flow

Types

type GenerateOptions

type GenerateOptions struct {
	NumKeep          int      `json:"num_keep"`          //: 5,
	Seed             int      `json:"seed"`              //: 42,
	NumPredit        int      `json:"num_predict"`       //: 100,
	TopK             int      `json:"top_k"`             //: 20,
	TopP             float32  `json:"top_p"`             //: 0.9,
	TfsZ             float32  `json:"tfs_z"`             //: 0.5,
	TypicalP         float32  `json:"typical_p"`         //: 0.7,
	RepeatLastN      int      `json:"repeat_last_n"`     //: 33,
	Temperature      float32  `json:"temperature"`       //: 0.8,
	RepeatPenalty    float32  `json:"repeat_penalty"`    //: 1.2,
	PresencePenalty  float32  `json:"presence_penalty"`  //: 1.5,
	FrequencyPenalty float32  `json:"frequency_penalty"` //: 1.0,
	Mirostat         float32  `json:"mirostat"`          //: 1,
	MirostatTau      float32  `json:"mirostat_tau"`      //: 0.8,
	MirostatEta      float32  `json:"mirostat_eta"`      //: 0.6,
	PenalizeNewline  bool     `json:"penalize_newline"`  //: true,
	Stop             []string `json:"stop"`              //: ["\n", "user:"],
	Numa             bool     `json:"numa"`              //: false,
	NumCtx           int      `json:"num_ctx"`           //: 1024,
	NumBatch         int      `json:"num_batch"`         //: 2,
	NumGpu           int      `json:"num_gpu"`           //: 1,
	MainGpu          int      `json:"main_gpu"`          //: 0,
	LowVram          bool     `json:"low_vram"`          //: false,
	F16KV            bool     `json:"f16_kv"`            //: true,
	VocabOnly        bool     `json:"vocab_only"`        //: false,
	UseMMAP          bool     `json:"use_mmap"`          //: true,
	UseMLock         bool     `json:"use_mlock"`         //: false,
	NumThread        int      `json:"num_thread"`        //: 8
}

type GenerateRequest

type GenerateRequest struct {
	Model   string           `json:"model"`
	Prompt  string           `json:"prompt"`
	Format  string           `json:"format,omitempty"`
	Stream  bool             `json:"stream"`
	Images  []string         `json:"images,omitempty"` // array of base64 encoded images
	Options *GenerateOptions `json:"options,omitempty"`
}

type GenerateResponse

type GenerateResponse struct {
	Error              string        `json:"error,omitempty"`
	Model              string        `json:"model"`
	Response           string        `json:"response"`
	Done               bool          `json:"done"`
	DoneReason         string        `json:"done_reason"`
	CreateAt           time.Time     `json:"created_at"`                     // "2024-07-22T11:34:39.896275469Z"
	TotalDuration      time.Duration `json:"total_duration,omitempty"`       //16537307773
	LoadDuration       time.Duration `json:"load_duration,omitempty"`        //14068211
	PromptEvalCount    int64         `json:"prompt_eval_count,omitempty"`    //9
	PromptEvalDuration time.Duration `json:"prompt_eval_duration,omitempty"` //195979000
	EvalCount          int64         `json:"eval_count,omitempty"`           //97
	EvalDuration       time.Duration `json:"eval_duration,omitempty"`        //16281091000
	Context            []int         `json:"-"`                              // context: [32010,3750,338,278,...,6575,4366,1213,13,29913]
}

Jump to

Keyboard shortcuts

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