Einstieg Doku

This commit is contained in:
2024-10-30 22:12:51 +01:00
parent 807e7cefb6
commit ebe4a58f90
15 changed files with 204 additions and 144 deletions

41
src/extract/agent.py Normal file
View File

@ -0,0 +1,41 @@
# Agenten Plattform
#
# (c) 2024 Magnus Bender
# Institute of Humanities-Centered Artificial Intelligence (CHAI)
# Universitaet Hamburg
# https://www.chai.uni-hamburg.de/~bender
#
# source code released under the terms of GNU Public License Version 3
# https://www.gnu.org/licenses/gpl-3.0.txt
from typing import Callable
from ums.agent import ExtractAudioAgent, ExtractImageAgent, ExtractTextAgent
from ums.utils.types import RiddleData, AgentMessage
class SimpleExtractAudioAgent(ExtractAudioAgent):
def handle(self, data: RiddleData) -> RiddleData:
print("Audio Process:", data.file_plain)
return data
class SimpleExtractImageAgent(ExtractImageAgent):
def handle(self, data: RiddleData) -> RiddleData:
print("Image Process:", data.file_plain)
return data
class SimpleExtractTextAgent(ExtractTextAgent):
def before_response(self, response: AgentMessage, send_it: Callable[[], None]) -> bool:
print("The response will be:", response)
return True
def handle(self, data: RiddleData) -> RiddleData:
print("Text Process:", data.file_plain)
return data
AGENT_CLASSES = [
SimpleExtractAudioAgent, SimpleExtractImageAgent, SimpleExtractTextAgent
]