41 lines
872 B
Python
41 lines
872 B
Python
from pydantic_settings import BaseSettings
|
|
from typing import Optional
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# DashScope API
|
|
dashscope_api_key: str = ""
|
|
|
|
# Milvus
|
|
milvus_host: str = "localhost"
|
|
milvus_port: int = 19530
|
|
|
|
# LLM配置
|
|
llm_model: str = "qwen-max"
|
|
embedding_model: str = "text-embedding-v3"
|
|
embedding_dim: int = 1536
|
|
|
|
# 检索配置
|
|
vector_top_k: int = 10
|
|
bm25_top_k: int = 10
|
|
final_top_k: int = 5
|
|
|
|
# 分块配置
|
|
chunk_size: int = 800
|
|
chunk_overlap: int = 50
|
|
|
|
# 服务配置
|
|
api_host: str = "0.0.0.0"
|
|
api_port: int = 8000
|
|
|
|
# Collection名称
|
|
regulations_collection: str = "vehicle_regulations"
|
|
compliance_collection: str = "compliance_cache"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
env_file_encoding = "utf-8"
|
|
case_sensitive = False
|
|
|
|
|
|
settings = Settings() |