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

feat: Improve LFQA Web Example #5504

Merged
merged 3 commits into from
Aug 4, 2023
Merged

feat: Improve LFQA Web Example #5504

merged 3 commits into from
Aug 4, 2023

Conversation

vblagoje
Copy link
Member

@vblagoje vblagoje commented Aug 3, 2023

What

This PR improves the examples/web_lfqa_improved.py example by tweaking the prompt for longer, more elaborate answers. It also adds functionality to switch between different LLMs used in the PromptNode easily. We also add more questions requiring complex, elaborate answers.

Why

The changes were made to enhance the flexibility and usability of the LFQA web example. By allowing easy switching between different LLMs, users can experiment with various models and observe their performance. Tweaking the prompt for longer answers can help in generating more detailed and informative responses.

How

The changes were implemented by modifying the examples/web_lfqa_improved.py script. The prompt was adjusted to encourage the generation of longer answers. Additionally, a mechanism was added to facilitate the switching between different LLMs in the PromptNode. Finally, we have added additional questions requiring complex, elaborate answers.

How to test

To test the changes, run the examples/web_lfqa_improved.py script and observe the generated answers. Try switching between different LLMs and note the differences in the responses.

Notes to the reviewer

Please check the modifications in the examples/web_lfqa_improved.py script, run it yourself, experiment with other different models etc.

@vblagoje vblagoje requested review from a team as code owners August 3, 2023 12:00
@vblagoje vblagoje requested review from dfokina and bogdankostic and removed request for a team August 3, 2023 12:00
@coveralls
Copy link
Collaborator

coveralls commented Aug 3, 2023

Pull Request Test Coverage Report for Build 5761247664

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.004%) to 46.697%

Totals Coverage Status
Change from base Build 5760525461: 0.004%
Covered Lines: 11015
Relevant Lines: 23588

💛 - Coveralls

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need a release note file for this PR, as we don't ship the examples directory with Haystack. I'd say let's remove it and add the ignore-for-release-notes label instead.

@@ -39,12 +47,25 @@
pipeline.add_node(component=litm_ranker, name="LostInTheMiddleRanker", inputs=["DiversityRanker"])
pipeline.add_node(component=prompt_node, name="PromptNode", inputs=["LostInTheMiddleRanker"])

logger = logging.getLogger("boilerpy3")
logger.setLevel(logging.CRITICAL)
logging.basicConfig(level=logging.CRITICAL)
Copy link
Contributor

Choose a reason for hiding this comment

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

Pylint check is failing due to using logging.basicConfig.

Copy link
Member Author

Choose a reason for hiding this comment

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

I turned it off for this LOC. Otherwise, we'll get HTML stripping, retrieval failure logs etc etc. LMK if there is an alternative solution.

@vblagoje
Copy link
Member Author

vblagoje commented Aug 3, 2023

@bogdankostic 6ed2ff8 seems to work

@vblagoje
Copy link
Member Author

vblagoje commented Aug 3, 2023

Question: Please rate the readiness of this Pull Request (PR) for integration on a scale of 1 to 10, with 1 indicating it is completely unready and 10 signifying it is fully prepared for merging into the main branch. First elborate and then provide your rating

Answer:
This PR seems to be well-prepared for integration. The changes are clearly explained in the PR description, and the code changes are well-structured and easy to understand. The PR adds new features to the LFQA web example, including the ability to switch between different language models and a prompt for more elaborate answers. It also adds more complex questions for the model to answer.

The code changes are well-documented, and the PR includes a release note detailing the enhancements. The PR also includes error handling for missing environment variables, which is a good practice.

However, it would be beneficial if the PR included some unit tests to verify the new functionality. This would help ensure that the changes work as expected and do not introduce any regressions.

Taking all these factors into consideration, I would rate this PR as an 8 out of 10. It's mostly ready for integration, but the addition of unit tests could further improve its readiness.

@vblagoje vblagoje added the ignore-for-release-notes PRs with this flag won't be included in the release notes. label Aug 4, 2023
Copy link
Contributor

@bogdankostic bogdankostic left a comment

Choose a reason for hiding this comment

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

LGTM

@vblagoje vblagoje merged commit abc6737 into main Aug 4, 2023
51 checks passed
@vblagoje vblagoje deleted the web_lfqa_example branch August 4, 2023 12:20
@TuanaCelik
Copy link
Member

@vblagoje @bogdankostic - I would suggest:

  1. Make the name reflect what this is doing. 'improved' is vague, how about web_lfqa_with_rankers/diversityranker/rerankers' or similar :)
  2. Please, let's change the example questions :)

@vblagoje
Copy link
Member Author

Ok perhaps we can call it web_lfqa_with_rankers.py. Why change the questions? I was personally interested in these questions...which ones should be changed?

DosticJelena pushed a commit to smartcat-labs/haystack that referenced this pull request Aug 23, 2023
* Improve web_lfqa example

* Turn off pylint for logging setup

* Another way to turn off logging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore-for-release-notes PRs with this flag won't be included in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants