Refactor embedding configuration to remove local model support, transitioning to a unified remote API approach. Update environment variables and documentation accordingly. Enhance error handling in the orchestrator and related modules to reflect these changes. This update simplifies the embedding process and improves overall system reliability.
This commit is contained in:
Binary file not shown.
@@ -46,7 +46,6 @@ class Text2SQLOrchestrator:
|
||||
schema_manager: SchemaManager,
|
||||
deepseek_api_key: Optional[str] = None,
|
||||
deepseek_config: Optional[DeepSeekConfig] = None,
|
||||
embedding_model_path: Optional[str] = None,
|
||||
vector_db_path: str = "./data/embeddings/chroma",
|
||||
max_retry: int = 2,
|
||||
use_vector_search: bool = True,
|
||||
@@ -64,7 +63,6 @@ class Text2SQLOrchestrator:
|
||||
schema_manager: Schema管理器实例
|
||||
deepseek_api_key: DeepSeek API密钥(也可通过环境变量DEEPSEEK_API_KEY)
|
||||
deepseek_config: DeepSeek配置对象(优先于api_key)
|
||||
embedding_model_path: 本地 Embedding 模型目录(仅 USE_LOCAL_EMBEDDING=true)
|
||||
vector_db_path: 向量数据库路径
|
||||
max_retry: 最大重试次数(包含首次生成)
|
||||
use_vector_search: 是否使用向量检索粗筛
|
||||
@@ -86,7 +84,6 @@ class Text2SQLOrchestrator:
|
||||
# 初始化向量索引(延迟加载)
|
||||
self._vector_index: Optional[SchemaIndexer] = None
|
||||
self._vector_db_path = vector_db_path
|
||||
self._embedding_model_path = embedding_model_path
|
||||
|
||||
# Few-shot 初始化
|
||||
self.fewshot_enabled = fewshot_enabled
|
||||
@@ -110,10 +107,7 @@ class Text2SQLOrchestrator:
|
||||
else:
|
||||
# Chroma 优先时默认不再依赖 JSONL;否则保留原默认路径
|
||||
path = "" if use_chroma else "./data/experiences/all_samples.jsonl"
|
||||
self.fewshot_selector = FewShotSelector(
|
||||
path or None,
|
||||
embedding_model_path=self._embedding_model_path,
|
||||
)
|
||||
self.fewshot_selector = FewShotSelector(path or None)
|
||||
logger.info(
|
||||
f"Few-shot已启用: top_k={fewshot_top_k}, "
|
||||
f"min_rating={fewshot_min_rating}"
|
||||
@@ -151,7 +145,7 @@ class Text2SQLOrchestrator:
|
||||
if self._vector_index is None:
|
||||
from utils.embedding import get_embedder
|
||||
|
||||
embedder = get_embedder(self._embedding_model_path)
|
||||
embedder = get_embedder()
|
||||
self._vector_index = SchemaIndexer(
|
||||
embedder=embedder,
|
||||
persist_dir=self._vector_db_path
|
||||
|
||||
Reference in New Issue
Block a user