guardrails-ai / guardrails

Adding guardrails to large language models.
https://www.guardrailsai.com/docs
Apache License 2.0
3.84k stars 288 forks source link

[bug] Message: guardrails-cli[6204] , ERROR Failed to inspect #648

Closed musharaf-iqeqdigital closed 1 day ago

musharaf-iqeqdigital commented 5 months ago

Describe the bug I successfully installed Guardrails version 0.4.1 using the following command: pip install "git+https://github.com/guardrails-ai/guardrails.git@main"

After configuring Guardrails, I attempted to install Guard PII with the following command:

guardrails hub install hub://guardrails/detect_pii However, I encountered the following error:

UnicodeEncodeError: 'charmap' codec can't encode character '\u2192' in position 3463: character maps to

Additionally, the Guardrails CLI reported:

guardrails-cli[6204] ERROR Failed to inspect

To Reproduce Steps to reproduce the behavior: 1- Install the guardrails <pip install "git+https://github.com/guardrails-ai/guardrails.git@main"> 2- configure guardrails 3- Install Detect PII <guardrails hub install hub://guardrails/detect_pii>

Library version: Version (0.4.1)

CalebCourier commented 5 months ago

@musharaf-iqeqdigital Thanks for raising this issue! We're still investigating, but from what we can tell, this is a Windows specific encoding issue. We're working on a fix and will update here once we have something.

musharaf-iqeqdigital commented 5 months ago

@CalebCourier Thanks for your response! We're currently using Guardrails for a proof of concept (POC) and are keen to continue. Understanding that the issue may be Windows-specific, we appreciate any updates on the fix. Your assistance is invaluable to us in moving forward with our evaluation.

CalebCourier commented 5 months ago

@musharaf-iqeqdigital I'm still trying to replicate this issue, but in the meantime I do have a work-in-progress branch where any changes for this issue will go. You can see those changes here: https://github.com/guardrails-ai/guardrails/pull/657

If you want to test out these changes as they're still under development you can install from this branch via pip install "git+https://github.com/guardrails-ai/guardrails.git@xplat-encoding"

I'll update here when I have any new findings. Thanks for your again patience!

CalebCourier commented 5 months ago

I was able to replicate this issue in a Windows environment. Going to test the above changes first, then move towards a solution.

RoshniRM commented 5 months ago

facing the same issue

vivek-athina commented 5 months ago

I had encountered part of this error guardrails-cli[6204] ERROR Failed to inspect and it was fixed by upgrading pip to the latest version (Infact any version > 22.2 should fix it). @musharaf-iqeqdigital @RoshniRM Please try this and see if it works.

CalebCourier commented 5 months ago

@musharaf-iqeqdigital @RoshniRM @vivek-athina We've found the underlying cause of this error when running on Windows. In some of our Validator's README's there is a character where it should be ->. The character-set that python uses internally on Windows does not have a mapping for this character hence the error. We're going through and updating the Validator README's to correct this. The RegexMatch and DetectPII validators have already been updated and we will continue to roll out updates to any validators with this issue.

zsimjee commented 5 months ago

some fixes

https://github.com/guardrails-ai/competitor_check/pull/3#pullrequestreview-1986563679 https://github.com/guardrails-ai/nsfw_text/pull/1#pullrequestreview-1986564085 https://github.com/guardrails-ai/gibberish_text/pull/1

nicucalcea commented 4 months ago

I managed to fix it by enabling UTF-8 in Windows.

mdhuzaifapatel commented 4 months ago

guardrails hub install hub://guardrails/detect_pi

I'm facing the same error for this Validator - guardrails hub install hub://guardrails/toxic_language How should I fix it?

CalebCourier commented 3 months ago

@mdhuzaifapatel We are working on updates on our side to mitigate this issue across all validators.

In the meantime, you can work around this issue by enabling UTF-8 like @nicucalcea suggests.

ashwinimiri commented 1 month ago

same issue i am facing in Ubuntu also

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] commented 1 day ago

This issue was closed because it has been stalled for 14 days with no activity.