Skip to content

Conversation

aaravnavani
Copy link
Contributor

@aaravnavani aaravnavani commented Mar 25, 2024

This PR fixes this issue and makes on_fail an enum. With this update, the way that we construct a RAIL with pydantic changes:

Pydantic:

class BugFreePythonCode(BaseModel):
    python_code: str = Field(validators=[BugFreePython(on_fail=OnFailAction.REASK)])

With XML, constructing a RAIL stays the same and we directly pass in the string "reask". The string is then parsed into an OnFailAction enum type.

<rail version="0.1">
<output>
    <pythoncode
        name="python_code"
        format="bug-free-python"
        on-fail-bug-free-python="reask"
    />
</output>
</rail>

@codecov-commenter
Copy link

codecov-commenter commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 96.66667% with 1 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@a28d1fc). Click here to learn what that means.

Files Patch % Lines
guardrails/utils/pydantic_utils/v2.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #674   +/-   ##
=======================================
  Coverage        ?   80.40%           
=======================================
  Files           ?      123           
  Lines           ?     7043           
  Branches        ?        0           
=======================================
  Hits            ?     5663           
  Misses          ?     1380           
  Partials        ?        0           
Flag Coverage Δ
unittests 80.40% <96.66%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zsimjee
Copy link
Collaborator

zsimjee commented Mar 26, 2024

Awesome work on this one! Let me know if you need any help with tests. We can roll this out with 0.4.3 next Monday

@aaravnavani aaravnavani marked this pull request as ready for review March 27, 2024 19:36
@aaravnavani
Copy link
Contributor Author

Awesome work on this one! Let me know if you need any help with tests. We can roll this out with 0.4.3 next Monday

Thanks @zsimjee! All tests should be passing. Also @ShreyaR this PR is the fix for issue #582

@zsimjee zsimjee merged commit 9a4f436 into guardrails-ai:main Mar 27, 2024
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.

3 participants