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

[Bug] Unhelpful error message for simple HTML grammar #9

Open
riedgar-ms opened this issue Aug 21, 2024 · 3 comments
Open

[Bug] Unhelpful error message for simple HTML grammar #9

riedgar-ms opened this issue Aug 21, 2024 · 3 comments

Comments

@riedgar-ms
Copy link

I've created a very simple HTML cookbook for Guidance:
https://github.com/Harsha-Nori/guidance-cookbook/tree/main/simple-html
However, when trying to run this against and Azure AI deployed model, I got a rather strange error message:
image
This is.... not particularly helpful to someone who isn't an expert in grammars and the like.

I was eventually able to bully things into working by simplifying the HTML which could be generated even more, but the limit I appear to be encountering seems very low given how simple the basic structure being described is.

@mmoskal
Copy link
Member

mmoskal commented Aug 21, 2024

If you use gen(regex=[^<>]+) or similar for gen text it should work

@riedgar-ms
Copy link
Author

That did it ... although that's not an entirely obvious fix.

Sorry for the deleted comments, I managed to mess up my initial application of your fix

@mmoskal
Copy link
Member

mmoskal commented Aug 28, 2024

Yeah, I agree. I think we should have a warning about zero_or_more(char_range(...)) and similar. In some cases, we may be able to automatically wrap them in as_regular_grammar() (it's equivalent to gen()), however it is a bit tricky not to mess with semantics...

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

No branches or pull requests

2 participants