async def _get_relevant_context(
        self,
        db: AsyncSession,
        chat: schemas.Chat,
        query: str,
        user: schemas.User,
    ) -> str:
        """Get relevant context from vector store if sync_id is present."""
        if not chat.sync_id:
            return ""

        try:
            # Lazy import to avoid circular dependency
            from airweave.core.search_service import search_service

            search_results = await search_service.search(
                db=db,
                query=query,
                readable_id=chat.sync_id,
                current_user=user,
            )

            if not search_results:
                return ""

            return "\n\n".join(str(result) for result in search_results)

        except Exception as e:
            logger.error(f"Error getting search context: {str(e)}")
            raise e
Get relevant context from vector store if sync_id is present.
backend/airweave/core/chat_service.py