mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-09 07:42:39 +02:00
feat: Introduce the RAPTOR Search.
This commit is contained in:
parent
d3540d8cc5
commit
fbbb3294f4
11 changed files with 318 additions and 127 deletions
|
|
@ -6,6 +6,8 @@ from app.agents.researcher.state import State
|
|||
from app.utils.streaming_service import StreamingService
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.agents.researcher.configuration import SearchMode
|
||||
|
||||
|
||||
async def stream_connector_search_results(
|
||||
user_query: str,
|
||||
|
|
@ -14,7 +16,8 @@ async def stream_connector_search_results(
|
|||
session: AsyncSession,
|
||||
research_mode: str,
|
||||
selected_connectors: List[str],
|
||||
langchain_chat_history: List[Any]
|
||||
langchain_chat_history: List[Any],
|
||||
search_mode_str: str
|
||||
) -> AsyncGenerator[str, None]:
|
||||
"""
|
||||
Stream connector search results to the client
|
||||
|
|
@ -41,6 +44,11 @@ async def stream_connector_search_results(
|
|||
# Convert UUID to string if needed
|
||||
user_id_str = str(user_id) if isinstance(user_id, UUID) else user_id
|
||||
|
||||
if search_mode_str == "CHUNKS":
|
||||
search_mode = SearchMode.CHUNKS
|
||||
elif search_mode_str == "DOCUMENTS":
|
||||
search_mode = SearchMode.DOCUMENTS
|
||||
|
||||
# Sample configuration
|
||||
config = {
|
||||
"configurable": {
|
||||
|
|
@ -48,7 +56,8 @@ async def stream_connector_search_results(
|
|||
"num_sections": NUM_SECTIONS,
|
||||
"connectors_to_search": selected_connectors,
|
||||
"user_id": user_id_str,
|
||||
"search_space_id": search_space_id
|
||||
"search_space_id": search_space_id,
|
||||
"search_mode": search_mode
|
||||
}
|
||||
}
|
||||
# Initialize state with database session and streaming service
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue