⚠️ Mixlayer is currently in open beta. Please excuse us if you encounter any issues while we get things ready.
Built-in Functions
prompt

prompt(input, options)

prompt appends the specified text to the model's context window.

Arguments

input string
The text to append to the context window.


options.role string
For instruct models, this will emit the correct tokens to label your input with the correct role. This is typically user, assistant or system but can vary from model to model.


options.hidden boolean
If true, the text will not be visible in the output in the output by default.

Basic Usage

You can use it to provide the model with instructions or questions before generating a completion:

prompt.js
prompt(`What is the meaning of life?`, { role: 'user' }); 
gen({limit: 100, role: 'assistant'});

Or provide a system prompt to provide the model with rules and instructions:

prompt.js
prompt(`You are a stoic, contemplative philosopher who excels` + 
    `at exploring existental questions.`, { role: 'system' });

Prefill

You can also use prompt to prefill part of the model's completion. This can be useful for guiding the model to provide an output a format you want.

prompt.js
prompt(`What are three things that are great about San Francisco?\n`, { role: 'user' });
for(let i=0;i<3;i++) { 
    // Here we use { role: assistant } with prompt to prefill the assistant's 
    // answer with precisely the list format that we want. It will also prevent the 
    // model from generating any "fluff" before the list
    prompt(`${i+1}. `, { role: 'assistant' });
    gen({stop_at: '\n', role: 'assistant'});
}