active_genie 0.25.1 → 0.25.2

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/VERSION +1 -1
  4. data/lib/active_genie/battle/README.md +7 -7
  5. data/lib/active_genie/battle/generalist.json +36 -0
  6. data/lib/active_genie/battle/generalist.md +16 -0
  7. data/lib/active_genie/battle/generalist.rb +16 -69
  8. data/lib/active_genie/clients/providers/anthropic_client.rb +62 -39
  9. data/lib/active_genie/clients/providers/base_client.rb +38 -51
  10. data/lib/active_genie/clients/providers/deepseek_client.rb +56 -49
  11. data/lib/active_genie/clients/providers/google_client.rb +53 -53
  12. data/lib/active_genie/clients/providers/openai_client.rb +53 -54
  13. data/lib/active_genie/clients/unified_client.rb +4 -4
  14. data/lib/active_genie/config/battle_config.rb +2 -0
  15. data/lib/active_genie/config/llm_config.rb +3 -1
  16. data/lib/active_genie/config/log_config.rb +33 -11
  17. data/lib/active_genie/config/providers/anthropic_config.rb +2 -2
  18. data/lib/active_genie/config/providers/deepseek_config.rb +2 -2
  19. data/lib/active_genie/config/providers/google_config.rb +2 -2
  20. data/lib/active_genie/config/providers/openai_config.rb +2 -2
  21. data/lib/active_genie/config/providers_config.rb +4 -4
  22. data/lib/active_genie/config/scoring_config.rb +2 -0
  23. data/lib/active_genie/configuration.rb +14 -8
  24. data/lib/active_genie/data_extractor/from_informal.json +11 -0
  25. data/lib/active_genie/data_extractor/from_informal.rb +3 -11
  26. data/lib/active_genie/data_extractor/generalist.json +9 -0
  27. data/lib/active_genie/data_extractor/generalist.rb +12 -11
  28. data/lib/active_genie/errors/invalid_log_output_error.rb +19 -0
  29. data/lib/active_genie/logger.rb +10 -4
  30. data/lib/active_genie/{concerns → ranking/concerns}/loggable.rb +2 -5
  31. data/lib/active_genie/ranking/elo_round.rb +31 -27
  32. data/lib/active_genie/ranking/free_for_all.rb +29 -21
  33. data/lib/active_genie/ranking/player.rb +45 -17
  34. data/lib/active_genie/ranking/players_collection.rb +16 -6
  35. data/lib/active_genie/ranking/ranking.rb +21 -20
  36. data/lib/active_genie/ranking/ranking_scoring.rb +2 -19
  37. data/lib/active_genie/scoring/generalist.json +9 -0
  38. data/lib/active_genie/scoring/generalist.md +46 -0
  39. data/lib/active_genie/scoring/generalist.rb +13 -65
  40. data/lib/active_genie/scoring/recommended_reviewers.rb +2 -2
  41. metadata +11 -4
@@ -0,0 +1,46 @@
1
+ Evaluate and score the provided text based on predefined criteria, using a scoring range of 0 to 100 with 100 representing the highest possible score.
2
+
3
+ Follow the instructions below to ensure a comprehensive and objective assessment.
4
+
5
+ # Evaluation Process
6
+
7
+ 1. **Analysis**:
8
+ - Thoroughly compare the text against each criterion for a comprehensive evaluation.
9
+ 2. **Document Deviations**:
10
+ - Identify and document areas where the content does not align with the specified criteria.
11
+ 3. **Highlight Strengths**:
12
+ - Note notable features or elements that enhance the quality or effectiveness of the content.
13
+ 4. **Identify Weaknesses**:
14
+ - Specify areas where the content fails to meet the criteria or where improvements could be made.
15
+
16
+ # Scoring Fairness
17
+
18
+ - Ensure the assigned score reflects both the alignment with the criteria and the content's effectiveness.
19
+ - Consider if the fulfillment of other criteria compensates for areas lacking extreme details.
20
+
21
+ # Scoring Range
22
+
23
+ Segment scores into five parts before assigning a final score:
24
+ - **Terrible**: 0-20 - Content does not meet the criteria.
25
+ - **Bad**: 21-40 - Content is substandard but meets some criteria.
26
+ - **Average**: 41-60 - Content meets criteria with room for improvement.
27
+ - **Good**: 61-80 - Content exceeds criteria and is above average.
28
+ - **Great**: 81-100 - Content exceeds all expectations.
29
+
30
+ # Guidelines
31
+
32
+ - Maintain objectivity and avoid biases.
33
+ - Deconstruct each criterion into actionable components for systematic evaluation.
34
+ - Apply reasonable judgment in assigning a score, justifying your rationale clearly.
35
+
36
+ # Output Format
37
+
38
+ - Provide a detailed review including:
39
+ - A final score (0-100)
40
+ - Specific reasoning for the assigned score, detailing all evaluated criteria
41
+ - Include both positive aspects and suggested improvements
42
+
43
+ # Notes
44
+
45
+ - Consider edge cases where the text may partially align with criteria.
46
+ - If lacking information, reasonably judge and explain your scoring approach.
@@ -44,21 +44,9 @@ module ActiveGenie
44
44
  { role: 'user', content: "Text to score: #{@text}" }
45
45
  ]
46
46
 
47
- properties = build_properties
48
-
49
- function = {
50
- name: 'scoring',
51
- description: 'Score the text based on the given criteria.',
52
- parameters: {
53
- type: 'object',
54
- properties:,
55
- required: properties.keys
56
- }
57
- }
58
-
59
47
  result = ::ActiveGenie::Clients::UnifiedClient.function_calling(
60
48
  messages,
61
- function,
49
+ build_function,
62
50
  config: @config
63
51
  )
64
52
 
@@ -76,8 +64,20 @@ module ActiveGenie
76
64
  result
77
65
  end
78
66
 
67
+ PROMPT = File.read(File.join(__dir__, 'generalist.md'))
68
+
79
69
  private
80
70
 
71
+ def build_function
72
+ properties = build_properties
73
+
74
+ function = JSON.parse(File.read(File.join(__dir__, 'generalist.json')), symbolize_names: true)
75
+ function[:parameters][:properties] = properties
76
+ function[:parameters][:required] = properties.keys
77
+
78
+ function
79
+ end
80
+
81
81
  def build_properties
82
82
  properties = {}
83
83
  reviewers.each do |reviewer|
@@ -114,58 +114,6 @@ module ActiveGenie
114
114
  [result['reviewer1'], result['reviewer2'], result['reviewer3']]
115
115
  end
116
116
  end
117
-
118
- PROMPT = <<~PROMPT
119
- Evaluate and score the provided text based on predefined criteria, using a scoring range of 0 to 100 with 100 representing the highest possible score.
120
-
121
- Follow the instructions below to ensure a comprehensive and objective assessment.
122
-
123
- # Evaluation Process
124
-
125
- 1. **Analysis**:
126
- - Thoroughly compare the text against each criterion for a comprehensive evaluation.
127
-
128
- 2. **Document Deviations**:
129
- - Identify and document areas where the content does not align with the specified criteria.
130
-
131
- 3. **Highlight Strengths**:
132
- - Note notable features or elements that enhance the quality or effectiveness of the content.
133
-
134
- 4. **Identify Weaknesses**:
135
- - Specify areas where the content fails to meet the criteria or where improvements could be made.
136
-
137
- # Scoring Fairness
138
-
139
- - Ensure the assigned score reflects both the alignment with the criteria and the content's effectiveness.
140
- - Consider if the fulfillment of other criteria compensates for areas lacking extreme details.
141
-
142
- # Scoring Range
143
-
144
- Segment scores into five parts before assigning a final score:
145
- - **Terrible**: 0-20 - Content does not meet the criteria.
146
- - **Bad**: 21-40 - Content is substandard but meets some criteria.
147
- - **Average**: 41-60 - Content meets criteria with room for improvement.
148
- - **Good**: 61-80 - Content exceeds criteria and is above average.
149
- - **Great**: 81-100 - Content exceeds all expectations.
150
-
151
- # Guidelines
152
-
153
- - Maintain objectivity and avoid biases.
154
- - Deconstruct each criterion into actionable components for systematic evaluation.
155
- - Apply reasonable judgment in assigning a score, justifying your rationale clearly.
156
-
157
- # Output Format
158
-
159
- - Provide a detailed review including:
160
- - A final score (0-100)
161
- - Specific reasoning for the assigned score, detailing all evaluated criteria
162
- - Include both positive aspects and suggested improvements
163
-
164
- # Notes
165
-
166
- - Consider edge cases where the text may partially align with criteria.
167
- - If lacking information, reasonably judge and explain your scoring approach.
168
- PROMPT
169
117
  end
170
118
  end
171
119
  end
@@ -62,8 +62,6 @@ module ActiveGenie
62
62
  )
63
63
  end
64
64
 
65
- private
66
-
67
65
  PROMPT = <<~PROMPT
68
66
  Identify the top 3 suitable reviewer titles or roles based on the provided text and criteria. Selected reviewers must possess subject matter expertise, offer valuable insights, and ensure diverse yet aligned perspectives on the content.
69
67
 
@@ -79,6 +77,8 @@ module ActiveGenie
79
77
  - Avoid redundant or overly similar titles/roles to maintain diversity.
80
78
  PROMPT
81
79
 
80
+ private
81
+
82
82
  def client
83
83
  ::ActiveGenie::Clients::UnifiedClient
84
84
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_genie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.1
4
+ version: 0.25.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radamés Roriz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-19 00:00:00.000000000 Z
11
+ date: 2025-06-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  The lodash for GenAI, stop reinventing the wheel
@@ -26,6 +26,8 @@ files:
26
26
  - lib/active_genie.rb
27
27
  - lib/active_genie/battle.rb
28
28
  - lib/active_genie/battle/README.md
29
+ - lib/active_genie/battle/generalist.json
30
+ - lib/active_genie/battle/generalist.md
29
31
  - lib/active_genie/battle/generalist.rb
30
32
  - lib/active_genie/clients/providers/anthropic_client.rb
31
33
  - lib/active_genie/clients/providers/base_client.rb
@@ -33,7 +35,6 @@ files:
33
35
  - lib/active_genie/clients/providers/google_client.rb
34
36
  - lib/active_genie/clients/providers/openai_client.rb
35
37
  - lib/active_genie/clients/unified_client.rb
36
- - lib/active_genie/concerns/loggable.rb
37
38
  - lib/active_genie/config/battle_config.rb
38
39
  - lib/active_genie/config/data_extractor_config.rb
39
40
  - lib/active_genie/config/llm_config.rb
@@ -49,13 +50,17 @@ files:
49
50
  - lib/active_genie/configuration.rb
50
51
  - lib/active_genie/data_extractor.rb
51
52
  - lib/active_genie/data_extractor/README.md
53
+ - lib/active_genie/data_extractor/from_informal.json
52
54
  - lib/active_genie/data_extractor/from_informal.rb
55
+ - lib/active_genie/data_extractor/generalist.json
53
56
  - lib/active_genie/data_extractor/generalist.md
54
57
  - lib/active_genie/data_extractor/generalist.rb
58
+ - lib/active_genie/errors/invalid_log_output_error.rb
55
59
  - lib/active_genie/errors/invalid_provider_error.rb
56
60
  - lib/active_genie/logger.rb
57
61
  - lib/active_genie/ranking.rb
58
62
  - lib/active_genie/ranking/README.md
63
+ - lib/active_genie/ranking/concerns/loggable.rb
59
64
  - lib/active_genie/ranking/elo_round.rb
60
65
  - lib/active_genie/ranking/free_for_all.rb
61
66
  - lib/active_genie/ranking/player.rb
@@ -64,6 +69,8 @@ files:
64
69
  - lib/active_genie/ranking/ranking_scoring.rb
65
70
  - lib/active_genie/scoring.rb
66
71
  - lib/active_genie/scoring/README.md
72
+ - lib/active_genie/scoring/generalist.json
73
+ - lib/active_genie/scoring/generalist.md
67
74
  - lib/active_genie/scoring/generalist.rb
68
75
  - lib/active_genie/scoring/recommended_reviewers.rb
69
76
  - lib/tasks/benchmark.rake
@@ -86,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
93
  requirements:
87
94
  - - ">="
88
95
  - !ruby/object:Gem::Version
89
- version: 3.3.0
96
+ version: 3.4.0
90
97
  required_rubygems_version: !ruby/object:Gem::Requirement
91
98
  requirements:
92
99
  - - ">="