Module: RubyLLM::RedCandle::Configuration

Defined in:
lib/ruby_llm/red_candle/configuration.rb

Overview

Configuration options for Red Candle provider

Constant Summary collapse

DEFAULT_JSON_INSTRUCTION =

Default JSON instruction template for structured generation Use schema_description as a placeholder for the schema description

"\n\nRespond with ONLY a valid JSON object containing: {schema_description}"

Class Method Summary collapse

Class Method Details

.build_json_instruction(schema_description) ⇒ String

Build the JSON instruction by substituting the schema description

Parameters:

  • schema_description (String)

    the human-readable schema description

Returns:

  • (String)

    the formatted instruction



32
33
34
# File 'lib/ruby_llm/red_candle/configuration.rb', line 32

def build_json_instruction(schema_description)
  json_instruction_template.gsub("{schema_description}", schema_description)
end

.json_instruction_templateString

Get the JSON instruction template

Returns:

  • (String)

    the template with schema_description placeholder



14
15
16
# File 'lib/ruby_llm/red_candle/configuration.rb', line 14

def json_instruction_template
  @json_instruction_template || DEFAULT_JSON_INSTRUCTION
end

.json_instruction_template=(template) ⇒ Object

Set a custom JSON instruction template

Parameters:

  • template (String)

    the template with schema_description placeholder



20
21
22
# File 'lib/ruby_llm/red_candle/configuration.rb', line 20

def json_instruction_template=(template)
  @json_instruction_template = template
end

.reset!Object

Reset configuration to defaults



25
26
27
# File 'lib/ruby_llm/red_candle/configuration.rb', line 25

def reset!
  @json_instruction_template = nil
end