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

Parse scripts and transpile to Outlines graphs #10

Merged
merged 2 commits into from
Mar 25, 2023
Merged

Conversation

rlouf
Copy link
Member

@rlouf rlouf commented Mar 24, 2023

This PR introduces scripts, a friendly interface to Outlines based on Mako templates. The scripts are callable, and when they are called with the variables to substitute, Mako's abstract syntax tree is transpiled into an Outlines graph.

import outlines

t = outlines.script("Test ${variable}")(variable=3.14)
type(t)
# StringVariable

I also add tests for the compiler:

s = string()
o = script("This is a ${var}")(var=s)
out = compile([s], [o])
out("test")
# This is a test

@rlouf rlouf force-pushed the implement-prompts branch 4 times, most recently from aaed58c to 368fad3 Compare March 24, 2023 21:32
@rlouf rlouf changed the title Parse prompts and transpile to Outlines graph Parse scripts and transpile to Outlines graph Mar 24, 2023
@rlouf rlouf changed the title Parse scripts and transpile to Outlines graph Parse scripts and transpile to Outlines graphs Mar 25, 2023
@rlouf rlouf merged commit a3c4ada into main Mar 25, 2023
@rlouf rlouf deleted the implement-prompts branch March 25, 2023 12:23
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

Successfully merging this pull request may close these issues.

None yet

1 participant