ruby_conversations 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b290c737d59d0eb2cefab58afdb2a1f87f9f52cbe4b3396a63fbcee88b3ab7fd
4
- data.tar.gz: 951c13ba7e151aefaab4b5c8bff4dce2e1f783f43d4670ccc06a42f63b1d5245
3
+ metadata.gz: 21b50b7538b50f2523ff08c5d963333b136fcb351b707dcd1b1af05d0f0cbdae
4
+ data.tar.gz: b6c081796379d8422aeae1ab84e0f71334deba217565256bcf8c9fea6efed2b3
5
5
  SHA512:
6
- metadata.gz: f37b409fc142074098da0ac7cb94e7c7d14164bcbd654d6314e9c5f512f89d6d921deec70ef9cd6532a9bc594d5e29fbc2ec0b0328f15e0bbc510424fcf64dec
7
- data.tar.gz: ab706df48294795c1064f2e36ccda7a151a6b2e1f0485b57acac140aad203fc13b7ac058004c3eb161286b579f277ba3f3e248f52774a68bbdffd9c8881258ee
6
+ metadata.gz: 6951d8ec707ddc5fdad0d12932b48b06f59d53a4ab02f6aa52c1056e054e1ee4eb928bf936fba4527d83c764f3f4e3f5865f82b8707004dfabfa74f337e71d41
7
+ data.tar.gz: 7231ccb1fde48c85fc053d9e1250f2c834a91824b053e24b044405788deb79dbdca9be076edd4cd555050c7310b2db2042e49550093eacf28a83e35fd30d69bf
@@ -48,12 +48,10 @@ module RubyConversations
48
48
  def validate_inputs!(prompt, inputs)
49
49
  return unless prompt.valid_placeholders.present?
50
50
 
51
- missing_inputs, extra_inputs = calculate_input_discrepancies(prompt, inputs)
51
+ missing_inputs = calculate_missing_inputs(prompt, inputs)
52
52
 
53
53
  errors = []
54
- errors << "Missing required inputs: #{missing_inputs.join(', ')}" if missing_inputs.any?
55
- errors << "Unknown inputs provided: #{extra_inputs.join(', ')}" if extra_inputs.any?
56
-
54
+ errors << "#{prompt.name}: Missing required inputs: #{missing_inputs.join(', ')}" if missing_inputs.any?
57
55
  raise ArgumentError, errors.join("\n") if errors.any?
58
56
  end
59
57
 
@@ -74,13 +72,11 @@ module RubyConversations
74
72
  end
75
73
  end
76
74
 
77
- # Calculates missing and extra inputs compared to prompt placeholders
78
- def calculate_input_discrepancies(prompt, inputs)
75
+ # Calculates missing inputs compared to prompt placeholders
76
+ def calculate_missing_inputs(prompt, inputs)
79
77
  required_placeholders = prompt.valid_placeholders.split(',').map(&:strip)
80
78
  provided_keys = inputs.keys.map(&:to_s)
81
- missing_inputs = required_placeholders - provided_keys
82
- extra_inputs = provided_keys - required_placeholders
83
- [missing_inputs, extra_inputs]
79
+ required_placeholders - provided_keys
84
80
  end
85
81
 
86
82
  def build_ai_message(request, description)
@@ -3,7 +3,7 @@
3
3
  module RubyConversations
4
4
  MAJOR = 1
5
5
  MINOR = 0
6
- PATCH = 5
6
+ PATCH = 6
7
7
 
8
8
  VERSION = "#{RubyConversations::MAJOR}.#{RubyConversations::MINOR}.#{RubyConversations::PATCH}".freeze
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_conversations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Shippy