Add agent (and small dummy)

This commit is contained in:
2024-10-30 00:32:57 +01:00
parent e1c2e8fb2b
commit 807e7cefb6
7 changed files with 159 additions and 11 deletions

15
agent-extract/Dockerfile Normal file
View File

@ -0,0 +1,15 @@
ARG IMAGE_FROM
FROM $IMAGE_FROM
# become root
USER root
# do somthing as root, e.g. install packages, set up things ...
# RUN ...
# copy the source of the agent in this repo
COPY --chown=user:user ./src/ /ums-agenten/project/src/
# fix permissions
RUN chown -R user:user /ums-agenten
# switch back to user
USER user

View File

View File

@ -0,0 +1,37 @@
# 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 ums.agent import ExtractAudioAgent, ExtractImageAgent
from ums.utils.types import RiddleData
"""
Examples for simple agents.
Each agent is represented by its own class. The handling of tasks is done by `handle()` in each agent.
Finally `AGENT_CLASSES` contains the classes of the agents in a list. Via environmental variables this list is specified to the ums.agent system.
"""
class MyExtractAudioAgent(ExtractAudioAgent):
def handle(self, data: RiddleData) -> RiddleData:
print("Audio Process:", data.file_plain)
return data
class MyExtractImageAgent(ExtractImageAgent):
def handle(self, data: RiddleData) -> RiddleData:
print("Image Process:", data.file_plain)
return data
AGENT_CLASSES = [
MyExtractAudioAgent, MyExtractImageAgent
]