feat: Implement Milvus retriver for RAG (#516)

* feat: Implement MilvusRetriever with embedding model and resource management

* chore: Update configuration and loader files for consistency

* chore: Clean up test_milvus.py for improved readability and organization

* feat: Add tests for DashscopeEmbeddings query and document embedding methods

* feat: Add tests for embedding model initialization and example file loading in MilvusProvider

* chore: Remove unused imports and clean up test_milvus.py for better readability

* chore: Clean up test_milvus.py for improved readability and organization

* chore: Clean up test_milvus.py for improved readability and organization

* fix: replace print statements with logging in recursion limit function

* Implement feature X to enhance user experience and optimize performance

* refactor: clean up unused imports and comments in AboutTab component

* Implement feature X to enhance user experience and fix bug Y in module Z

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
CHANGXUBO
2025-09-12 22:20:55 +08:00
committed by GitHub
parent eec8e4dd60
commit dd9af1eb50
15 changed files with 1875 additions and 43 deletions

View File

@@ -10,36 +10,10 @@ from langchain_core.runnables import RunnableConfig
from src.config.report_style import ReportStyle
from src.rag.retriever import Resource
from src.config.loader import get_str_env, get_int_env, get_bool_env
logger = logging.getLogger(__name__)
_TRUTHY = {"1", "true", "yes", "y", "on"}
def get_bool_env(name: str, default: bool = False) -> bool:
val = os.getenv(name)
if val is None:
return default
return str(val).strip().lower() in _TRUTHY
def get_str_env(name: str, default: str = "") -> str:
val = os.getenv(name)
return default if val is None else str(val).strip()
def get_int_env(name: str, default: int = 0) -> int:
val = os.getenv(name)
if val is None:
return default
try:
return int(val.strip())
except ValueError:
logger.warning(
f"Invalid integer value for {name}: {val}. Using default {default}."
)
return default
def get_recursion_limit(default: int = 25) -> int:
"""Get the recursion limit from environment variable or use default.

View File

@@ -7,6 +7,29 @@ from typing import Any, Dict
import yaml
def get_bool_env(name: str, default: bool = False) -> bool:
val = os.getenv(name)
if val is None:
return default
return str(val).strip().lower() in {"1", "true", "yes", "y", "on"}
def get_str_env(name: str, default: str = "") -> str:
val = os.getenv(name)
return default if val is None else str(val).strip()
def get_int_env(name: str, default: int = 0) -> int:
val = os.getenv(name)
if val is None:
return default
try:
return int(val.strip())
except ValueError:
print(f"Invalid integer value for {name}: {val}. Using default {default}.")
return default
def replace_env_vars(value: str) -> str:
"""Replace environment variables in string values."""
if not isinstance(value, str):

View File

@@ -24,6 +24,7 @@ SELECTED_SEARCH_ENGINE = os.getenv("SEARCH_API", SearchEngine.TAVILY.value)
class RAGProvider(enum.Enum):
RAGFLOW = "ragflow"
VIKINGDB_KNOWLEDGE_BASE = "vikingdb_knowledge_base"
MILVUS = "milvus"
SELECTED_RAG_PROVIDER = os.getenv("RAG_PROVIDER")