-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/pipeline-subsystem-v1' of github.com:ls1intum/P…
…yris into feature/pipeline-subsystem-v1
- Loading branch information
Showing
5 changed files
with
46 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from pipeline.pipeline import AbstractPipeline | ||
from pipeline.pipeline import Pipeline | ||
from pipeline.chat.simple_chat_pipeline import SimpleChatPipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from abc import ABC, abstractmethod | ||
|
||
from domain import IrisMessage | ||
from pipeline import Pipeline | ||
|
||
|
||
class ProgrammingExerciseTutorChatPipeline(Pipeline, ABC): | ||
""" | ||
Abstract class for the programming exercise tutor chat pipeline implementations. | ||
This class defines the signature of all implementations of this Iris feature. | ||
""" | ||
|
||
def __call__(self, query: IrisMessage, **kwargs) -> IrisMessage: | ||
return self._run(query) | ||
|
||
@abstractmethod | ||
def _run(self, query: IrisMessage) -> IrisMessage: | ||
""" | ||
Runs the pipeline and returns the response message. | ||
""" | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
from abc import ABCMeta, abstractmethod | ||
from abc import ABCMeta | ||
|
||
from domain import IrisMessage | ||
|
||
|
||
class AbstractPipeline(metaclass=ABCMeta): | ||
class Pipeline(metaclass=ABCMeta): | ||
"""Abstract class for all pipelines""" | ||
|
||
name: str | ||
implementation_id: str | ||
|
||
def __init__(self, name=None): | ||
self.name = name | ||
def __init__(self, implementation_id=None): | ||
self.implementation_id = implementation_id | ||
|
||
@abstractmethod | ||
def __call__(self, **kwargs) -> IrisMessage: | ||
def __call__(self, **kwargs): | ||
""" | ||
Runs the pipeline and is intended to be called by __call__ | ||
:param kwargs: keyword arguments | ||
:return: IrisMessage | ||
Extracts the required parameters from the kwargs runs the pipeline. | ||
""" | ||
raise NotImplementedError | ||
|