feat(embedding): ADR-110 升級 bge-m3:latest 1024 維向量
Some checks failed
Code Review / ai-code-review (push) Successful in 57s
run-migration / migrate (push) Failing after 44s

GCP-A (34.143.170.20) 無 nomic-embed-text,改用 bge-m3:latest(專用
多語言 embedding 模型),產生 1024 維向量。

變更:
- embedding_service.py: 加入 bge-m3:latest=1024 維到 MODEL_DIMENSIONS,
  預設模型改為 bge-m3:latest,更新文件說明
- playbook_embedding_repository.py + interfaces.py: 更新維度說明
- migrations/embedding_bge_m3_1024.sql: pgvector schema 遷移
  rag_chunks + playbook_embeddings vector(768) → vector(1024)
- scripts/reembed_bge_m3.py: 遷移後重新嵌入現有資料的 script

遷移步驟:
  1. 執行 embedding_bge_m3_1024.sql(清空現有 768 維向量,變更維度)
  2. 執行 python scripts/reembed_bge_m3.py 重新嵌入

2026-05-04 ogt + Claude Sonnet 4.6

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Your Name
2026-05-04 11:18:20 +08:00
parent f7e5fc772e
commit b4055c5915
5 changed files with 292 additions and 12 deletions

View File

@@ -274,7 +274,7 @@ class IKnowledgeRepository(Protocol):
...
async def save_embedding(self, entry_id: str, embedding: list[float]) -> bool:
"""儲存向量 embedding (768 維, pgvector)"""
"""儲存向量 embedding (1024 維, pgvector, bge-m3:latest)"""
...
async def semantic_search(

View File

@@ -23,7 +23,7 @@ class PlaybookEmbeddingRepository:
Playbook Embedding Repository
職責: playbook_embeddings 表 CRUD
使用 pgvector 儲存 nomic-embed-text 768 維向量
使用 pgvector 儲存 bge-m3:latest 1024 維向量ADR-110 2026-05-04 升級自 768 維
Args:
db: SQLAlchemy AsyncSession (DI 注入)
@@ -47,7 +47,7 @@ class PlaybookEmbeddingRepository:
Args:
playbook_id: Playbook ID
embedding: 768 維浮點向量 (list[float])
embedding: 1024 維浮點向量 (list[float])bge-m3:latest
alert_names: 索引時的 alert_names 快照
keywords: 索引時的 keywords 快照