Sha256: 860902b5b3b051bd727f14248af0d3432a3997a73898518e002effa2508ec299

Contents?: true

Size: 989 Bytes

Versions: 5

Compression:

Stored size: 989 Bytes

Contents

module Sublayer
  module Agents
    class ModifyFileContentsAgent
      include Sublayer::Capabilities::LLMAssistance
      include Sublayer::Capabilities::HumanAssistance

      attr_reader :file_path, :description, :technologies, :results

      llm_result_format type: :single_string,
        name: "modified_file_contents",
        description: "The modified file contents"

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

      def execute
        @results = human_assistance_with(llm_generate)
      end

      def prompt
        <<-PROMPT
        You are an expert programmer in #{technologies.join(", ")}.

        Here are the original file contents:

        #{File.read(@file_path)}

        The description of the changes to make is: #{description}

        Please make the necessary changes to this file.
        PROMPT
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
clag-0.0.5 vendor/gems/sublayer/lib/sublayer/agents/modify_file_contents_agent.rb
clag-0.0.4 vendor/gems/sublayer/lib/sublayer/agents/modify_file_contents_agent.rb
clag-0.0.3 vendor/gems/sublayer/lib/sublayer/agents/modify_file_contents_agent.rb
clag-0.0.2 vendor/gems/sublayer/lib/sublayer/agents/modify_file_contents_agent.rb
clag-0.0.1 vendor/gems/sublayer/lib/sublayer/agents/modify_file_contents_agent.rb