Spaces:
Sleeping
Sleeping
# coding: utf-8 | |
# Copyright (c) 2025 inclusionAI. | |
import abc | |
from typing import AsyncGenerator | |
from aworld.core.context.base import Context, AgentContext | |
from aworld.core.event.base import Message | |
from aworld.runners.hook.hook_factory import HookFactory | |
from aworld.runners.hook.hooks import PostLLMCallHook, PreLLMCallHook | |
from aworld.utils.common import convert_to_snake | |
class PreLLMCallContextProcessHook(PreLLMCallHook): | |
"""Process in the hook point of the pre_llm_call.""" | |
__metaclass__ = abc.ABCMeta | |
def name(self): | |
return convert_to_snake("PreLLMCallContextProcessHook") | |
async def exec(self, message: Message, context: Context = None) -> Message: | |
''' context.get_agent_context(message.sender) ''' # get agent context | |
# and do something | |
class PostLLMCallContextProcessHook(PostLLMCallHook): | |
"""Process in the hook point of the post_llm_call.""" | |
__metaclass__ = abc.ABCMeta | |
def name(self): | |
return convert_to_snake("PostLLMCallContextProcessHook") | |
async def exec(self, message: Message, context: Context = None) -> Message: | |
'''context.get_agent_context(message.sender)''' # get agent context | |