View Source mix magma.prompt.exec (Magma v0.2.0)
A Mix task for executing prompts.
This Mix task facilitates the execution of a given prompt either manually or according to the generation specification embedded within the prompt document, depending on the magma_generation_type
and magma_generation_params
properties specified in the YAML frontmatter.
The task can be invoked with a prompt name or path, like so:
$ mix magma.prompt.exec "Name of prompt"
Using the --manual
switch allows for manual execution of the prompt. In this mode, the rendered prompt is copied to the clipboard, ready for pasting and executing in the LLM interface of one's choice. By default, the user is interactively asked to paste the result of this execution, which is then used to create a prompt result document:
$ mix magma.prompt.exec "Name of prompt" --manual
The --no-interactive
switch disables the interactive prompt for pasting the result back and instead creates an empty prompt result document. This is useful in contexts where shell interaction is not possible, such as with Obsidian buttons.
Configuration
The default values for the generation specification embedded within the prompt document (the magma_generation_type
and magma_generation_params
properties in its YAML frontmatter) can be configured for your application in config.exs
like this
config :magma,
default_generation: Magma.Generation.OpenAI
config :magma, Magma.Generation.OpenAI,
model: "gpt-4",
temperature: 0.6
Command line options
-
--manual
- Executes the prompt manually, copying the rendered prompt to the clipboard for pasting and executing in an LLM interface -
--no-interactive
- Disables the interactive prompt for pasting the result back and creates an empty prompt result document instead
Summary
Functions
Callback implementation for Mix.Task.run/1
.
Functions
Callback implementation for Mix.Task.run/1
.