mp

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModelTypeLLM       = "llm"
	ModelTypeEmbedding = "embedding"
	ModelTypeRerank    = "rerank"
	ModelTypeOcr       = "ocr"
)

model type

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

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的kv

func ToModelParams

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

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

Types

type AppModelParams

type AppModelParams struct {
	ProviderOpenAICompatible AppModelParamsOpenAICompatible `json:"providerOpenAICompatible"` // OpenAI-API-compatible模型配置
	ProviderYuanJing         AppModelParamsYuanjing         `json:"providerYuanjing"`         // YuanJing模型配置
}

type AppModelParamsOpenAICompatible

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

type AppModelParamsYuanjing

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

type IEmbedding

type IEmbedding interface {
	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 ILLM

type ILLM interface {
	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 {
	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 IRerank

type IRerank interface {
	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 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"`
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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