Class: PromptSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/promptspec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path, validate_required_params: true) ⇒ PromptSpec

Returns a new instance of PromptSpec.



11
12
13
14
15
# File 'lib/promptspec.rb', line 11

def initialize(file_path, validate_required_params: true)
  @file_path = file_path
  @validate_required_params = validate_required_params
  load_parse_file!
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



9
10
11
# File 'lib/promptspec.rb', line 9

def file_path
  @file_path
end

#parametersObject (readonly)

Returns the value of attribute parameters.



9
10
11
# File 'lib/promptspec.rb', line 9

def parameters
  @parameters
end

#validate_required_paramsObject (readonly)

Returns the value of attribute validate_required_params.



9
10
11
# File 'lib/promptspec.rb', line 9

def validate_required_params
  @validate_required_params
end

#yaml_contentObject (readonly)

Returns the value of attribute yaml_content.



9
10
11
# File 'lib/promptspec.rb', line 9

def yaml_content
  @yaml_content
end

Instance Method Details

#call(**parameters) ⇒ Object



17
18
19
20
21
22
# File 'lib/promptspec.rb', line 17

def call(**parameters)
  @parameters = parameters
  validate_required_inputs! if @validate_required_params
  parse_prompt_messages
  construct_endpoint_request
end