Closed oliverbj closed 1 year ago
Hey @oliverbj,
Thanks for flagging this issue, I think you just found guardrails' the first bug!
You are using the Guard
module correctly, but the output generated by the LLM isn't respecting the provided schema. This should ordinarily be taken care of by Guardrails, and there are two planned fixes on the roadmap this week that should address this issue:
In the meantime, I got the example working by removing the outermost shipment
element from the rail
spec:
rail_spec = """
<rail version="0.1">
<output strict="true">
<string name="origin_city" description="The city name of the origin of the shipment" />
<string name="orirgin_country" description="The country name of the origin of the shipment" />
<string name="destination_city" description="The city name of the destination of the shipment" />
<string name="destination_country" description="The country name of the destination of the shipment (can be taken from the destination_city)" />
</output>
<prompt>
Generate a valid JSON object for a shipment given a users query:
{{query}}
@complete_json_suffix
</prompt>
</rail>
"""
Hope this helps! I should have the issues I linked resolved soon. Let me know if you run into any other problems.
Consider the below instruction + rail spec:
This will produce the following JSON:
As you can see,
pallets
andcontainer_type
was added to the output, even though it is not defined in my output.