ai_provider_local

package
v1.5.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OllamaBase   = "http://apipark-ollama:11434"
	OllamaConfig = "" /* 274-byte string literal not displayed */
	OllamaSvg    = `` /* 6696-byte string literal not displayed */

)
View Source
var (
	EnvOllamaAddress = "OLLAMA_ADDRESS"
)

Functions

func CancelPipeline

func CancelPipeline(model string, id string)

func RemoveModel

func RemoveModel(model string) error

func StopPull

func StopPull(model string)

Types

type AsyncExecutor

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

AsyncExecutor 结构体,管理不同模型的管道和任务队列

func NewAsyncExecutor

func NewAsyncExecutor(queueSize int) *AsyncExecutor

NewAsyncExecutor 创建一个新的异步任务执行器

func (*AsyncExecutor) CloseModelPipeline

func (e *AsyncExecutor) CloseModelPipeline(model string)

CloseModelPipeline 关闭当前模型所有管道

func (*AsyncExecutor) ClosePipeline

func (e *AsyncExecutor) ClosePipeline(model string, id string)

ClosePipeline 关闭管道并移除

func (*AsyncExecutor) DistributeToModelPipelines

func (e *AsyncExecutor) DistributeToModelPipelines(model string, msg PullMessage)

DistributeToModelPipelines 仅将消息分发给指定模型的管道

func (*AsyncExecutor) GetModelPipeline

func (e *AsyncExecutor) GetModelPipeline(model string) (*modelPipeline, bool)

func (*AsyncExecutor) SetModelPipeline

func (e *AsyncExecutor) SetModelPipeline(model string, mp *modelPipeline)

func (*AsyncExecutor) StartMessageDistributor

func (e *AsyncExecutor) StartMessageDistributor()

StartMessageDistributor 启动消息分发器

type Model

type Model struct {
	Name       string       `json:"name"`
	Model      string       `json:"model"`
	ModifiedAt time.Time    `json:"modified_at"`
	Size       int64        `json:"size"`
	Digest     string       `json:"digest"`
	Details    ModelDetails `json:"details,omitempty"`
}

func ModelsInstalled

func ModelsInstalled() ([]Model, error)

type ModelConfig

type ModelConfig struct {
	Models  []ModelDetail `json:"models"`
	Version string        `json:"version"`
}

type ModelDetail

type ModelDetail struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Size        string `json:"size"`
	Digest      string `json:"digest"`
	Provider    string `json:"provider"`
	IsPopular   bool   `json:"is_popular"`
	Latest      bool   `json:"latest"`
}

func ModelsCanInstall

func ModelsCanInstall() ([]ModelDetail, string)

func ModelsCanInstallById

func ModelsCanInstallById(id string) []ModelDetail

type ModelDetails

type ModelDetails struct {
	ParentModel       string   `json:"parent_model"`
	Format            string   `json:"format"`
	Family            string   `json:"family"`
	Families          []string `json:"families"`
	ParameterSize     string   `json:"parameter_size"`
	QuantizationLevel string   `json:"quantization_level"`
}

ModelDetails provides details about a model.

type Pipeline

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

Pipeline 结构体,表示每个用户的管道

func PullModel

func PullModel(model string, id string, fn PullCallback) (*Pipeline, error)

func (*Pipeline) Message

func (p *Pipeline) Message() <-chan PullMessage

type PullCallback

type PullCallback func(msg PullMessage) error

type PullMessage

type PullMessage struct {
	Model     string
	Status    string
	Digest    string
	Total     int64
	Completed int64
	Msg       string
}

Jump to

Keyboard shortcuts

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