Add LLM configuration and update URL routing
- Introduced LLM configuration in rag_config.yaml and corresponding LLMConfig class in config.py. - Updated load_rag_config function to parse LLM settings from the configuration file. - Added new API route for RAG in urls.py to facilitate access to the chat model. - Modified QdrantVectorStore to use query_points method for improved functionality.
This commit is contained in:
@@ -32,11 +32,19 @@ class ChunkingConfig:
|
||||
overlap_tokens: int = 50
|
||||
|
||||
|
||||
@dataclass
|
||||
class LLMConfig:
|
||||
model: str = "gpt-4o"
|
||||
base_url: str | None = None
|
||||
api_key_env: str | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
class RAGConfig:
|
||||
embedding: EmbeddingConfig
|
||||
qdrant: QdrantConfig
|
||||
chunking: ChunkingConfig
|
||||
llm: LLMConfig = field(default_factory=LLMConfig)
|
||||
tone_file: str = "config/tone.txt"
|
||||
knowledge_base_path: str = "config/knowledge_base"
|
||||
user_info_path: str = "config/user_info"
|
||||
@@ -82,10 +90,18 @@ def load_rag_config(config_path: str | Path | None = None) -> RAGConfig:
|
||||
overlap_tokens=ch.get("overlap_tokens", 50),
|
||||
)
|
||||
|
||||
llm_data = data.get("llm", {})
|
||||
llm = LLMConfig(
|
||||
model=llm_data.get("model", "gpt-4o"),
|
||||
base_url=llm_data.get("base_url"),
|
||||
api_key_env=llm_data.get("api_key_env"),
|
||||
)
|
||||
|
||||
return RAGConfig(
|
||||
embedding=embedding,
|
||||
qdrant=qdrant,
|
||||
chunking=chunking,
|
||||
llm=llm,
|
||||
tone_file=data.get("tone_file", "config/tone.txt"),
|
||||
knowledge_base_path=data.get("knowledge_base_path", "config/knowledge_base"),
|
||||
user_info_path=data.get("user_info_path", "config/user_info"),
|
||||
|
||||
Reference in New Issue
Block a user