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

Changed gpt prompt #154

Merged
merged 2 commits into from
Nov 9, 2024
Merged

Changed gpt prompt #154

merged 2 commits into from
Nov 9, 2024

Conversation

ryansurf
Copy link
Owner

@ryansurf ryansurf commented Nov 9, 2024

General:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code:

  1. Does your submission pass tests?
  2. Have you run the linter/formatter on your code locally before submission?
  3. Have you updated the documentation/README to reflect your changes, as applicable?
  4. Have you added an explanation of what your changes do?
  5. Have you written new tests for your changes, as applicable?

test_gpt was failing. New prompt should work better

Summary by Sourcery

Bug Fixes:

  • Fix the failing test_gpt by updating the prompt to check for days of the week instead of a specific phrase.

Copy link
Contributor

sourcery-ai bot commented Nov 9, 2024

Reviewer's Guide by Sourcery

The pull request modifies the GPT test implementation by changing the test strategy from expecting an exact response to checking for the presence of day names in the response. This makes the test more robust by allowing for variations in the GPT model's output while still verifying its functionality.

Class diagram for updated test_gpt.py

classDiagram
    class TestGpt {
        - surf_summary: str
        - gpt_prompt: str
        - gpt_response: str
        - expected_response: set
        - gpt_response_set: set
        + test_simple_gpt()
    }
    note for TestGpt "Updated test strategy to check for presence of day names in the response."
Loading

File-Level Changes

Change Details Files
Modified GPT test to use a more flexible validation approach
  • Changed the test prompt to ask for days of the week instead of an exact phrase
  • Implemented set intersection logic to check for presence of day names in response
  • Added support for both English and Chinese numeric day representations
  • Removed strict equality check in favor of partial match validation
tests/test_gpt.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

codecov bot commented Nov 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

see 2 files with indirect coverage changes

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ryansurf - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The test has become overly complex - consider simplifying it to just check for the presence of all English days of the week since that's what the prompt asks for. The Chinese numerals in the expected set don't align with the English-specific prompt.
  • There's a syntax error in the expected_response set - missing comma after 'friday'. This will cause the set to be malformed.
  • The empty surf_summary parameter seems incorrect - if this is meant to provide context to the GPT model, it should contain relevant information.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Testing: 2 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 25 to 34
expected_response = set([
"monday",
"tuesday",
"wednesday",
"thursday",
"friday"
"saturday",
"sunday",
"一",
"二",
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (testing): The expected response set includes Chinese numerals which don't align with the test's purpose

The test description mentions 'days of the week in English', but the expected response includes Chinese numerals ('一', '二', etc.). These should be removed to maintain consistency with the test's purpose.

Comment on lines 30 to 31
"friday"
"saturday",
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (testing): Missing comma after 'friday' in the expected response set

This syntax error will cause the test to fail. Add a comma after 'friday' to properly separate the list elements.

)

gpt_response = gpt.simple_gpt(surf_summary, gpt_prompt).lower()
expected_response = set([
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (code-quality): Unwrap a constant iterable constructor (unwrap-iterable-construction)

@ryansurf ryansurf merged commit f105050 into main Nov 9, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant