v2.2.0 - Three-Role Prompt DSL
What's New in v2.2.0
Three-Role Prompt DSL
The prompt DSL now mirrors LLM API terminology with three explicit role methods:
class SearchAgent < ApplicationAgent
model "gpt-4o"
temperature 0.0
system "You are a search intent analyzer."
user "Extract search intent from: {query}"
assistant '{"refined_query":' # Force JSON output
returns do
string :refined_query
array :filters, of: :string
end
end.ask for Conversational Agents
New class-level .ask method for one-off queries and conversational agents without a fixed user template:
class RubyExpert < ApplicationAgent
model "claude-sonnet-4-5-20250929"
system "You are a senior Ruby developer."
end
result = RubyExpert.ask("What's the difference between proc and lambda?")
puts result.content
# Streaming
RubyExpert.ask("Explain metaprogramming") { |chunk| print chunk.content }Full Changelog
Added
userclass-level DSL method for defining user prompts (replacesprompt)assistantclass-level DSL method for assistant prefill/priminguser_configandassistant_configfor message-level options (e.g.,cache_control).ask(message)class method for conversational agents#assistant_promptinstance method (overridable for dynamic prefills)- System prompt now supports
{placeholder}syntax with auto-registered params - Automatic parameter detection for
systemandassistanttemplates resolved_assistant_prefillfor assistant prefill resolutionexecute_with_prefillfor proper assistant message sequencing via RubyLLM
Changed
promptis now a deprecated alias foruser(backward-compatible)prompt_configdelegates touser_configdry_runresponse now includesassistant_promptexecution_optionsnow includesassistant_prefill
Deprecated
promptclass-level DSL -- useuserinstead
Full Changelog: v2.1.0...v2.2.0