payloop 0.0.1 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8afd4c12089fbda44abae722ada80ee75413b18d043aa7c8b5ab23b4c77e15c8
4
- data.tar.gz: 7b9b9bc476434ef3c4b83dde77cde3ec0a506627324b1275decbdce16ba5ee42
3
+ metadata.gz: f4dd3be8a2eac5f3cda3b04fbc7d73d2fa6c9b4f35d640840a90f6a872e90a58
4
+ data.tar.gz: e348e027345bc09b1233e976c38871747410d3caccac959fc119c49143f14df4
5
5
  SHA512:
6
- metadata.gz: a07580586b5a649a60c6eb1dd7823de6f33af0243379b11517225db7546b8b87cd8ad3bea690ce626628d3117f78aecc2faf46dbf3e3a51378234d2045409d28
7
- data.tar.gz: ca34c48b13d65ac23d9b65a0217bc66d0b0e7b548c6395c7f3f2e9da805d4d242c3f9590b2f0650639d2cacf74144368f951e74bd1af98a4eb35f3146a0da165
6
+ metadata.gz: 6d030e46f95833e825651eb0c11e23116eff4f542b10784e96aff2031892c408294115bfae3c5544f37a25b32d4435092d5b17940373f4b0968a2684657611c7
7
+ data.tar.gz: dc86258b883762641d561b39261bbfc0b66b494f15f5d891446e00b4d786434f5684986d01d7bfb69c989a7db54991e290656fc04b59429c1ff8dad6c034c28d
data/CHANGELOG.md CHANGED
@@ -20,3 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
20
  - Streaming response support
21
21
  - Thread-safe configuration
22
22
  - Comprehensive error handling
23
+
24
+ ## [0.0.2] - 2025-10-25
25
+
26
+ ### Fixed
27
+ - Corrected Payloop request payload structure as needed
data/README.md CHANGED
@@ -27,3 +27,54 @@ Our SDK reference provides documentation for:
27
27
  - Code samples to illustrate our SDK and API
28
28
 
29
29
  Check it out here: [developers.trypayloop.com](https://developers.trypayloop.com)
30
+
31
+ # Releasing a New Version
32
+
33
+ To release a new version of the Payloop Ruby gem (e.g., version 0.0.2):
34
+
35
+ 1. **Update the version number** in [lib/payloop/version.rb](lib/payloop/version.rb):
36
+ ```ruby
37
+ VERSION = "0.0.2"
38
+ ```
39
+
40
+ 2. **Update the CHANGELOG** in [CHANGELOG.md](CHANGELOG.md):
41
+ - Add a new section for the version with today's date
42
+ - Document all changes under appropriate categories (Added, Changed, Fixed, etc.)
43
+ - Follow the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format
44
+
45
+ 3. **Commit your changes**:
46
+ ```bash
47
+ git add lib/payloop/version.rb CHANGELOG.md
48
+ git commit -m "Bump version to 0.0.2"
49
+ ```
50
+
51
+ 4. **Run tests and linting** to ensure everything passes:
52
+ ```bash
53
+ bundle exec rake
54
+ ```
55
+
56
+ 5. **Create a git tag** for the release:
57
+ ```bash
58
+ git tag -a v0.0.2 -m "Release version 0.0.2"
59
+ ```
60
+
61
+ 6. **Push changes and tags** to GitHub:
62
+ ```bash
63
+ git push origin main
64
+ git push origin v0.0.2
65
+ ```
66
+
67
+ 7. **Build and release the gem** to RubyGems:
68
+ ```bash
69
+ bundle exec rake build
70
+ bundle exec rake release
71
+ ```
72
+
73
+ Note: You'll need RubyGems credentials configured. The `rake release` task will:
74
+ - Build the gem
75
+ - Push it to RubyGems.org
76
+ - Create a GitHub release (if configured)
77
+
78
+ 8. **Verify the release**:
79
+ - Check [rubygems.org/gems/payloop](https://rubygems.org/gems/payloop) to confirm the new version is published
80
+ - Test installation: `gem install payloop -v 0.0.2`
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Payloop
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "constants"
4
+
3
5
  module Payloop
4
6
  module Wrappers
5
7
  # Wrapper for Anthropic Ruby client
@@ -64,13 +66,13 @@ module Payloop
64
66
 
65
67
  # Submit analytics
66
68
  payloop_submit_analytics(
67
- provider: "anthropic",
68
69
  method: :create,
69
70
  args: args,
70
71
  kwargs: params,
71
72
  response: response,
72
73
  start_time: start_time,
73
- end_time: Time.now
74
+ end_time: Time.now,
75
+ title: ANTHROPIC_CLIENT_TITLE
74
76
  )
75
77
 
76
78
  response
@@ -78,13 +80,13 @@ module Payloop
78
80
  params = kwargs.any? ? kwargs : (args.first || {})
79
81
 
80
82
  payloop_submit_error_analytics(
81
- provider: "anthropic",
82
83
  method: :create,
83
84
  args: args,
84
85
  kwargs: params,
85
86
  error: e,
86
87
  start_time: start_time,
87
- end_time: Time.now
88
+ end_time: Time.now,
89
+ title: ANTHROPIC_CLIENT_TITLE
88
90
  )
89
91
 
90
92
  raise e
@@ -19,7 +19,6 @@ module Payloop
19
19
 
20
20
  # Submit analytics asynchronously
21
21
  payloop_submit_analytics(
22
- provider: provider_name,
23
22
  method: method_name,
24
23
  args: args,
25
24
  kwargs: kwargs,
@@ -32,7 +31,6 @@ module Payloop
32
31
  rescue StandardError => e
33
32
  # Submit error analytics
34
33
  payloop_submit_error_analytics(
35
- provider: provider_name,
36
34
  method: method_name,
37
35
  args: args,
38
36
  kwargs: kwargs,
@@ -45,39 +43,41 @@ module Payloop
45
43
  end
46
44
  end
47
45
 
48
- def payloop_submit_analytics(provider:, method:, args:, kwargs:, response:, start_time:, end_time:)
46
+ def payloop_submit_analytics(method:, args:, kwargs:, response:, start_time:, end_time:, provider: nil, title: nil)
49
47
  collector = instance_variable_get(:@payloop_collector)
50
48
  config = instance_variable_get(:@payloop_config)
51
49
 
52
50
  return unless collector && config
53
51
 
54
52
  payload = build_payload(
55
- provider: provider,
56
53
  query: extract_query(method, args, kwargs),
57
54
  response: extract_response(response),
58
55
  start_time: start_time,
59
56
  end_time: end_time,
60
57
  config: config,
61
- status: "succeeded"
58
+ status: "succeeded",
59
+ provider: provider,
60
+ title: title
62
61
  )
63
62
 
64
63
  collector.submit_async(payload)
65
64
  end
66
65
 
67
- def payloop_submit_error_analytics(provider:, method:, args:, kwargs:, error:, start_time:, end_time:)
66
+ def payloop_submit_error_analytics(method:, args:, kwargs:, error:, start_time:, end_time:, provider: nil, title: nil)
68
67
  collector = instance_variable_get(:@payloop_collector)
69
68
  config = instance_variable_get(:@payloop_config)
70
69
 
71
70
  return unless collector && config
72
71
 
73
72
  payload = build_payload(
74
- provider: provider,
75
73
  query: extract_query(method, args, kwargs),
76
74
  response: { error: error.message, class: error.class.name },
77
75
  start_time: start_time,
78
76
  end_time: end_time,
79
77
  config: config,
80
78
  status: "failed",
79
+ provider: provider,
80
+ title: title,
81
81
  exception: error.message
82
82
  )
83
83
 
@@ -122,13 +122,13 @@ module Payloop
122
122
  end
123
123
  end
124
124
 
125
- def build_payload(provider:, query:, response:, start_time:, end_time:, config:, status:, exception: nil)
125
+ def build_payload(query:, response:, start_time:, end_time:, config:, status:, provider: nil, title: nil, exception: nil)
126
126
  {
127
127
  attribution: config.attribution&.to_h,
128
128
  conversation: {
129
129
  client: {
130
130
  provider: provider,
131
- title: provider,
131
+ title: title,
132
132
  version: nil
133
133
  },
134
134
  query: query,
@@ -148,8 +148,8 @@ module Payloop
148
148
  }
149
149
  },
150
150
  time: {
151
- start: start_time.iso8601(3),
152
- end: end_time.iso8601(3)
151
+ start: start_time.to_f,
152
+ end: end_time.to_f
153
153
  },
154
154
  tx: {
155
155
  uuid: config.tx_uuid
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Payloop
4
+ module Wrappers
5
+ # Client title constants for analytics
6
+ OPENAI_CLIENT_TITLE = "openai"
7
+ ANTHROPIC_CLIENT_TITLE = "anthropic"
8
+ GOOGLE_CLIENT_TITLE = "google"
9
+ end
10
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "constants"
4
+
3
5
  module Payloop
4
6
  module Wrappers
5
7
  # Wrapper for Google GenerativeAI Ruby client
@@ -65,13 +67,13 @@ module Payloop
65
67
 
66
68
  # Submit analytics
67
69
  payloop_submit_analytics(
68
- provider: "google",
69
70
  method: :generate_content,
70
71
  args: args,
71
72
  kwargs: params,
72
73
  response: response,
73
74
  start_time: start_time,
74
- end_time: Time.now
75
+ end_time: Time.now,
76
+ title: GOOGLE_CLIENT_TITLE
75
77
  )
76
78
 
77
79
  response
@@ -79,13 +81,13 @@ module Payloop
79
81
  params = kwargs.any? ? kwargs : (args.first || {})
80
82
 
81
83
  payloop_submit_error_analytics(
82
- provider: "google",
83
84
  method: :generate_content,
84
85
  args: args,
85
86
  kwargs: params,
86
87
  error: e,
87
88
  start_time: start_time,
88
- end_time: Time.now
89
+ end_time: Time.now,
90
+ title: GOOGLE_CLIENT_TITLE
89
91
  )
90
92
 
91
93
  raise e
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "constants"
4
+
3
5
  module Payloop
4
6
  module Wrappers
5
7
  # Wrapper for OpenAI Ruby client (ruby-openai gem)
@@ -48,25 +50,25 @@ module Payloop
48
50
 
49
51
  # Submit analytics
50
52
  payloop_submit_analytics(
51
- provider: "openai",
52
53
  method: :chat,
53
54
  args: [],
54
- kwargs: { parameters: parameters },
55
+ kwargs: parameters,
55
56
  response: response,
56
57
  start_time: start_time,
57
- end_time: Time.now
58
+ end_time: Time.now,
59
+ title: OPENAI_CLIENT_TITLE
58
60
  )
59
61
 
60
62
  response
61
63
  rescue StandardError => e
62
64
  payloop_submit_error_analytics(
63
- provider: "openai",
64
65
  method: :chat,
65
66
  args: [],
66
- kwargs: { parameters: parameters },
67
+ kwargs: parameters,
67
68
  error: e,
68
69
  start_time: start_time,
69
- end_time: Time.now
70
+ end_time: Time.now,
71
+ title: OPENAI_CLIENT_TITLE
70
72
  )
71
73
 
72
74
  raise e
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payloop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Payloop
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-14 00:00:00.000000000 Z
11
+ date: 2025-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -47,6 +47,7 @@ files:
47
47
  - lib/payloop/version.rb
48
48
  - lib/payloop/wrappers/anthropic.rb
49
49
  - lib/payloop/wrappers/base.rb
50
+ - lib/payloop/wrappers/constants.rb
50
51
  - lib/payloop/wrappers/google.rb
51
52
  - lib/payloop/wrappers/openai.rb
52
53
  homepage: https://trypayloop.com