boxcars 0.8.0 → 0.8.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: 27e2420c9339daf37e4eb0c63f86fede297cf48931398a33b2a73054900b5288
4
- data.tar.gz: f6fd74d8381fa7905715706d51fafdd179f47c4b021cb57caeacbadb9fdb40a1
3
+ metadata.gz: 842e02d2d8d43ea2a989c5a0b5708022443cf532d7616ab4319a063705f808fa
4
+ data.tar.gz: 0c3349ae1dc50be9984bd440c520a74f2f972151338f1ff23aca5bc47d56837c
5
5
  SHA512:
6
- metadata.gz: 3844edd3c676e68aead5f2a461b401a11a7094d944b66f5b560d03f55a5ca49c936d0ddd8e4f58ac44a32300895c2d34fd5c52adc45fdfc489653b3cf5de2c78
7
- data.tar.gz: f8844a5a5977a7769a495bc16b3bc1d6204501a42106fe2528ec6d60be559c08419eae242a1d3ed8b73c1dc9ff44e94c7f2e4e7dd06413483f4db3a66e299711
6
+ metadata.gz: 68c3560e8e67c59f711c6433ba5950b48e5ecc0d955b039280399c81baf26361bb659eae89660f2180064b8a2ec7cf799bf0950b42cb5bc8c28b224fa6eb6c53
7
+ data.tar.gz: 9f2538a7659b6ab4f236f23fbecb0a594f0ad0778e82b4fc634a2179e355fb40fb5f9ec54f6b9df6cda558a93ca5d2522c950ed8fe454d800cea1db16f5b72ba
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.8.0](https://github.com/BoxcarsAI/boxcars/tree/v0.8.0) (2025-06-03)
4
+
5
+ [Full Changelog](https://github.com/BoxcarsAI/boxcars/compare/v0.7.7...v0.8.0)
6
+
7
+ **Closed issues:**
8
+
9
+ - ActiveRecord translations [\#249](https://github.com/BoxcarsAI/boxcars/issues/249)
10
+ - Any chance of getting AWS Bedrock as a provider? [\#239](https://github.com/BoxcarsAI/boxcars/issues/239)
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Add observability hooks [\#251](https://github.com/BoxcarsAI/boxcars/pull/251) ([francis](https://github.com/francis))
15
+
16
+ ## [v0.7.7](https://github.com/BoxcarsAI/boxcars/tree/v0.7.7) (2025-04-23)
17
+
18
+ [Full Changelog](https://github.com/BoxcarsAI/boxcars/compare/v0.7.6...v0.7.7)
19
+
3
20
  ## [v0.7.6](https://github.com/BoxcarsAI/boxcars/tree/v0.7.6) (2025-04-22)
4
21
 
5
22
  [Full Changelog](https://github.com/BoxcarsAI/boxcars/compare/v0.7.5...v0.7.6)
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boxcars (0.8.0)
4
+ boxcars (0.8.2)
5
+ faraday-retry (~> 2.0)
5
6
  google_search_results (~> 2.2)
6
7
  gpt4all (~> 0.0.5)
7
8
  hnswlib (~> 0.9)
data/README.md CHANGED
@@ -351,17 +351,30 @@ Set up observability by configuring a backend:
351
351
  ```ruby
352
352
  # Using PostHog backend
353
353
  require 'boxcars/observability_backends/posthog_backend'
354
+ require 'posthog'
355
+
356
+ # Create a PostHog client with your desired configuration
357
+ posthog_client = PostHog::Client.new(
358
+ api_key: ENV['POSTHOG_API_KEY'] || 'your_posthog_api_key',
359
+ host: 'https://app.posthog.com', # or your self-hosted instance
360
+ on_error: proc { |status, body|
361
+ Rails.logger.warn "PostHog error: #{status} - #{body}"
362
+ }
363
+ )
354
364
 
355
365
  Boxcars.configure do |config|
356
- config.observability_backend = Boxcars::PosthogBackend.new(
357
- api_key: ENV['POSTHOG_API_KEY'] || 'your_posthog_api_key',
358
- host: 'https://app.posthog.com' # or your self-hosted instance
359
- )
366
+ config.observability_backend = Boxcars::PosthogBackend.new(client: posthog_client)
360
367
  end
361
368
 
362
369
  # Using multiple backends
363
370
  require 'boxcars/observability_backends/multi_backend'
364
- backend1 = Boxcars::PosthogBackend.new(api_key: ENV['POSTHOG_API_KEY'])
371
+
372
+ # Create PostHog client
373
+ posthog_client = PostHog::Client.new(
374
+ api_key: ENV['POSTHOG_API_KEY'],
375
+ host: 'https://app.posthog.com'
376
+ )
377
+ backend1 = Boxcars::PosthogBackend.new(client: posthog_client)
365
378
  backend2 = YourCustomBackend.new
366
379
 
367
380
  Boxcars.configure do |config|
@@ -440,14 +453,18 @@ The PostHog backend requires the `posthog-ruby` gem:
440
453
  gem 'posthog-ruby'
441
454
 
442
455
  # Configure the backend
456
+ require 'posthog'
457
+
458
+ posthog_client = PostHog::Client.new(
459
+ api_key: ENV['POSTHOG_API_KEY'],
460
+ host: 'https://app.posthog.com',
461
+ on_error: proc { |status, body|
462
+ Rails.logger.warn "PostHog error: #{status} - #{body}"
463
+ }
464
+ )
465
+
443
466
  Boxcars.configure do |config|
444
- config.observability_backend = Boxcars::PosthogBackend.new(
445
- api_key: ENV['POSTHOG_API_KEY'],
446
- host: 'https://app.posthog.com',
447
- on_error: proc { |status, body|
448
- Rails.logger.warn "PostHog error: #{status} - #{body}"
449
- }
450
- )
467
+ config.observability_backend = Boxcars::PosthogBackend.new(client: posthog_client)
451
468
  end
452
469
  ```
453
470
 
data/boxcars.gemspec CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.require_paths = ["lib"]
32
32
 
33
33
  # runtime dependencies
34
+ spec.add_dependency "faraday-retry", "~> 2.0"
34
35
  spec.add_dependency "google_search_results", "~> 2.2"
35
36
  spec.add_dependency "gpt4all", "~> 0.0.5"
36
37
  spec.add_dependency "hnswlib", "~> 0.9"
@@ -9,10 +9,13 @@ module Boxcars
9
9
  #
10
10
  # Example Usage:
11
11
  # require 'boxcars/observability_backends/posthog_backend'
12
- # Boxcars::Observability.backend = Boxcars::PosthogBackend.new(
12
+ # require 'posthog'
13
+ #
14
+ # client = PostHog::Client.new(
13
15
  # api_key: 'YOUR_POSTHOG_API_KEY',
14
16
  # host: 'https://app.posthog.com' # or your self-hosted instance
15
17
  # )
18
+ # Boxcars::Observability.backend = Boxcars::PosthogBackend.new(client: client)
16
19
  #
17
20
  # # To track user-specific events, ensure :user_id is present in properties
18
21
  # Boxcars::Observability.track(
@@ -23,32 +26,18 @@ module Boxcars
23
26
  include Boxcars::ObservabilityBackend
24
27
 
25
28
  # Initializes the PosthogBackend.
26
- # Configures the PostHog client with the provided API key and host.
29
+ # Accepts a pre-configured PostHog client instance.
27
30
  #
28
- # @param api_key [String] Your PostHog project API key.
29
- # @param host [String] The PostHog API host. Defaults to 'https://app.posthog.com'.
30
- # @param _personal_api_key [String, nil] Optional: A personal API key for server-side operations if needed.
31
- # @param on_error [Proc, nil] Optional: A lambda/proc to call when an error occurs during event capture.
32
- # It receives the error code and error body as arguments.
33
- # Defaults to a proc that logs the error to stderr.
31
+ # @param client [PostHog::Client] A configured PostHog client instance.
34
32
  # @raise [LoadError] if the 'posthog-ruby' gem is not available.
35
- def initialize(api_key:, host: 'https://app.posthog.com', _personal_api_key: nil, on_error: nil)
33
+ def initialize(client:)
36
34
  begin
37
35
  require 'posthog'
38
36
  rescue LoadError
39
37
  raise LoadError, "The 'posthog-ruby' gem is required to use PosthogBackend. Please add it to your Gemfile."
40
38
  end
41
39
 
42
- @on_error_proc = on_error || proc do |status, body|
43
- Boxcars.error("PostHog error: Status #{status}, Body: #{body}", :red)
44
- end
45
-
46
- # The posthog-ruby gem uses a simpler API
47
- @posthog_client = PostHog::Client.new(
48
- api_key:,
49
- host:,
50
- on_error: @on_error_proc
51
- )
40
+ @posthog_client = client
52
41
  end
53
42
 
54
43
  # Tracks an event with PostHog.
@@ -115,8 +115,7 @@ else
115
115
  module VectorStore
116
116
  module Pgvector
117
117
  class PgvectorNotAvailableError < StandardError
118
- DEFAULT_MESSAGE = "The 'pgvector' and 'pg' gems are required. Please add them to your Gemfile."
119
- def initialize(message = DEFAULT_MESSAGE)
118
+ def initialize(message = "The 'pgvector' and 'pg' gems are required. Please add them to your Gemfile.")
120
119
  super
121
120
  end
122
121
  end
@@ -103,8 +103,7 @@ else
103
103
  module VectorStore
104
104
  module Pgvector
105
105
  class PgvectorNotAvailableError < StandardError
106
- DEFAULT_MESSAGE = "The 'pgvector' and 'pg' gems are required. Please add them to your Gemfile."
107
- def initialize(message = DEFAULT_MESSAGE)
106
+ def initialize(message = "The 'pgvector' and 'pg' gems are required. Please add them to your Gemfile.")
108
107
  super
109
108
  end
110
109
  end
@@ -155,8 +155,7 @@ else
155
155
  module VectorStore
156
156
  module Pgvector
157
157
  class PgvectorNotAvailableError < StandardError
158
- DEFAULT_MESSAGE = "The 'pgvector' and 'pg' gems are required. Please add them to your Gemfile."
159
- def initialize(message = DEFAULT_MESSAGE)
158
+ def initialize(message = "The 'pgvector' and 'pg' gems are required. Please add them to your Gemfile.")
160
159
  super
161
160
  end
162
161
  end
@@ -167,8 +167,7 @@ else
167
167
  module VectorStore
168
168
  module Pgvector
169
169
  class PgvectorNotAvailableError < StandardError
170
- DEFAULT_MESSAGE = "The 'pgvector' and 'pg' gems are required. Please add them to your Gemfile."
171
- def initialize(message = DEFAULT_MESSAGE)
170
+ def initialize(message = "The 'pgvector' and 'pg' gems are required. Please add them to your Gemfile.")
172
171
  super
173
172
  end
174
173
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Boxcars
4
4
  # The current version of the gem.
5
- VERSION = "0.8.0"
5
+ VERSION = "0.8.2"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxcars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francis Sullivan
@@ -10,6 +10,20 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday-retry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: google_search_results
15
29
  requirement: !ruby/object:Gem::Requirement