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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 193fc72a2e4d3c485584250f6f846ba97dbd02f55c357e8bf6f3f95641b669d5
4
- data.tar.gz: 4523f4af59e1a81a7763edd5424e86bec7bd35eb40799af7ad253446d9c86bbe
3
+ metadata.gz: 2e32109fb4ad7c01bf475cf1dbdb33a16a8ccb16ff46e2de3c5fcb0b6424e18e
4
+ data.tar.gz: 55da627d7b73a90195a0d1496cf504b9a46ed28e9f04fa93aff2898929662129
5
5
  SHA512:
6
- metadata.gz: 6d65bfde6461c4f9676a2e0c64de863204e075abae9b762666119bad7676d21ff962e9aeafb3d0420e86ee9d00e0dcda9e266f99dbfc751b289e5e3c91e028cf
7
- data.tar.gz: 48aa86e01741e1a93faec921e65e13a3d434740f91c0c564d22406279d15eab56f60f1aea1bebb5d9c5eb1095200c459b8e728cbd41cc118ee359edfb9eccec1
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: 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
@@ -9,7 +9,9 @@ module Coolhand
9
9
  super("v2/llm_request_log_feedbacks")
10
10
  end
11
11
 
12
- public :create_feedback
12
+ def create_feedback(feedback)
13
+ super(feedback, "manual")
14
+ end
13
15
  end
14
16
  end
15
17
  end
@@ -10,7 +10,7 @@ module Coolhand
10
10
  end
11
11
 
12
12
  def log_to_api(captured_data)
13
- create_log(captured_data)
13
+ create_log(captured_data, "auto-monitor")
14
14
  end
15
15
  end
16
16
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Coolhand
4
4
  module Ruby
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
data/lib/coolhand/ruby.rb CHANGED
@@ -7,6 +7,7 @@ require "securerandom"
7
7
 
8
8
  require_relative "ruby/version"
9
9
  require_relative "ruby/configuration"
10
+ require_relative "ruby/collector"
10
11
  require_relative "ruby/interceptor"
11
12
  require_relative "ruby/api_service"
12
13
  require_relative "ruby/logger_service"
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.2
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-10-22 00:00:00.000000000 Z
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