mp

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ModelTypeLLM       = "llm"
	ModelTypeEmbedding = "embedding"
	ModelTypeRerank    = "rerank"
	ModelTypeOcr       = "ocr"
	ModelTypeGui       = "gui"
	ModelTypePdfParser = "pdf-parser"
)

model type

View Source
const (
	ProviderOpenAICompatible = "OpenAI-API-compatible"
	ProviderYuanJing         = "YuanJing"
	ProviderHuoshan          = "Huoshan"
	ProviderOllama           = "Ollama"
	ProviderQwen             = "Qwen"
	ProviderInfini           = "Infini"
)

model provider

Variables

This section is empty.

Functions

func Init

func Init(callbackUrl string)

func ToModelConfig

func ToModelConfig(provider, modelType, cfg string) (interface{}, error)

ToModelConfig 返回ILLM、IEmbedding或IRerank

func ToModelEndpoint

func ToModelEndpoint(modelId, model string) map[string]interface{}

ToModelEndpoint 返回model、model_url、model_id的kv

func ToModelParams

func ToModelParams(provider, modelType, cfg string) (interface{}, map[string]interface{}, error)

ToModelParams 返回ILLMParams、IEmbeddingParams或IRerankParams,与对应实际传给模型的参数

func ToModelTags added in v0.2.3

func ToModelTags(provider, modelType, cfg string) ([]mp_common.Tag, error)

ToModelTags ILLM、IEmbedding或IRerank 的 标签列表

Types

type AppModelParams

type AppModelParams struct {
	ProviderOpenAICompatible AppModelParamsOpenAICompatible `json:"providerOpenAICompatible"` // OpenAI-API-compatible模型配置
	ProviderYuanJing         AppModelParamsYuanjing         `json:"providerYuanjing"`         // YuanJing模型配置
	ProviderHuoshan          AppModelParamsHuoshan          `json:"providerHuoshan"`
	ProviderQwen             AppModelParamsQwen             `json:"providerQwen"`
	ProviderOllama           AppModelParamsOllama           `json:"providerOllama"`
	ProviderInfini           AppModelParamsInfini           `json:"providerModelByInfini"`
}

type AppModelParamsHuoshan added in v0.2.3

type AppModelParamsHuoshan struct {
	LLM mp_huoshan.LLMParams `json:"llm"` // 大语言模型配置
}

type AppModelParamsInfini added in v0.2.3

type AppModelParamsInfini struct {
	LLM mp_infini.LLMParams `json:"llm"` // 大语言模型配置
}

type AppModelParamsOllama added in v0.2.3

type AppModelParamsOllama struct {
	LLM mp_ollama.LLMParams `json:"llm"` // 大语言模型配置
}

type AppModelParamsOpenAICompatible

type AppModelParamsOpenAICompatible struct {
	LLM mp_openai_compatible.LLMParams `json:"llm"` // 大语言模型配置
}

type AppModelParamsQwen added in v0.2.3

type AppModelParamsQwen struct {
	LLM mp_qwen.LLMParams `json:"llm"` // 大语言模型配置
}

type AppModelParamsYuanjing

type AppModelParamsYuanjing struct {
	LLM mp_yuanjing.LLMParams `json:"llm"` // 大语言模型配置
}

type IEmbedding

type IEmbedding interface {
	Tags() []mp_common.Tag
	NewReq(req *mp_common.EmbeddingReq) (mp_common.IEmbeddingReq, error)
	Embeddings(ctx context.Context, req mp_common.IEmbeddingReq, headers ...mp_common.Header) (mp_common.IEmbeddingResp, error)
}

type IGui added in v0.2.1

type IGui interface {
	Tags() []mp_common.Tag
	NewReq(req *mp_common.GuiReq) (mp_common.IGuiReq, error)
	Gui(ctx context.Context, req mp_common.IGuiReq, headers ...mp_common.Header) (mp_common.IGuiResp, error)
}

type ILLM

type ILLM interface {
	Tags() []mp_common.Tag
	NewReq(req *mp_common.LLMReq) (mp_common.ILLMReq, error)
	ChatCompletions(ctx context.Context, req mp_common.ILLMReq, headers ...mp_common.Header) (mp_common.ILLMResp, <-chan mp_common.ILLMResp, error)
}

type ILLMParams

type ILLMParams interface {
	GetParams() map[string]interface{}
}

type IOcr added in v0.1.5

type IOcr interface {
	Tags() []mp_common.Tag
	NewReq(req *mp_common.OcrReq) (mp_common.IOcrReq, error)
	Ocr(ctx *gin.Context, req mp_common.IOcrReq, headers ...mp_common.Header) (mp_common.IOcrResp, error)
}

type IPdfParser added in v0.2.3

type IPdfParser interface {
	Tags() []mp_common.Tag
	NewReq(req *mp_common.PdfParserReq) (mp_common.IPdfParserReq, error)
	PdfParser(ctx *gin.Context, req mp_common.IPdfParserReq, headers ...mp_common.Header) (mp_common.IPdfParserResp, error)
}

type IRerank

type IRerank interface {
	Tags() []mp_common.Tag
	NewReq(req *mp_common.RerankReq) (mp_common.IRerankReq, error)
	Rerank(ctx context.Context, req mp_common.IRerankReq, headers ...mp_common.Header) (mp_common.IRerankResp, error)
}

type ProviderModelByHuoshan added in v0.1.4

type ProviderModelByHuoshan struct {
	Llm       mp_huoshan.LLM       `json:"llm"`
	Embedding mp_huoshan.Embedding `json:"embedding"`
}

type ProviderModelByInfini added in v0.2.2

type ProviderModelByInfini struct {
	Llm       mp_infini.LLM       `json:"llm"`
	Rerank    mp_infini.Rerank    `json:"rerank"`
	Embedding mp_infini.Embedding `json:"embedding"`
}

type ProviderModelByOllama added in v0.1.4

type ProviderModelByOllama struct {
	Llm       mp_ollama.LLM       `json:"llm"`
	Embedding mp_ollama.Embedding `json:"embedding"`
}

type ProviderModelByOpenAICompatible

type ProviderModelByOpenAICompatible struct {
	Llm       mp_openai_compatible.LLM       `json:"llm"`
	Rerank    mp_openai_compatible.Rerank    `json:"rerank"`
	Embedding mp_openai_compatible.Embedding `json:"embedding"`
}

type ProviderModelByQwen added in v0.1.4

type ProviderModelByQwen struct {
	Llm       mp_qwen.LLM       `json:"llm"`
	Rerank    mp_qwen.Rerank    `json:"rerank"`
	Embedding mp_qwen.Embedding `json:"embedding"`
}

type ProviderModelByYuanjing

type ProviderModelByYuanjing struct {
	Llm       mp_yuanjing.LLM       `json:"llm"`
	Rerank    mp_yuanjing.Rerank    `json:"rerank"`
	Embedding mp_yuanjing.Embedding `json:"embedding"`
	Ocr       mp_yuanjing.Ocr       `json:"ocr"`
	Gui       mp_yuanjing.Gui       `json:"gui"`
	PdfParser mp_yuanjing.PdfParser `json:"pdf-parser"`
}

type ProviderModelConfig

type ProviderModelConfig struct {
	ProviderYuanJing         ProviderModelByYuanjing         `json:"providerYuanJing"`
	ProviderOpenAICompatible ProviderModelByOpenAICompatible `json:"providerOpenAICompatible"`
	ProviderHuoshan          ProviderModelByHuoshan          `json:"providerHuoshan"`
	ProviderQwen             ProviderModelByQwen             `json:"providerQwen"`
	ProviderOllama           ProviderModelByOllama           `json:"providerOllama"`
	ProviderInfini           ProviderModelByInfini           `json:"providerModelByInfini"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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