config

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server    ServerConfig    `yaml:"server"`
	Embedding EmbeddingConfig `yaml:"embedding"`
	VectorDB  VectorDBConfig  `yaml:"vectordb"`
	Splitter  SplitterConfig  `yaml:"splitter"`
}

Config 应用配置

func Load

func Load(path string) (*Config, error)

Load 从 YAML 文件加载配置,环境变量可覆盖

type EmbeddingConfig

type EmbeddingConfig struct {
	Provider string `yaml:"provider"` // openai | ollama | voyageai | gemini
	Model    string `yaml:"model"`
	APIKey   string `yaml:"api_key"`
	BaseURL  string `yaml:"base_url"`
	Dim      int    `yaml:"dim"`           // 仅 Ollama / 自托管 OpenAI 兼容服务需要手动指定
	RPM      int    `yaml:"rpm,omitempty"` // 限速:每分钟请求数(0=用 provider 默认)
	TPM      int    `yaml:"tpm,omitempty"` // 限速:每分钟 tokens(0=用 provider 默认;free tier 应调小)
}

EmbeddingConfig Embedding 配置

type ServerConfig

type ServerConfig struct {
	Port int    `yaml:"port"`
	Host string `yaml:"host"`
}

ServerConfig HTTP 服务配置

type SplitterConfig

type SplitterConfig struct {
	MaxChunkSize  int `yaml:"max_chunk_size"`
	ChunkOverlap  int `yaml:"chunk_overlap"`
	MinChunkBytes int `yaml:"min_chunk_bytes"` // 小于该字节数的 chunk 在服务端被过滤;0 = 不过滤
}

SplitterConfig 切分器配置(push 模式下,文件扫描在客户端做,这里只关心切分参数)

type VectorDBConfig

type VectorDBConfig struct {
	Provider string `yaml:"provider"` // milvus
	Address  string `yaml:"address"`
	Token    string `yaml:"token"`
}

VectorDBConfig 向量数据库配置

Jump to

Keyboard shortcuts

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