def perform_search(query: str) -> List[dict]:
    """Conducts a hybrid search and returns a list of ranked chunks based on the query.

    This function performs a search using a hybrid search method, retrieves the relevant 
    chunks, and reranks them according to the query. It handles any exceptions that occur 
    during the process and logs the errors.

    Args:
        query (str): The search query string.

    Returns:
        List[dict]: A list of dictionaries representing the ranked chunks. Returns an 
        empty list if no results are found or if an error occurs."""
    try:
        chunk_ids, scores = hybrid_search(query, num_results=10, config=st.session_state.my_config)
        if not chunk_ids:
            return []
        chunks = retrieve_chunks(chunk_ids, config=st.session_state.my_config)
        return rerank_chunks(query, chunks, config=st.session_state.my_config)
    except Exception as e:
        logger.error(f"Search error: {str(e)}")
        return []
Conducts a hybrid search and returns a list of ranked chunks based on the query.

    This function performs a search using a hybrid search method, retrieves the relevant 
    chunks, and reranks them according to the query. It handles any exceptions that occur 
    during the process and logs the errors.

    Args:
        query (str): The search query string.

    Returns:
        List[dict]: A list of dictionaries representing the ranked chunks. Returns an 
        empty list if no results are found or if an error occurs.
rag_tutorials/hybrid_search_rag/main.py