You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per @brandonwillard 's suggestion, I'm adding a feature request to allow generated text to be tied to a variable for easy access; useful in the case where one prompt has multiple pieces being generated, and you want access to each.
prompt='''Here's one sentence: {{gen "SENTENCE_1"}}Now, another sentence: {{gen "SENTENCE_2"}}'''out=guidance(prompt)()
print(out['SENTENCE_1'])
# <prints what the LLM generated>print(out['SENTENCE_2'])
# <prints the other sentence>
Already, outlines allows this from the generation side:
prompt='''Here's one sentence: [a-z]{0,50}Now, another sentence: [a-z]{0,50}'''
But the user would have to parse each sentence out themselves.
Python has a syntax that allows this for instance, perhaps we copy that?
pattern=r"(?P<day>\d{2})-(?P<month>\d{2})-(?P<year>\d{4})"text="The date is 25-12-2021"match=re.search(pattern, text)
edit: upon experiment, that date pattern already works great with outlines and generates a valid(ish) date. Our regex parser already respects the naming syntax then, apparently!
The text was updated successfully, but these errors were encountered:
freckletonj
changed the title
Feature Req: Tie Generated text to Variables
Feature Req: Tie Generated text to Keys
Sep 30, 2023
Per @brandonwillard 's suggestion, I'm adding a feature request to allow generated text to be tied to a variable for easy access; useful in the case where one prompt has multiple pieces being generated, and you want access to each.
guidance
offers a feature that looks like this:Already,
outlines
allows this from the generation side:But the user would have to parse each sentence out themselves.
Python has a syntax that allows this for instance, perhaps we copy that?
edit: upon experiment, that date
pattern
already works great withoutlines
and generates a valid(ish) date. Our regex parser already respects the naming syntax then, apparently!The text was updated successfully, but these errors were encountered: