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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21b50b7538b50f2523ff08c5d963333b136fcb351b707dcd1b1af05d0f0cbdae
|
4
|
+
data.tar.gz: b6c081796379d8422aeae1ab84e0f71334deba217565256bcf8c9fea6efed2b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
78
|
-
def
|
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
|
-
|
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)
|