coolhand 0.1.2 → 0.1.3
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/CHANGELOG.md +11 -0
- data/lib/coolhand/ruby/api_service.rb +14 -6
- data/lib/coolhand/ruby/collector.rb +21 -0
- data/lib/coolhand/ruby/feedback_service.rb +3 -1
- data/lib/coolhand/ruby/logger_service.rb +1 -1
- data/lib/coolhand/ruby/version.rb +1 -1
- data/lib/coolhand/ruby.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e32109fb4ad7c01bf475cf1dbdb33a16a8ccb16ff46e2de3c5fcb0b6424e18e
|
|
4
|
+
data.tar.gz: 55da627d7b73a90195a0d1496cf504b9a46ed28e9f04fa93aff2898929662129
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 71d3bfb35646b3de753521c28bd1081ba7a777521d9be7aa115c03df3bdb96a3a6eb64dc858ae453db216e1d7af742b61539531ce957e28a68d9f3f77436b609
|
|
7
|
+
data.tar.gz: 5d84be3c077cbf1cbb694fa62229a6ace4bcaeca306c8f0dac64e9213106f02ac3529d108817b27102a9213592755aa62f867660cadf7b1e9630015803efcd1e
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.1.3] - 2024-10-23
|
|
9
|
+
|
|
10
|
+
### ✨ New Features
|
|
11
|
+
- **Collector Identifier** - Added collector field to all API calls to identify SDK version (format: `coolhand-ruby-X.Y.Z`)
|
|
12
|
+
- **Collection Method Tracking** - Support for optional collection method suffix (`manual`, `auto-monitor`)
|
|
13
|
+
|
|
14
|
+
### 🏗️ Internal Improvements
|
|
15
|
+
- **Added Collector Module** - New `Coolhand::Ruby::Collector` module for generating SDK identification strings
|
|
16
|
+
- **Updated ApiService** - Base service now automatically adds collector field to all API payloads
|
|
17
|
+
- **Enhanced Logging** - Both LoggerService and FeedbackService now send collector information
|
|
18
|
+
|
|
8
19
|
## [0.1.2] - 2024-10-22
|
|
9
20
|
|
|
10
21
|
### 🔧 Configuration Improvements
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "net/http"
|
|
4
4
|
require "uri"
|
|
5
5
|
require "json"
|
|
6
|
+
require_relative "collector"
|
|
6
7
|
|
|
7
8
|
module Coolhand
|
|
8
9
|
module Ruby
|
|
@@ -29,6 +30,11 @@ module Coolhand
|
|
|
29
30
|
|
|
30
31
|
protected
|
|
31
32
|
|
|
33
|
+
# Add collector field to the data being sent
|
|
34
|
+
def add_collector_to_data(data, collection_method = nil)
|
|
35
|
+
data.merge(collector: Collector.get_collector_string(collection_method))
|
|
36
|
+
end
|
|
37
|
+
|
|
32
38
|
def create_request_options(_payload)
|
|
33
39
|
{
|
|
34
40
|
"Content-Type" => "application/json",
|
|
@@ -71,9 +77,11 @@ module Coolhand
|
|
|
71
77
|
log("═" * 60) unless silent
|
|
72
78
|
end
|
|
73
79
|
|
|
74
|
-
def create_feedback(feedback)
|
|
80
|
+
def create_feedback(feedback, collection_method = nil)
|
|
81
|
+
feedback_with_collector = add_collector_to_data(feedback, collection_method)
|
|
82
|
+
|
|
75
83
|
payload = {
|
|
76
|
-
llm_request_log_feedback:
|
|
84
|
+
llm_request_log_feedback: feedback_with_collector
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
log_feedback_info(feedback)
|
|
@@ -87,11 +95,11 @@ module Coolhand
|
|
|
87
95
|
result
|
|
88
96
|
end
|
|
89
97
|
|
|
90
|
-
def create_log(captured_data)
|
|
98
|
+
def create_log(captured_data, collection_method = nil)
|
|
99
|
+
raw_request_with_collector = add_collector_to_data({ raw_request: captured_data }, collection_method)
|
|
100
|
+
|
|
91
101
|
payload = {
|
|
92
|
-
llm_request_log:
|
|
93
|
-
raw_request: captured_data
|
|
94
|
-
}
|
|
102
|
+
llm_request_log: raw_request_with_collector
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
log_request_info(captured_data)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Coolhand
|
|
4
|
+
module Ruby
|
|
5
|
+
# Utility for generating collector identification string
|
|
6
|
+
module Collector
|
|
7
|
+
COLLECTION_METHODS = %w[manual auto-monitor].freeze
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
# Gets the collector identification string
|
|
11
|
+
# Format: "coolhand-ruby-X.Y.Z" or "coolhand-ruby-X.Y.Z-method"
|
|
12
|
+
# @param method [String, nil] Optional collection method suffix
|
|
13
|
+
# @return [String] Collector string identifying this SDK version and collection method
|
|
14
|
+
def get_collector_string(method = nil)
|
|
15
|
+
base = "coolhand-ruby-#{VERSION}"
|
|
16
|
+
method && COLLECTION_METHODS.include?(method) ? "#{base}-#{method}" : base
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/coolhand/ruby.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: coolhand
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Carroll
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-
|
|
12
|
+
date: 2025-11-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: A Ruby gem to automatically monitor and log external LLM requests. It
|
|
15
15
|
patches Net::HTTP to capture request and response data.
|
|
@@ -30,6 +30,7 @@ files:
|
|
|
30
30
|
- coolhand-ruby.gemspec
|
|
31
31
|
- lib/coolhand/ruby.rb
|
|
32
32
|
- lib/coolhand/ruby/api_service.rb
|
|
33
|
+
- lib/coolhand/ruby/collector.rb
|
|
33
34
|
- lib/coolhand/ruby/configuration.rb
|
|
34
35
|
- lib/coolhand/ruby/feedback_service.rb
|
|
35
36
|
- lib/coolhand/ruby/interceptor.rb
|