单独配置embedding模型
This commit is contained in:
@@ -61,11 +61,14 @@ decay:
|
|||||||
# --- Embedding / 向量化配置 ---
|
# --- Embedding / 向量化配置 ---
|
||||||
# Uses embedding API for semantic similarity search
|
# Uses embedding API for semantic similarity search
|
||||||
# 通过 embedding API 实现语义相似度搜索
|
# 通过 embedding API 实现语义相似度搜索
|
||||||
# Reuses the same API key (OMBRE_API_KEY) and base_url from dehydration config
|
# You can configure embedding independently from dehydration.
|
||||||
# 复用脱水配置的 API key 和 base_url
|
# If api_key is omitted, reuses the same API key (OMBRE_API_KEY) and base_url from dehydration config
|
||||||
|
# 你可以把 embedding 独立配置;若 api_key 留空,复用脱水配置的 API key 和 base_url
|
||||||
embedding:
|
embedding:
|
||||||
enabled: true # Enable embedding / 启用向量化
|
enabled: true # Enable embedding / 启用向量化
|
||||||
model: "gemini-embedding-001" # Embedding model / 向量化模型
|
model: "gemini-embedding-001" # Embedding model / 向量化模型
|
||||||
|
# base_url: "https://generativelanguage.googleapis.com/v1beta/openai"
|
||||||
|
# api_key: ""
|
||||||
|
|
||||||
# --- Scoring weights / 检索权重参数 ---
|
# --- Scoring weights / 检索权重参数 ---
|
||||||
# total = topic(×4) + emotion(×2) + time(×1.5) + importance(×1)
|
# total = topic(×4) + emotion(×2) + time(×1.5) + importance(×1)
|
||||||
|
|||||||
@@ -34,8 +34,12 @@ class EmbeddingEngine:
|
|||||||
dehy_cfg = config.get("dehydration", {})
|
dehy_cfg = config.get("dehydration", {})
|
||||||
embed_cfg = config.get("embedding", {})
|
embed_cfg = config.get("embedding", {})
|
||||||
|
|
||||||
self.api_key = dehy_cfg.get("api_key", "")
|
self.api_key = (embed_cfg.get("api_key") or dehy_cfg.get("api_key") or "").strip()
|
||||||
self.base_url = dehy_cfg.get("base_url", "https://generativelanguage.googleapis.com/v1beta/openai/")
|
self.base_url = (
|
||||||
|
(embed_cfg.get("base_url") or "").strip()
|
||||||
|
or (dehy_cfg.get("base_url") or "").strip()
|
||||||
|
or "https://generativelanguage.googleapis.com/v1beta/openai/"
|
||||||
|
)
|
||||||
self.model = embed_cfg.get("model", "gemini-embedding-001")
|
self.model = embed_cfg.get("model", "gemini-embedding-001")
|
||||||
self.enabled = bool(self.api_key) and embed_cfg.get("enabled", True)
|
self.enabled = bool(self.api_key) and embed_cfg.get("enabled", True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user