helper

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 15 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"`
	Auth  string `json:"auth"`
	Type  string `json:"type"`
	// contains filtered or unexported fields
}

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.

func (*Ollama) HandlePushContext added in v1.2.8

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

HandlePushContext is a handler that pushes context to the Ollama instance.

type OllamaOption added in v1.1.45

type OllamaOption func(o *Ollama)

OllamaOption is a function that configures an Ollama instance.

func WithOllamaAuth added in v1.2.8

func WithOllamaAuth(auth string) OllamaOption

WithOllamaAuth sets the auth for the Ollama instance.

func WithOllamaContextSize added in v1.2.8

func WithOllamaContextSize(size uint32) OllamaOption

WithOllamaContextSize sets the context size for the Ollama instance.

func WithOllamaModel added in v1.1.45

func WithOllamaModel(model string) OllamaOption

WithOllamaModel sets the model for the Ollama instance.

func WithOllamaType added in v1.2.8

func WithOllamaType(t string) OllamaOption

WithOllamaType sets the type for the Ollama instance.

type OllamaResponse added in v1.2.8

type OllamaResponse 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"`
}

OllamaResponse is a struct representing an Ollama response.

type OpenAIAPIResponse added in v1.2.8

type OpenAIAPIResponse struct {
	ID                string `json:"id"`
	Object            string `json:"object"`
	Created           int    `json:"created"`
	Model             string `json:"model"`
	SystemFingerprint string `json:"system_fingerprint"`
	Choices           []struct {
		Index int `json:"index"`
		Delta struct {
			Content string `json:"content"`
		} `json:"delta"`
		Logprobs     interface{} `json:"logprobs"`
		FinishReason interface{} `json:"finish_reason"`
	} `json:"choices"`
}

OpenAIAPIResponse is a struct representing an OpenAI API response.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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