Sha256: 5ff12d48e02e1dfef87a9512b5544f648648d7013a1da74175700ac68050cdd3

Contents?: true

Size: 787 Bytes

Versions: 5

Compression:

Stored size: 787 Bytes

Contents

# frozen_string_literal: true

module Ad
  module AgentArchitecture
    module Dsl
      # This class is responsible for defining the prompts of a workflow
      class PromptDsl < ChildDsl
        def prompt(name, path: nil, content: nil)
          raise ArgumentError, 'Prompt name must be a string or symbol' unless name.is_a?(String) || name.is_a?(Symbol)

          workflow[:prompts][name] = { name: name, content: content }
        end

        def prompt_file(file)
          prompt_path = workflow[:settings][:prompt_path]
          raise 'Prompt path not defined in settings. Set "prompt_path" to the path where you are keping prompts' unless prompt_path

          full_path = File.join(prompt_path, file)
          File.read(full_path)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ad-agent_architecture-0.0.17 lib/ad/agent_architecture/dsl/prompt_dsl.rb
ad-agent_architecture-0.0.16 lib/ad/agent_architecture/dsl/prompt_dsl.rb
ad-agent_architecture-0.0.15 lib/ad/agent_architecture/dsl/prompt_dsl.rb
ad-agent_architecture-0.0.14 lib/ad/agent_architecture/dsl/prompt_dsl.rb
ad-agent_architecture-0.0.13 lib/ad/agent_architecture/dsl/prompt_dsl.rb