Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yassinsws committed Sep 5, 2024
1 parent 2a11f63 commit 854adeb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
3 changes: 2 additions & 1 deletion app/pipeline/chat/course_chat_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ def get_competency_list() -> list:
def lecture_content_retrieval() -> str:
"""
Retrieve content from indexed lecture slides.
This will run a RAG retrieval based on the chat history on the indexed lecture slides and return the most relevant paragraphs.
This will run a RAG retrieval based on the chat history on the indexed lecture slides and return the most
relevant paragraphs.
Use this if you think it can be useful to answer the student's question, or if the student explicitly asks
a question about the lecture content or slides.
Only use this once.
Expand Down
5 changes: 3 additions & 2 deletions app/pipeline/lecture_ingestion_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
CapabilityRequestHandler,
RequirementList,
)
from ..web.status import ingestion_status_callback
from langchain_text_splitters import RecursiveCharacterTextSplitter

from ..web.status import ingestion_status_callback

batch_update_lock = threading.Lock()


Expand Down Expand Up @@ -93,7 +94,7 @@ def __init__(
self,
client: WeaviateClient,
dto: Optional[IngestionPipelineExecutionDto],
callback: IngestionStatusCallback,
callback: ingestion_status_callback,
):
super().__init__()
self.collection = init_lecture_schema(client)
Expand Down
24 changes: 15 additions & 9 deletions app/web/routers/ingestion_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@
router = APIRouter(prefix="/api/v1", tags=["ingestion_status"])


@router.get("/courses/{course_id}/lectures/{lecture_id}/lectureUnits/{lecture_unit_id}/ingestion-state",
dependencies=[Depends(TokenValidator())])
def get_lecture_unit_ingestion_state(course_id: int, lecture_id: int, lecture_unit_id: int, baseUrl: str):
@router.get(
"/courses/{course_id}/lectures/{lecture_id}/lectureUnits/{lecture_unit_id}/ingestion-state",
dependencies=[Depends(TokenValidator())],
)
def get_lecture_unit_ingestion_state(
course_id: int, lecture_id: int, lecture_unit_id: int, baseUrl: str
):
db = VectorDatabase()
decoded_base_url = unquote(baseUrl)
result = db.lectures.query.fetch_objects(
filters=(
Filter.by_property(LectureSchema.BASE_URL.value).equal(decoded_base_url)
& Filter.by_property(LectureSchema.COURSE_ID.value).equal(course_id)
& Filter.by_property(LectureSchema.LECTURE_ID.value).equal(lecture_id)
& Filter.by_property(LectureSchema.LECTURE_UNIT_ID.value).equal(lecture_unit_id)
Filter.by_property(LectureSchema.BASE_URL.value).equal(decoded_base_url)
& Filter.by_property(LectureSchema.COURSE_ID.value).equal(course_id)
& Filter.by_property(LectureSchema.LECTURE_ID.value).equal(lecture_id)
& Filter.by_property(LectureSchema.LECTURE_UNIT_ID.value).equal(
lecture_unit_id
)
),
limit=1,
return_properties=[LectureSchema.LECTURE_UNIT_NAME.value],
Expand All @@ -30,11 +36,11 @@ def get_lecture_unit_ingestion_state(course_id: int, lecture_id: int, lecture_un
return Response(
status_code=status.HTTP_200_OK,
content='"DONE"',
media_type="application/json"
media_type="application/json",
)
else:
return Response(
status_code=status.HTTP_200_OK,
content='"NOT_STARTED"',
media_type="application/json"
media_type="application/json",
)

0 comments on commit 854adeb

Please sign in to comment.