helper

package
v1.1.45 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEmail added in v1.0.2

func CheckEmail(email string) error

CheckEmail 检查邮箱格式

func Pprof added in v1.1.39

func Pprof(address string)

Pprof 开启pprof

Types

type Message added in v1.1.45

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

Message is a struct representing an Ollama message.

type Ollama added in v1.1.45

type Ollama struct {
	Model string `json:"model"`
	URL   string `json:"url"`
}

Ollama represents an Ollama instance.

func NewOllama added in v1.1.45

func NewOllama(url string, opts ...OllamaOption) *Ollama

NewOllama creates a new instance of Ollama with the given URL and options.

func (*Ollama) HandleChat added in v1.1.45

func (o *Ollama) HandleChat() http.HandlerFunc

HandleChat returns an HTTP handler function that handles chat requests.

type OllamaOption added in v1.1.45

type OllamaOption func(o *Ollama)

OllamaOption is a function that configures an Ollama instance.

func WithOllamaModel added in v1.1.45

func WithOllamaModel(model string) OllamaOption

WithOllamaModel sets the model for the Ollama instance.

type Request added in v1.1.45

type Request struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
	Stream   bool      `json:"stream"`
}

Request is a struct representing an Ollama request.

type Response added in v1.1.45

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

Response is a struct representing an Ollama response.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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