Add agent (and small dummy)
This commit is contained in:
15
agent-extract/Dockerfile
Normal file
15
agent-extract/Dockerfile
Normal 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
|
0
agent-extract/src/__init__.py
Normal file
0
agent-extract/src/__init__.py
Normal file
37
agent-extract/src/agent.py
Normal file
37
agent-extract/src/agent.py
Normal 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
|
||||
]
|
Reference in New Issue
Block a user