fix: resolve RAG manager search signature TypeError (#4994)

* fix: resolve RAG manager search signature TypeError and adjust similarity threshold

* fix: revert similarity threshold change to keep PR focused

* test(rag): remove trailing whitespace

---------

Co-authored-by: Alexandre Teixeira <alexandremagteixeira@gmail.com>
This commit is contained in:
Abdul Fatah Jamro
2026-07-03 15:07:16 +01:00
committed by GitHub
parent 7f43678a24
commit ff7164b9ec
2 changed files with 24 additions and 2 deletions
+2 -2
View File
@@ -32,9 +32,9 @@ class RAGManager:
logger.info("RAGManager initialized as wrapper for VectorRAG")
# Delegate all methods to VectorRAG
def search(self, query: str, k: int = 5) -> List[Dict[str, Any]]:
def search(self, query: str, k: int = 5, owner: Optional[str] = None) -> List[Dict[str, Any]]:
"""Search for documents - delegates to VectorRAG."""
return self.vector_rag.search(query, k)
return self.vector_rag.search(query, k, owner=owner)
def index_personal_documents(
self,
+22
View File
@@ -0,0 +1,22 @@
import unittest
from unittest.mock import MagicMock, patch
from src.rag_manager import RAGManager
class TestRAGManagerSearchSignature(unittest.TestCase):
@patch('src.rag_manager.VectorRAG')
def test_search_signature_accepts_owner(self, mock_vector_rag_class):
# Create a mock instance for VectorRAG
mock_vector_rag = MagicMock()
mock_vector_rag_class.return_value = mock_vector_rag
# Initialize RAGManager
manager = RAGManager()
# Test call with owner parameter
manager.search("test query", k=3, owner="user1")
# Verify that search was called on the underlying vector_rag with the correct parameters
mock_vector_rag.search.assert_called_once_with("test query", 3, owner="user1")
if __name__ == '__main__':
unittest.main()