Prompty
GenAIScript supports running .prompty files as scripts (with some limitations) or importing them in a script.
What is prompty?
Prompty is a markdown-ish file format to store a parameterized prompts along with model information.
There are two ways to leverage prompty files with GenAIScript:
- run them directly through GenAIScript
- import them in a script using
importTemplate
Running .prompty with GenAIScript
You can run a .prompty
file from the cli or Visual Studio Code as any other .genai.mjs
script.
GenAIScript will convert the .prompty
content as a script and execute it. It supports most of the front matter options but mostly ignores the model configuration section.
This is what the basic.prompty
file compiles to:
Importing .prompty
You can also import and render a .prompty file at runtime while generating the prompt using importTemplate
.
In this scenario, the .prompty
file is not executed as a script but imported as a template. The importTemplate
function will render the template with the provided parameters.
Supported features
name
,description
,temperature
,max_tokens
,top_p
, …0inputs
converted toparameters
sample
value populates the parametersdefault
sectionoutputs
converted toresponseSchema
- Jinja2 template engine
Limitations
- model configuration uses GenAIScript
.env
file (see configuration). - images are not yet supported
Extensions
Extra fields that genaiscript use:
files
to specify one or many files to populateenv.files
tests
to specify one or many tests