Class: OpenRouter::PromptTemplate::Builder
- Inherits:
-
Object
- Object
- OpenRouter::PromptTemplate::Builder
- Defined in:
- lib/open_router/prompt_template.rb
Overview
Builder class for DSL-style template creation
Instance Method Summary collapse
- #build ⇒ Object
- #example_template(template) ⇒ Object
- #examples(examples_array) ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #partial_variables(vars) ⇒ Object
- #prefix(text) ⇒ Object
- #suffix(text) ⇒ Object
- #template(text) ⇒ Object
- #variables(*vars) ⇒ Object
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
229 230 231 |
# File 'lib/open_router/prompt_template.rb', line 229 def initialize @config = {} end |
Instance Method Details
#build ⇒ Object
261 262 263 |
# File 'lib/open_router/prompt_template.rb', line 261 def build PromptTemplate.new(**@config) end |
#example_template(template) ⇒ Object
253 254 255 |
# File 'lib/open_router/prompt_template.rb', line 253 def example_template(template) @config[:example_template] = template end |
#examples(examples_array) ⇒ Object
249 250 251 |
# File 'lib/open_router/prompt_template.rb', line 249 def examples(examples_array) @config[:examples] = examples_array end |
#partial_variables(vars) ⇒ Object
257 258 259 |
# File 'lib/open_router/prompt_template.rb', line 257 def partial_variables(vars) @config[:partial_variables] = vars end |
#prefix(text) ⇒ Object
241 242 243 |
# File 'lib/open_router/prompt_template.rb', line 241 def prefix(text) @config[:prefix] = text end |
#suffix(text) ⇒ Object
245 246 247 |
# File 'lib/open_router/prompt_template.rb', line 245 def suffix(text) @config[:suffix] = text end |
#template(text) ⇒ Object
233 234 235 |
# File 'lib/open_router/prompt_template.rb', line 233 def template(text) @config[:template] = text end |
#variables(*vars) ⇒ Object
237 238 239 |
# File 'lib/open_router/prompt_template.rb', line 237 def variables(*vars) @config[:input_variables] = vars end |