Magma.Prompt (Magma v0.3.2)

Copy Markdown View Source

A standalone prompt document for LLM execution.

Prompts are composed using Obsidian-compatible markdown with transclusion support (![[Document#Section|]]), allowing modular assembly of context and task sections. Each prompt carries a Magma.Generation specification that determines which LLM adapter is used for execution.

Stored in the prompts/ directory of the vault.

Summary

Functions

Loads a document from the given path or document.

Loads a document from the given path or document and raises an exception in error cases.

Loads a document from the given Obsidian link, i.e. a string of the form "[[name]]".

Types

t()

@type t() :: %Magma.Prompt{
  aliases: term(),
  content: term(),
  created_at: term(),
  custom_metadata: term(),
  generation: term(),
  name: term(),
  path: term(),
  tags: term()
}

Functions

create(name, attrs \\ [], opts \\ [])

load(document)

Loads a document from the given path or document.

If the loaded document is not of the proper document type an Magma.InvalidDocumentType exception is returned in an :error tuple.

load!(document_or_path)

Loads a document from the given path or document and raises an exception in error cases.

load_linked(link)

Loads a document from the given Obsidian link, i.e. a string of the form "[[name]]".

If the referenced document is not of the proper document type an Magma.InvalidDocumentType exception is returned in an :error tuple.

new(name, attrs \\ [])

new!(name, attrs \\ [])

path_prefix()

render(prompt)