diff --git a/app/pipeline/chat/course_chat_pipeline.py b/app/pipeline/chat/course_chat_pipeline.py index 504e4481..5c00bf10 100644 --- a/app/pipeline/chat/course_chat_pipeline.py +++ b/app/pipeline/chat/course_chat_pipeline.py @@ -280,8 +280,9 @@ def lecture_content_retrieval() -> str: result = "" for paragraph in self.retrieved_paragraphs: - lct = "Lecture: {}, Page: {}\nContent:\n---{}---\n\n".format( + lct = "Lecture: {}, Unit: {}, Page: {}\nContent:\n---{}---\n\n".format( paragraph.get(LectureSchema.LECTURE_NAME.value), + paragraph.get(LectureSchema.LECTURE_UNIT_NAME.value), paragraph.get(LectureSchema.PAGE_NUMBER.value), paragraph.get(LectureSchema.PAGE_TEXT_CONTENT.value), ) diff --git a/app/pipeline/prompts/citation_prompt.txt b/app/pipeline/prompts/citation_prompt.txt index d1033b58..ba1e9e1f 100644 --- a/app/pipeline/prompts/citation_prompt.txt +++ b/app/pipeline/prompts/citation_prompt.txt @@ -1,7 +1,7 @@ In the paragraphs below you are provided with an answer to a question. Underneath the answer you will find the paragraphs that the answer was based on. Add citations of the paragraphs to the answer. Cite the paragraphs in brackets after the sentence where the information is used in the answer. At the end of the answer, list each source with its corresponding number and provide the Lecture Title, page number, and a clickable link in this format: [1] "Lecture title", "page number". -If the answer uses multiple pages from the same lecture, list the page numbers at the same line separated by commas in this format : [1] "Lecture title", "page number1,number2,number3". +If the answer uses multiple pages from the same lecture, list the page numbers at the same line separated by commas in this format : [1] "Lecture title", "Lecture unit", "page number1,number2,number3". Do not Include the Actual paragraphs, only the citations at the end. Only include the citations of the paragraphs that are relevant to the answer. If the answer actually does not contain any information from the paragraphs, please do not include any citations and return '!NONE!'. @@ -11,8 +11,8 @@ Here is an example how to rewrite the answer with citations (ONLY ADD CITATION I " Lorem ipsum dolor sit amet, consectetur adipiscing elit [1]. Ded do eiusmod tempor incididunt ut labore et dolore magna aliqua [2]. -[1] Lecture 1, page 2,3,4. -[2] Lecture 2, page 5,25. +[1] Lecture 1, Unit A, page 2,3,4. +[2] Lecture 2, Unit B, page 5,25. " Here are the answer and the paragraphs: @@ -20,7 +20,7 @@ Here are the answer and the paragraphs: Answer without citations: {Answer} -Paragraphs with their Lecture Names, Links and Page Numbers: +Paragraphs with their Lecture Names, Unit Names, Links and Page Numbers: {Paragraphs} Answer with citations (ensure empty line between the message and the citations):