Files
group_xinghuo_jinrong/app/tool/embedding_tool.py
T
zhanghongyu_0626 2945108f66 feat(kb): Enhance knowledge base with new collections and search functionality
- Added new configuration for knowledge base root directory in `.env.example` and `settings.py`.
- Implemented `find_products` method in `CoreReadOnlyRepository` for fuzzy product search based on user queries.
- Introduced `search_cs_knowledge` function in `rag_service.py` to facilitate semantic search across new `fin_*` collections.
- Updated document parsing to support Markdown and YAML front-matter for knowledge base entries.
- Created multiple new FAQ and policy documents in the `data/kb_collections` directory to enrich the knowledge base.

This update significantly improves the knowledge retrieval capabilities for customer service interactions, ensuring more relevant and accurate responses.
2026-09-09 20:00:06 +08:00

23 lines
593 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""向量化:Ollama bge-m3,1024 维(客服 KB 灌库 / fin_* 检索用)。
薄封装 `app.service.embedding`,与 T-21 共用同一 Ollama 配置。
"""
from __future__ import annotations
from app.service import embedding
class Embedder:
"""批量/单条 embedding(build_collections / test_search 调用面)。"""
def embed(self, text: str) -> list[float]:
return embedding.embed_text(text)
def embed_batch(self, texts: list[str]) -> list[list[float]]:
return embedding.embed_texts(texts)
def get_embedder() -> Embedder:
return Embedder()