voyageai 1.9.0 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3002d46824400801c3bc3b3cefbfe23eceb0b2ec2198810d5712603e7cf39e6e
4
- data.tar.gz: 911cadc4563577b7a061e7a652ee448d1b3933c4ca029b3aa5184d8d0b3a7d89
3
+ metadata.gz: c27601209931d7d10233d8f393062f7557c28ebc00a8f33eaa6ffb913f27b5a5
4
+ data.tar.gz: 318f2b420d9c9bb08c9889e3984e22c4271858108d1358c93725d145c17dd768
5
5
  SHA512:
6
- metadata.gz: 2a0664a0a04f1290771916205d756b94636baf4ac17a6ebf9e5bf0a548a66b67b57b4677b97c006f59470ce4469f74974240ca382d15506d53ae525ee2e732d4
7
- data.tar.gz: 7676b2198a0076ee2b79a6997c9db0e37c0454e99e8546874cb98e6a73d2e8518a7d9b838a98e06fd489e6c0af5cc59a1a1e145166863a9792a7cd67274ea25f
6
+ metadata.gz: fb5305ab85051d96c4a191f182591da995ed7cf66bcef8796ad15f2951f4d30189552f83c1cf1a57dd5ad9749a1c12967bf583b91012762fa967e1eb86ca10d9
7
+ data.tar.gz: 4b243b996203a88fa47939b9429368d255d792c87a98b84fd3b952c5e89d3554077a6b5cba3cf91f6c6ba42cc57a5e42d59c6e8c83a2500c6635d86bed9cdb8a
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ source "https://rubygems.org"
5
5
  gemspec
6
6
 
7
7
  gem "factory_bot"
8
+ gem "logger"
8
9
  gem "rake"
9
10
  gem "rspec"
10
11
  gem "rspec_junit_formatter"
data/README.md CHANGED
@@ -27,7 +27,7 @@ input = 'A quick brown fox jumps over the lazy dog.'
27
27
 
28
28
  voyageai = VoyageAI::Client.new(api_key: 'pa-...') # or configure ENV['VOYAGEAI_API_KEY']
29
29
 
30
- embed = voyageai.emed(input)
30
+ embed = voyageai.embed(input)
31
31
  embed.model # "..."
32
32
  embed.usage # "#<VoyageAI::Usage total_tokens=...>"
33
33
  embed.embedding # [0.0, ...]
@@ -14,7 +14,7 @@ module VoyageAI
14
14
  end
15
15
  end
16
16
 
17
- # @param api_key [String] optional if ENV['VOYAGEAI_API_KEY'] otherwise required
17
+ # @param api_key [String] optional if `ENV['VOYAGEAI_API_KEY']` otherwise required
18
18
  # @param host [String] optional
19
19
  # @param version [String] optional
20
20
  # @param logger [Logger] optional
@@ -36,7 +36,7 @@ module VoyageAI
36
36
  attr_accessor :timeout
37
37
 
38
38
  # @param api_key [String] optional - defaults to `ENV['VOYAGE_API_KEY']`
39
- # @param host [String] optional - defaults to `ENV['VOYAGEAI_HOST']`` w/ fallback to `https://api.voyageai.com`
39
+ # @param host [String] optional - defaults to `ENV['VOYAGEAI_HOST']` w/ fallback to `https://api.voyageai.com`
40
40
  # @param version [String] optional - defaults to `ENV['DEFAULT_VERSION']` w/ fallback to `v1`
41
41
  # @param logger [Logger] optional
42
42
  # @param timeout [Integer] optional
@@ -10,25 +10,36 @@ module VoyageAI
10
10
 
11
11
  # @param name [String]
12
12
  # @param payload [Hash]
13
- # @option payload [Exception] :error
13
+ #
14
+ # @return [Object]
14
15
  def instrument(name, payload = {})
15
- error = payload[:error]
16
- return unless error
17
-
18
- @logger.error("#{name}: #{error.message}")
16
+ start(name, payload)
17
+ yield(payload) if block_given?
18
+ ensure
19
+ finish(name, payload)
19
20
  end
20
21
 
22
+ # @example
23
+ # instrumenter.start("request.http", request: request)
24
+ #
21
25
  # @param payload [Hash]
22
26
  # @option payload [HTTP::Request] :request
23
27
  def start(_, payload)
24
28
  request = payload[:request]
29
+ return unless request
30
+
25
31
  @logger.info("#{request.verb.upcase} #{request.uri}")
26
32
  end
27
33
 
34
+ # @example
35
+ # instrumenter.finish("request.http", response: response)
36
+ #
28
37
  # @param payload [Hash]
29
38
  # @option payload [HTTP::Response] :response
30
39
  def finish(_, payload)
31
40
  response = payload[:response]
41
+ return unless response
42
+
32
43
  @logger.info("#{response.status.code} #{response.status.reason}")
33
44
  end
34
45
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VoyageAI
4
- VERSION = "1.9.0"
4
+ VERSION = "2.0.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voyageai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-20 00:00:00.000000000 Z
10
+ date: 2026-08-01 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: http
@@ -64,8 +64,8 @@ licenses:
64
64
  metadata:
65
65
  rubygems_mfa_required: 'true'
66
66
  homepage_uri: https://github.com/ksylvest/voyageai
67
- source_code_uri: https://github.com/ksylvest/voyageai/tree/v1.9.0
68
- changelog_uri: https://github.com/ksylvest/voyageai/releases/tag/v1.9.0
67
+ source_code_uri: https://github.com/ksylvest/voyageai/tree/v2.0.0
68
+ changelog_uri: https://github.com/ksylvest/voyageai/releases/tag/v2.0.0
69
69
  documentation_uri: https://voyageai.ksylvest.com/
70
70
  rdoc_options: []
71
71
  require_paths:
@@ -74,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - ">="
76
76
  - !ruby/object:Gem::Version
77
- version: 3.2.0
77
+ version: 3.3.0
78
78
  required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="