def _process_context(context):
    """Process context data into a formatted context string."""
    if context is None:
        return ""
        
    if not isinstance(context, list):
        context = [context]
        
    context_string = ""
    for each in context:
        from ...client.level_two.agent import Characterization
        from ...client.level_two.agent import OtherTask
        from ...client.tasks.tasks import Task
        from ...client.tasks.task_response import ObjectResponse
        from ...client.knowledge_base.knowledge_base import KnowledgeBase
        type_string = type(each).__name__
        the_class_string = None
        try:
            the_class_string = each.__bases__[0].__name__
        except:
            pass
        
        if type_string == Characterization.__name__:
            context_string += f"\n\nThis is your character ```character {each.model_dump()}```"
        elif type_string == OtherTask.__name__:
            context_string += f"\n\nContexts from question answering: ```question_answering question: {each.task} answer: {each.result}```"
        elif type_string == Task.__name__:
            response = None
            description = each.description
            try:
                response = each.response.dict()
            except:
                try:
                    response = each.response.model_dump()
                except:
                    response = each.response
                    
            context_string += f"\n\nContexts from question answering: ```question_answering question: {description} answer: {response}```   "
        elif the_class_string == ObjectResponse.__name__ or the_class_string == BaseModel.__name__:
            context_string += f"\n\nContexts from object response: ```Requested Output {each.model_fields}```"
        else:
            context_string += f"\n\nContexts ```context {each}```"
            
    return context_string
Process context data into a formatted context string.
src/upsonic/server/level_utilized/utility.py