Class: FlowEngine::LLM::SystemPromptBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/flowengine/llm/system_prompt_builder.rb

Overview

Builds the system prompt for the LLM from the static template and dynamic step metadata from the flow Definition.

Constant Summary collapse

TEMPLATE_PATH =
File.expand_path("../../../resources/prompts/generic-dsl-intake.j2", __dir__)

Instance Method Summary collapse

Constructor Details

#initialize(definition, template_path: TEMPLATE_PATH) ⇒ SystemPromptBuilder

Returns a new instance of SystemPromptBuilder.

Parameters:

  • definition (Definition) —

    flow definition to describe

  • template_path (String) (defaults to: TEMPLATE_PATH) —

    path to the static prompt template



12
13
14
15
# File 'lib/flowengine/llm/system_prompt_builder.rb', line 12

def initialize(definition, template_path: TEMPLATE_PATH)
  @definition = definition
  @template_path = template_path
end

Instance Method Details

#build ⇒ String

Returns complete system prompt (static template + step descriptions + response format).

Returns:

  • (String) —

    complete system prompt (static template + step descriptions + response format)



18
19
20
# File 'lib/flowengine/llm/system_prompt_builder.rb', line 18

def build
  [static_prompt, steps_description, response_format].join("\n\n")
end