robot_lab-audit 0.2.8 → 0.3.0
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/.envrc +2 -2
- data/examples/01_basic_usage.rb +6 -6
- data/examples/common.rb +3 -0
- data/lib/robot_lab/audit/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 69728f6acae0f6fc5e2ed44978b92987e4259909c9ca2331d09a6ecd0363ea88
|
|
4
|
+
data.tar.gz: 81c533106e0cbdda74cefe354d90e7c1374f97c5cdfe30e5a51aed1397853b84
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 03b2c5ac748d6bfcca5e6755342ede0ed38a3a19b9f6d53f6824936963559dcf7655b623eef1bb913758735e3a6387e3eb262e4b845e552944be7620e1b18447
|
|
7
|
+
data.tar.gz: 85126e3cd486cde65d207d599bec314fc9285255cfd19fa008558993152d89e3eeeb2aaf3d0ce5afcc095d8796f4212937a34c435c15a4f0371a3af5eb5ca212
|
data/.envrc
CHANGED
data/examples/01_basic_usage.rb
CHANGED
|
@@ -33,7 +33,7 @@ end
|
|
|
33
33
|
|
|
34
34
|
class WordCountTool < RobotLab::Tool
|
|
35
35
|
description 'Counts words in a text string'
|
|
36
|
-
|
|
36
|
+
parameter :text, type: 'string', description: 'The text to analyse'
|
|
37
37
|
|
|
38
38
|
def execute(text:)
|
|
39
39
|
{ word_count: text.split.size, status: 'ok' }
|
|
@@ -43,7 +43,7 @@ end
|
|
|
43
43
|
|
|
44
44
|
class SentimentTool < RobotLab::Tool
|
|
45
45
|
description 'Returns a sentiment score for a text string'
|
|
46
|
-
|
|
46
|
+
parameter :text, type: 'string', description: 'The text to score'
|
|
47
47
|
|
|
48
48
|
def execute(text:)
|
|
49
49
|
score = text.downcase.include?('great') ? 0.9 : 0.5
|
|
@@ -54,7 +54,7 @@ end
|
|
|
54
54
|
|
|
55
55
|
class FailingTool < RobotLab::Tool
|
|
56
56
|
description 'Always raises a ToolError (for error logging demo)'
|
|
57
|
-
|
|
57
|
+
parameter :reason, type: 'string', description: 'Failure reason'
|
|
58
58
|
|
|
59
59
|
def execute(reason:)
|
|
60
60
|
raise RobotLab::ToolError, "Simulated failure: #{reason}"
|
|
@@ -198,8 +198,8 @@ word_count.instance_variable_set(:@robot, analyst)
|
|
|
198
198
|
sentiment = SentimentTool.new
|
|
199
199
|
sentiment.instance_variable_set(:@robot, analyst)
|
|
200
200
|
|
|
201
|
-
word_count.call({ 'text' => input })
|
|
202
|
-
sentiment.call({ 'text' => input })
|
|
201
|
+
word_count.call(**{ 'text' => input })
|
|
202
|
+
sentiment.call(**{ 'text' => input })
|
|
203
203
|
|
|
204
204
|
all_tool_events = log.instance_variable_get(:@db)
|
|
205
205
|
.execute("SELECT * FROM audit_events WHERE event_type = 'tool_call'")
|
|
@@ -224,7 +224,7 @@ TEXT
|
|
|
224
224
|
|
|
225
225
|
failing = FailingTool.new
|
|
226
226
|
failing.instance_variable_set(:@robot, analyst)
|
|
227
|
-
failing.call({ 'reason' => 'network timeout' })
|
|
227
|
+
failing.call(**{ 'reason' => 'network timeout' })
|
|
228
228
|
|
|
229
229
|
print_events(log.recent_errors, label: 'recent_errors (newest first):')
|
|
230
230
|
|
data/examples/common.rb
CHANGED
|
@@ -7,6 +7,9 @@ require_relative '../lib/robot_lab/audit'
|
|
|
7
7
|
|
|
8
8
|
RubyLLM.configure do |c|
|
|
9
9
|
c.logger = Logger.new(File::NULL)
|
|
10
|
+
# The demo robots stub out chat.ask, so no request ever reaches a provider —
|
|
11
|
+
# but ruby_llm 2.0 validates provider configuration when the chat is built.
|
|
12
|
+
c.anthropic_api_key = ENV.fetch("ANTHROPIC_API_KEY", "stub-key-never-used")
|
|
10
13
|
end
|
|
11
14
|
|
|
12
15
|
RobotLab.configure do |c|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: robot_lab-audit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dewayne VanHoozer
|
|
@@ -13,16 +13,16 @@ dependencies:
|
|
|
13
13
|
name: robot_lab
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 0.3.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
|
-
- - "
|
|
23
|
+
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 0.3.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: sqlite3
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
90
90
|
- !ruby/object:Gem::Version
|
|
91
91
|
version: '0'
|
|
92
92
|
requirements: []
|
|
93
|
-
rubygems_version: 4.0.
|
|
93
|
+
rubygems_version: 4.0.21
|
|
94
94
|
specification_version: 4
|
|
95
95
|
summary: SQLite-backed execution audit log for RobotLab via the Hook system.
|
|
96
96
|
test_files: []
|