def send_question_to_python()

in chat.py [0:0]


def send_question_to_python(question, conversation_id):
    """
    Process the question using the orchestrator.

    Args:
        question (str): The user's question.
        conversation_id (str): The conversation ID.

    Returns:
        dict: The response from the orchestrator.
    """
    # Use default client principal information
    client_principal = {
        'id': '00000000-0000-0000-0000-000000000123',
        'name': 'anonymous',
        'group_names': ''        
    }


    # Call orchestrator
    if question:
        try:
            orchestrator = Orchestrator(conversation_id, client_principal)
            result = asyncio.run(orchestrator.answer(question))
            if not isinstance(result, dict):
                logger.error("Expected result to be a dictionary.")
                return {"error": "Invalid response format from orchestrator."}
            return result
        except Exception as e:
            logger.exception(f"An error occurred while orchestrating the question: {e}")
            return {"error": "An error occurred while processing your question."}
    else:
        logger.warning("No question provided to orchestrate.")
        return {"error": "No question provided."}