-
Notifications
You must be signed in to change notification settings - Fork 203
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
Dataclass type constraint issues (Infinite arrays & LogitBias Warnings) #185
Comments
Looks like a culprit is |
Thanks for reporting this. |
No worries! changing line 173 is substantially more reliable I am now getting consistent correct output with this reduced query
results in
Not sure why role is empty here (Edit: fixed it with a tokens len constraint), the dataclass with role field works however. |
Hijacking the same issue, I also notice it's very easy to hit the Just adding one more string property (objective) to the previous dataclass causes the issue. Either of these examples results in the warning
or
|
On the first one I don't get warnings on logit bias limitations, but the second one is due to the integer constraining. This is an API limitation from the OpenAI side. Check out some experimental changes I tried out in 376736a (not on main), where I tweaked the type query code a bit, by adding some more precise constraints, to avoid unnecessary extra tokens. |
Yup it was definitely the integer constraint, and
for lists of dataclasses ie
outputs
|
I just started out with LMQL and I am getting a similar error with a simple LMQL program (example reproduced from the docs):
I am using Azure OpenAI - GPT-4. This is my model:
And this is how I call the
Not sure what the issue is. |
Is there any movement on getting this fix patched in? I ran into the same issue and this definitely seems to work. Seems pretty trivial to fix, and this was reported back in August. |
Dataclass support is a feature in preview. The core team is more focused on the next major version of LMQL right now which will also help with this particular feature, but PRs are welcome for the current revision as well :) |
There is a number of issues when using a Dataclass type constraint with a
List[str]
property.Using this example:
lmql will appear to hang until maximum tokens is reached, printing
context.prompt
in the types.py stack pop while loop shows an output that looks like this:then
or
At this point I halt the program because:
"",
repeats indefinitely, until the max token length is reached.","
and is instead encapsulated in a string and separated by\n
Other projects that solve JSON structure that lqml's dataclass type constraint requires are
The text was updated successfully, but these errors were encountered: