Skip to content

Commit

Permalink
try to add unit to citation pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
bassner committed Jul 19, 2024
1 parent 14781a3 commit 0125190
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/pipeline/prompts/citation_prompt.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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,as well as the page number in this format "[1] Lecture title, page number".
At the end of the answer list each source with its corresponding number and provide the Lecture Title, Unit Name, as well as the page number in this format "[1] Lecture title, Unit name, page number".
Do not Include the Actual paragraphs, only the citations at the end.
Only include 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!'.
Expand All @@ -10,8 +10,8 @@ Here is an example how to rewrite the answer with citations (note the empty line
"
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.
[2] Lecture 2, page 5.
[1] Lecture 1, Unit A, page 2.
[2] Lecture 2, Unit B, page 5.
"

Here are the answer and the paragraphs:
Expand Down
3 changes: 2 additions & 1 deletion app/pipeline/shared/citation_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ def create_formatted_string(self, paragraphs):
"""
formatted_string = ""
for i, paragraph in enumerate(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),
)
Expand Down

0 comments on commit 0125190

Please sign in to comment.