active_genie 0.0.25 → 0.25.1
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 +4 -4
- data/VERSION +1 -1
- data/lib/active_genie/clients/unified_client.rb +2 -1
- data/lib/active_genie/config/data_extractor_config.rb +3 -3
- data/lib/active_genie/config/providers_config.rb +2 -1
- data/lib/active_genie/configuration.rb +4 -2
- data/lib/active_genie/data_extractor/generalist.rb +2 -2
- data/lib/active_genie/errors/invalid_provider_error.rb +8 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c91ce12dad609d42839c1d71d172ae5ed6922357374097ec29de8bcbb0c7a3fd
|
4
|
+
data.tar.gz: 4de847656eff030d4bdf93bf8f492584c5ace9458af7f13b962941eabbe1e308
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c9c8fbf3f4e940408d3a1051f280aec1da7d196ac61ba1fa02812b68376411a74198a44fb888fbd0c3cf385d39330c7c2265a3a73448c6b2a9179a1c29bdd48
|
7
|
+
data.tar.gz: 2d7001c0bb3b2ce274ecef96eaf10a0228d949f447d5df7cccca4f686c6f2b14273c71d376f5f7b8e39d9448a3ee27bd2f1358f4a7a69cdad2ac4fd34dfac574
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.25.1
|
@@ -38,7 +38,8 @@ module ActiveGenie
|
|
38
38
|
|
39
39
|
def normalize_response(response)
|
40
40
|
response.each do |key, value|
|
41
|
-
response[key] = nil if ['null', 'none', 'undefined', '', 'unknown',
|
41
|
+
response[key] = nil if ['null', 'none', 'undefined', '', 'unknown',
|
42
|
+
'<unknown>'].include?(value.to_s.strip.downcase)
|
42
43
|
end
|
43
44
|
|
44
45
|
response
|
@@ -13,9 +13,9 @@ module ActiveGenie
|
|
13
13
|
|
14
14
|
def merge(config_params = {})
|
15
15
|
dup.tap do |config|
|
16
|
-
config.with_explanation = config_params[:with_explanation] if config_params
|
17
|
-
config.min_accuracy = config_params[:min_accuracy] if config_params
|
18
|
-
config.verbose = config_params[:verbose] if config_params
|
16
|
+
config.with_explanation = config_params[:with_explanation] if config_params.key?(:with_explanation)
|
17
|
+
config.min_accuracy = config_params[:min_accuracy] if config_params.key?(:min_accuracy)
|
18
|
+
config.verbose = config_params[:verbose] if config_params.key?(:verbose)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -16,7 +16,7 @@ module ActiveGenie
|
|
16
16
|
|
17
17
|
def default=(provider)
|
18
18
|
normalized_provider = provider.to_s.downcase.strip
|
19
|
-
@default = normalized_provider.size
|
19
|
+
@default = normalized_provider.size.positive? ? normalized_provider : valid.keys.first
|
20
20
|
end
|
21
21
|
|
22
22
|
def valid
|
@@ -47,6 +47,7 @@ module ActiveGenie
|
|
47
47
|
def merge(config_params = {})
|
48
48
|
dup.tap do |config|
|
49
49
|
config.add(config_params[:providers]) if config_params[:providers]
|
50
|
+
config.default = config_params[:default] if config_params[:default]
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
@@ -48,8 +48,10 @@ module ActiveGenie
|
|
48
48
|
|
49
49
|
next unless config.respond_to?(:merge)
|
50
50
|
|
51
|
-
new_config = if config_params.key?(key)
|
52
|
-
config.merge(config_params[key])
|
51
|
+
new_config = if config_params.key?(key.to_s)
|
52
|
+
config.merge(config_params[key.to_s])
|
53
|
+
elsif config_params.key?(key.to_sym)
|
54
|
+
config.merge(config_params[key.to_sym])
|
53
55
|
else
|
54
56
|
config.merge(config_params)
|
55
57
|
end
|
@@ -104,10 +104,10 @@ module ActiveGenie
|
|
104
104
|
simplified_response = {}
|
105
105
|
|
106
106
|
@data_to_extract.each_key do |key|
|
107
|
-
next
|
107
|
+
next unless response.key?(key.to_s)
|
108
108
|
next if response.key?("#{key}_accuracy") && response["#{key}_accuracy"] < min_accuracy
|
109
109
|
|
110
|
-
simplified_response[key] = response[key]
|
110
|
+
simplified_response[key] = response[key.to_s]
|
111
111
|
end
|
112
112
|
|
113
113
|
simplified_response
|
@@ -9,8 +9,8 @@ module ActiveGenie
|
|
9
9
|
1. Set up global configuration:
|
10
10
|
```ruby
|
11
11
|
ActiveGenie.configure do |config|
|
12
|
-
config.
|
13
|
-
config.api_key = 'your_api_key'
|
12
|
+
config.providers.default = 'openai'
|
13
|
+
config.providers.openai.api_key = 'your_api_key'
|
14
14
|
# ... other configuration options
|
15
15
|
end
|
16
16
|
```
|
@@ -21,8 +21,12 @@ module ActiveGenie
|
|
21
21
|
arg1,
|
22
22
|
arg2,
|
23
23
|
config: {
|
24
|
-
|
25
|
-
|
24
|
+
providers: {
|
25
|
+
default: 'openai',
|
26
|
+
openai: {
|
27
|
+
api_key: 'your_api_key'
|
28
|
+
}
|
29
|
+
}
|
26
30
|
}
|
27
31
|
)
|
28
32
|
```
|