-
Notifications
You must be signed in to change notification settings - Fork 342
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
Constrained decoding #103
Constrained decoding #103
Conversation
Code Metrics Report─────────────────────────────────────────────────────────────────────────────── Language Files Lines Blanks Comments Code Complexity ─────────────────────────────────────────────────────────────────────────────── Rust 47 16623 1176 706 14741 809 ─────────────────────────────────────────────────────────────────────────────── Total 47 16623 1176 706 14741 809 ─────────────────────────────────────────────────────────────────────────────── Estimated Cost to Develop 55,563 Estimated Schedule Effort 10.201465 months Estimated People Required 3.967364 ─────────────────────────────────────────────────────────────────────────────── Processed 566260 bytes, 0.566 megabytes (SI) ─────────────────────────────────────────────────────────────────────────────── |
@EricLBuehler What do you think about this approach? The Windows build fails because the linker complains about missing functions that exist just for WASM. I'm not sure how to deal with this... Also, I'm not a fan of using a library from Git. Should we vendor the code or something? I haven't tried optimizing it yet, but on my system, this creates no overhead. But it works 😃 |
This looks really great, thank you so much for adding it! However, I am concerned about the build failures on Windows, which I do want to support. An AICI issue: microsoft/aici#42 says that they do not support native Windows, which is a problem. Perhaps we could support using |
I tried vendoring the code. It's 2k lines and by vendoring I was able to remove ~20 transient dependencies too.
The parser is in "string-space" and we need to operate on "token-space". This would require a lot of glue code to do this conversion. I hope to make AICI code work for us, if it doesn't then I look into RegexParser |
Thank you for pointing that out. Looks like the Windows build is passing; I think we are probably close to a merge once we do some testing, and you mark it as ready! |
@EricLBuehler I think this is ready for review and merge. There is work left to do on optimization, and I haven't tested the But since the MR is already big, it might be a good point to merge. |
I wrote some comments regarding error handling, other than that this looks excellent. Could you please add the example requests above into the |
I added a Yacc example and tested that it works as expected. |
Thank you! |
The public interface is the same used by TGI.
A grammar parameter that can have type "regex" or "yacc". (TGI has regex and json-schema)
Example 1 - Token healing
Example 2 - Markdown List