Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add links to citations #139

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

yassinsws
Copy link
Contributor

@yassinsws yassinsws commented Jul 11, 2024

This PR adds links of the lecture units to citations.
image

Summary by CodeRabbit

  • New Features

    • Added the lecture_unit_link field to enhance lecture unit information with clickable links.
    • Improved citation formatting with detailed and clickable references.
  • Enhancements

    • Updated the initial prompt for lecture chat interactions to improve chatbot responses.
    • Revised competency metrics to focus on "confidence" instead of "mastery" for clearer evaluation.
    • Simplified output formatting in lecture content retrieval for better clarity.
  • Database Improvements

    • Updated database search functionality to include new properties like LECTURE_UNIT_NAME and LECTURE_UNIT_LINK.

Base automatically changed from bugfix/index_parenthesis_bugs-fixes to main July 11, 2024 12:19
Copy link
Contributor

coderabbitai bot commented Jul 17, 2024

Walkthrough

The changes introduce a new lecture_unit_link field across various components of the system to enhance the representation of lecture unit data. This includes updates to data transfer objects, schema initialization, and methods for database retrieval and chat interaction prompts. Additionally, the citation formatting has been refined to incorporate clickable links for lecture titles, while competency metrics terminology has been adjusted and output formats streamlined.

Changes

File(s) Summary of Changes
app/domain/data/lecture_unit_dto.py Added lecture_unit_link field to LectureUnitDTO class.
app/pipeline/chat/course_chat_pipeline.py Updated get_competency_list function to replace "mastery" with "confidence" and adjusted output in lecture_content_retrieval function.
app/pipeline/chat/lecture_chat_pipeline.py Introduced initial lecture chat prompt and adjusted result_limit from 10 to 5.
app/pipeline/lecture_ingestion_pipeline.py Included lecture_unit_link field in the create_page_data function.
app/pipeline/prompts/citation_prompt.txt Enhanced citation formatting to incorporate clickable lecture links.
app/pipeline/shared/citation_pipeline.py Updated create_formatted_string method and changed gpt_version_equivalent requirement from 4.5 to 4.25.
app/retrieval/lecture_retrieval.py Modified properties returned by search_in_db function to include LECTURE_UNIT_LINK.
app/vector_database/lecture_schema.py Added LECTURE_UNIT_LINK to LectureSchema enum and updated init_lecture_schema function.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ChatBot
    participant LectureDB
    participant CitationPipeline

    User->>ChatBot: Ask a question
    ChatBot->>LectureDB: Retrieve relevant lecture data
    LectureDB->>ChatBot: Return lecture data with `lecture_unit_link`
    ChatBot->>User: Provide an answer with citation links

    Note over ChatBot, CitationPipeline: Citation formatting includes `lecture_unit_link`

    User->>ChatBot: Ask for citations
    ChatBot->>CitationPipeline: Format citations with links
    CitationPipeline->>ChatBot: Return formatted citations
    ChatBot->>User: Provide formatted citations
Loading

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dc1a4cb and a58c598.

Files selected for processing (1)
  • app/pipeline/prompts/citation_prompt.txt (1 hunks)
Additional context used
LanguageTool
app/pipeline/prompts/citation_prompt.txt

[uncategorized] ~4-~4: The preposition ‘on’ seems more likely in this position.
Context: ...the same lecture, list the page numbers at the same line separated by commas in th...

(AI_HYDRA_LEO_REPLACE_AT_ON)


[style] ~27-~27: Using many exclamation marks might seem excessive (in this case: 4 exclamation marks for a text that’s 1927 characters long)
Context: ...o not include any citations and return '!NONE!'.

(EN_EXCESSIVE_EXCLAMATION)

Additional comments not posted (4)
app/pipeline/prompts/citation_prompt.txt (4)

3-3: LGTM!

The instruction for listing sources with clickable links is clear and correctly formatted.

The code changes are approved.


5-5: LGTM!

The instruction to exclude actual paragraphs and include only citations is clear and correctly formatted.

The code changes are approved.


6-6: LGTM!

The instruction to include only relevant citations is clear and correctly formatted.

The code changes are approved.


14-14: LGTM!

The example of how to format citations with clickable links is clear and correctly formatted.

The code changes are approved.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 17, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 18, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (2)
app/pipeline/prompts/citation_prompt.txt (2)

3-3: Correct the preposition for clarity.

The preposition "at" should be replaced with "on" for better readability.

- 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] <a href="URL">"Lecture title", "page number"</a>.
+ On 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] <a href="URL">"Lecture title", "page number"</a>.

27-27: Reduce the number of exclamation marks.

Using multiple exclamation marks may seem excessive. Consider using a single exclamation mark.

- please do not include any citations and return '!NONE!'.
+ please do not include any citations and return '!NONE'.
Tools
LanguageTool

[style] ~27-~27: Using many exclamation marks might seem excessive (in this case: 4 exclamation marks for a text that’s 1855 characters long)
Context: ...o not include any citations and return '!NONE!'.

(EN_EXCESSIVE_EXCLAMATION)

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 25, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 27, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 27, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (2)
app/pipeline/prompts/citation_prompt.txt (2)

4-4: Replace "at" with "on" for better clarity.

The instruction is clear, but replacing "at" with "on" improves readability.

Apply this diff to improve the readability:

-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] <a href="URL">"Lecture title", "Lecture unit", "page number1,number2,number3"</a>.
+If the answer uses multiple pages from the same lecture, list the page numbers on the same line separated by commas in this format :  [1] <a href="URL">"Lecture title", "Lecture unit", "page number1,number2,number3"</a>.
Tools
LanguageTool

[uncategorized] ~4-~4: The preposition ‘on’ seems more likely in this position.
Context: ...the same lecture, list the page numbers at the same line separated by commas in th...

(AI_HYDRA_LEO_REPLACE_AT_ON)


27-27: Reduce the number of exclamation marks.

The instruction is clear, but reducing the number of exclamation marks improves readability.

Apply this diff to improve the readability:

-If the answer actually does not contain any information from the paragraphs, please do not include any citations and return '!NONE!'.
+If the answer actually does not contain any information from the paragraphs, please do not include any citations and return '!NONE!'.
Tools
LanguageTool

[style] ~27-~27: Using many exclamation marks might seem excessive (in this case: 4 exclamation marks for a text that’s 1899 characters long)
Context: ...o not include any citations and return '!NONE!'.

(EN_EXCESSIVE_EXCLAMATION)

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 27, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (2)
app/pipeline/prompts/citation_prompt.txt (2)

4-4: Replace "at" with "on".

The preposition "at" should be replaced with "on" for better readability.

- 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] <a href="URL">"Lecture title", "Lecture unit title", "page number1,number2,number3"</a>.
+ If the answer uses multiple pages from the same lecture, list the page numbers on the same line separated by commas in this format :  [1] <a href="URL">"Lecture title", "Lecture unit title", "page number1,number2,number3"</a>.
Tools
LanguageTool

[uncategorized] ~4-~4: The preposition ‘on’ seems more likely in this position.
Context: ...the same lecture, list the page numbers at the same line separated by commas in th...

(AI_HYDRA_LEO_REPLACE_AT_ON)


27-27: Reduce the number of exclamation marks.

Using many exclamation marks might seem excessive. Consider reducing them for better readability.

- If the answer actually does not contain any information from the paragraphs, please do not include any citations and return '!NONE!'.
+ If the answer actually does not contain any information from the paragraphs, please do not include any citations and return 'NONE'.
Tools
LanguageTool

[style] ~27-~27: Using many exclamation marks might seem excessive (in this case: 4 exclamation marks for a text that’s 1927 characters long)
Context: ...o not include any citations and return '!NONE!'.

(EN_EXCESSIVE_EXCLAMATION)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants