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:
2026-02-27 19:44:49 +03:30
parent 197f70ee12
commit 94355af62b
8 changed files with 187 additions and 6 deletions
+10 -6
View File
@@ -98,20 +98,24 @@ class QdrantVectorStore:
) -> list[dict]:
"""
جستجوی شباهت بر اساس query vector.
از query_points استفاده می‌کند (qdrant-client >= 2.0).
"""
results = self.client.search(
response = self.client.query_points(
collection_name=self.qdrant.collection_name,
query_vector=query_vector,
query=query_vector,
limit=limit,
score_threshold=score_threshold,
)
points = getattr(response, "points", []) or []
return [
{
"id": str(r.id),
"score": r.score,
"text": r.payload.get("text", ""),
"metadata": {k: v for k, v in r.payload.items() if k != "text"},
"score": float(r.score) if r.score is not None else 0.0,
"text": (r.payload or {}).get("text", ""),
"metadata": {
k: v for k, v in (r.payload or {}).items() if k != "text"
},
}
for r in results
for r in points
]