ThoughtfulCodeGenerator

InfoGenerateCreated ByPackages

The provided code defines a `CodeGenerator` class that inherits from `Sublayer::Generators::Base`. The class is intended to generate code in a requested language, as described by the `llm_output_adapter` directive, which specifies a single string type for the generated code. The class is initialized with two parameters: a description of the desired code and the list of technologies to be used. The `generate` method calls the superclass's generate method, and the `prompt` method returns a fixed motivational message to encourage thoughtful coding.

class CodeGenerator < Sublayer::Generators::Base 
 llm_output_adapter type: :single_string,
  name: "generated_code",
  description: "The generated code in the requested language"

 def initialize(description:, technologies:)
   @description = description
   @technologies = technologies
 end

 def generate
   super
 end

 def prompt
   <<-PROMPT
       Take a deep breath and think step by step before you start coding.
   PROMPT
 end
 end