Skip to content

Commit

Permalink
FastAPI: Support new settings system (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hialus authored Oct 11, 2024
1 parent 79414c7 commit b86901c
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/domain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
)
from .pyris_message import PyrisMessage, IrisMessageRole
from app.domain.data import image_message_content_dto
from app.domain.feature_dto import FeatureDTO
7 changes: 7 additions & 0 deletions app/domain/feature_dto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from pydantic import BaseModel


class FeatureDTO(BaseModel):
id: str
name: str
description: str
49 changes: 46 additions & 3 deletions app/web/routers/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from app.pipeline.chat.course_chat_pipeline import CourseChatPipeline
from app.pipeline.chat.exercise_chat_pipeline import ExerciseChatPipeline
from app.dependencies import TokenValidator
from app.domain import FeatureDTO
from app.pipeline.competency_extraction_pipeline import CompetencyExtractionPipeline

router = APIRouter(prefix="/api/v1/pipelines", tags=["pipelines"])
Expand Down Expand Up @@ -127,9 +128,51 @@ def run_competency_extraction_pipeline(
thread.start()


@router.get("/{feature}")
@router.get("/{feature}/variants")
def get_pipeline(feature: str):
"""
Get the pipeline for the given feature.
Get the pipeline variants for the given feature.
"""
return Response(status_code=status.HTTP_501_NOT_IMPLEMENTED)
match feature:
case "CHAT":
return [
FeatureDTO(
id="default",
name="Default Variant",
description="Default chat variant.",
)
]
case "PROGRAMMING_EXERCISE_CHAT":
return [
FeatureDTO(
id="default",
name="Default Variant",
description="Default programming exercise chat variant.",
)
]
case "COURSE_CHAT":
return [
FeatureDTO(
id="default",
name="Default Variant",
description="Default course chat variant.",
)
]
case "COMPETENCY_GENERATION":
return [
FeatureDTO(
id="default",
name="Default Variant",
description="Default competency generation variant.",
)
]
case "LECTURE_INGESTION":
return [
FeatureDTO(
id="default",
name="Default Variant",
description="Default lecture ingestion variant.",
)
]
case _:
return Response(status_code=status.HTTP_400_BAD_REQUEST)

0 comments on commit b86901c

Please sign in to comment.