Replies: 1 comment
-
If you're using a model that supports regex as an output type, using For instance: from typing import Optional
from pydantic import BaseModel
class FoundAnswer(BaseModel):
parameter_1: str
parameter_2: int
output_type = Optional[FoundAnswer]
# to check whether no answer was found
if response == "None":
... With |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Assume I have a class with two attributes
parameter_1
andparameter_2
, that I wantoutlines
to fill out.Some of my prompts have few-shot examples.
I have noticed that when my context doesn't have meaningful values for
parameter_1
andparameter_2
, the output fromoutlines
often has values from the examples instead.It feels like as if the LLM tries its best to provide some values for
parameter_1
andparameter_2
, even going into its few-shot examples (whereas I need it to pay attention to only the context as mentioned a few times in the prompt)Currently, I have found a "fix" where I prompt
"If you cannot fill this JSON, and only then, answer 'blah' to parameter_1 and 'blah' to parameter_2."
, and then ifparameter_1
andparameter_2
have 'blah' in them, I know there's no matches in the context.Another way could have been writing an explicit grammar for the class and then having an "or branch" that says "no match" but before I went down that rabbithole, I wanted to know if there's a better way of handling this
Beta Was this translation helpful? Give feedback.
All reactions