ExOutlines.Prompt (ExOutlines v0.1.0)

Copy Markdown View Source

Prompt construction for generation and repair cycles.

Builds structured prompts from specs and diagnostics.

Summary

Functions

Build initial generation prompt from a spec.

Build repair prompt from previous attempt and diagnostics.

Types

message()

@type message() :: %{role: String.t(), content: String.t()}

Functions

build_initial(spec)

@spec build_initial(ExOutlines.Spec.t()) :: [message()]

Build initial generation prompt from a spec.

Converts the spec to a schema representation and constructs a prompt instructing the LLM to generate conforming JSON output.

build_repair(previous_output, diagnostics)

@spec build_repair(String.t(), ExOutlines.Diagnostics.t()) :: [message()]

Build repair prompt from previous attempt and diagnostics.

Creates messages showing the validation failure and requesting correction. Returns messages to append to the conversation history.