Skip to content

Formulas

Formulas are generative AI prompt scripts that can contain multiple chained prompts, as variables, and model configuration information. Formulas will continue to evolve and support more functionality.

Click “Create Formula” in the navigation bar to begin creating your Formula.

Create Formula UI editor

The Create Formula editor is the heart of Formulaic and allows you to select your language model, develop prompts, and work with template variables.

Select a model

Click the drop-down and you will see models sorted by their inference hosting provider.

Screenshot: Select a model

In the model selection view we can see inference providers and model names. In this case we chose the Mistral 7B Instruct model. The inference provider is Anyscale. We can also see that there are other open models hosted by Anyscale, as well as models by OpenAI and Google.

Create prompts

Now it’s time to create prompts. We will enter this as our LLM prompt to start our chat with the model we’ve chosen.

You are a personal motivator assistant who is direct and believes that everyone 
can be their best. Generate a motivating slogan that is appropriate for {{{occasion}}} 

Notice how we inserted the word “occasion” inside triple curly braces. Curly braces denote variables, and we will replace “occasion” with the value of the user’s input when they run this Formula.

Screenshot: Enter your first prompt containing an {{{occasion}}} variable

You can drag the bottom corner of the prompt input window to enlarge it if needed.

Click the Save button to save our work so far.

Create variables

We inserted a variable placeholder {{{occasion}}} into our prompt. Now we have to actually create that variable.

Click the Variables toggle in the right column. We now must enter three required fields.

  • Name is the name of our variable. It is case-sensitive and must exactly match what we inserted in triple curly braces in our prompt. Enter: occasion.
  • Description is the form input instructional text that the user will see when they run our Formula. Enter: Tell me the occasion for which you want a motivating slogan.
  • Value is the default value of this variable we will use when testing our Formula on this Create page. It will also appear near the form’s instructional text when a user runs our Formula as a suggestion of what they might enter. Enter first day of a new job.
  • Click Save.

Screenshot: Enter your first variable, occasion

Test run your Formula

Now that we have saved our prompt and created and saved the variable the prompt calls, we can run our script.

Click the LLM toggle, then click Run Formula.

Screenshot: first test run of our Formula

Your response will likely differ even if you run the same query, since this a generative language model. In this instance, the response we receive is:

"Embrace the challenge and ignite your potential on this thrilling first day!"

Great job! You have tested your first Formula and it works! All Formulas need at least one prompt, but you can create Formulas that don’t have variables.

Publish your Formula

You may want to test your Formula with different runtime values for your variable. You can do so by going back into the occasionvariable we declared and changing the value, and then re-running the script by clicking Run Script.

When you’re ready to share it with our community, it’s time to publish it .

  • Click the Publish button at the top right
  • You will see a dialog confirming that you are ready to publish, click Confirm
  • Notice that you are publishing your Formula under the Creative Commons CC-BY(LINK) license.

Congratulations, your Formula published! It is now available to our community on the Explore page. Navigate to Explore and find it!

Screenshot: your Formula appears on Explore page.

Run your published Formula

Once you publish a Formula, Formulaic redirects you to the Run screen that other users will see when they want to run your Formula once. First let’s examine this screen:

  • Notice that our Formula name and description are listed at the top.
  • We have a single input that corresponds to the occasion variable we created. Formulaic automatically generates a UI form input for every variable we create
  • Also notice that instructional text appears next to the occasion input variable that corresponds to the description text we entered: “Tell me the occasion for which you want a motivating slogan”. We also see that the default value we entered when testing the Formula on the Create screen is a helpful suggestion for something to enter: “first day of a new job”

    Now let’s run it.

  • Enter “I’m having a bad day” and click Run.

  • We see our Formula returns an output!

Screenshot: Model returns 'Even on your darkest days, remember you have the power to shine bright.'