We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug I encountered XMLSyntaxError when trying to reproduce the text summarization example.
XMLSyntaxError
To Reproduce Steps to reproduce the behavior:
Rail spec:
<rail version="0.1"> <script language='python'> document = open("search.txt", "r").read() </script> <output> <string name="summary" description="Summarize the given document faithfully." format="similar-to-document: {document}, 0.60" on-fail-similar-to-document="filter" /> </output> <prompt> Summarize the following document: {{document}} @complete_json_suffix </prompt> </rail>
(I only changed the document path, which is a valid path for me.)
Running the command
guard = gd.Guard.from_rail_string(rail_str)
gives the following error:
Traceback (most recent call last): File /databricks/python/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3378 in run_code exec(code_obj, self.user_global_ns, self.user_ns) File <command-3862015891448427>:27 guard = gd.Guard.from_rail_string(rail_str) File /local_disk0/.ephemeral_nfs/envs/pythonEnv-84b67d00-0c2e-469a-8873-18f5bc500df3/lib/python3.9/site-packages/guardrails/guard.py:132 in from_rail_string return cls(Rail.from_string(rail_string), num_reasks=num_reasks) File /local_disk0/.ephemeral_nfs/envs/pythonEnv-84b67d00-0c2e-469a-8873-18f5bc500df3/lib/python3.9/site-packages/guardrails/rail.py:108 in from_string return cls.from_xml(ET.fromstring(string, parser=XMLPARSER)) File /local_disk0/.ephemeral_nfs/envs/pythonEnv-84b67d00-0c2e-469a-8873-18f5bc500df3/lib/python3.9/site-packages/guardrails/rail.py:139 in from_xml raw_output_schema = ET.fromstring(raw_output_schema, parser=XMLPARSER) File src/lxml/etree.pyx:3257 in lxml.etree.fromstring File src/lxml/parser.pxi:1916 in lxml.etree._parseMemoryDocument File src/lxml/parser.pxi:1796 in lxml.etree._parseDoc File src/lxml/parser.pxi:1085 in lxml.etree._BaseParser._parseUnicodeDoc File src/lxml/parser.pxi:618 in lxml.etree._ParserContext._handleParseResultDoc File src/lxml/parser.pxi:728 in lxml.etree._handleParseResult File src/lxml/parser.pxi:657 in lxml.etree._raiseParseError File <string>:6 XMLSyntaxError: attributes construct error, line 6, column 196
Expected behavior The Guard should be created with no errors.
Library version: Installed directly from GitHub, main branch.
Additional context Removing the
format="similar-to-document: {document}, 0.60" on-fail-similar-to-document="filter"
doesn't throw an error, but that would defeat its intended purpose.
FWIW, switching to the saliency-check validator throws the same error.
saliency-check
The text was updated successfully, but these errors were encountered:
Can you share what is the content of line 5 of your input document?
If there is a double quote in there, can you replace it with " and re-run?
"
Sorry, something went wrong.
Hey @jy-tan, @maxdml, sorry for the late reply. I've pushed a PR that automatically replaces " with ", could you give it a try?
"
Successfully merging a pull request may close this issue.
Describe the bug
I encountered
XMLSyntaxError
when trying to reproduce the text summarization example.To Reproduce
Steps to reproduce the behavior:
Rail spec:
(I only changed the document path, which is a valid path for me.)
Running the command
gives the following error:
Expected behavior
The Guard should be created with no errors.
Library version:
Installed directly from GitHub, main branch.
Additional context
Removing the
doesn't throw an error, but that would defeat its intended purpose.
FWIW, switching to the
saliency-check
validator throws the same error.The text was updated successfully, but these errors were encountered: