voyageai 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e168ee217dd0d4a6bd9ac0f220369bddc558d15cb157187d725f4ee4a2340d2
4
- data.tar.gz: f2a891d5dcb4654f7ac9143eb0e6d95bd800f77b39d0acdcd38c05616a2c4cde
3
+ metadata.gz: bcd5e858654a8ebb7333cfad429f5aeb8aa2a0ba3fb23da3e70f48a7506143f7
4
+ data.tar.gz: a3bd1eb7e07deb63f99486f9c3fc79b736f8f9521b354ef3215cecce3718aa29
5
5
  SHA512:
6
- metadata.gz: fe1eaccbf9d80eb5a33dcb407f9bd6e2bc578a8bbdc5627c5aeaededde53493cb17f97fb07992e671151aad576ed39ee82b093330ab932c5cf0360e4d2ab6b12
7
- data.tar.gz: 7ef2238c0073848e4d9bfcebda47d271806d1bde7801ffc180a7654f82f5d24b0bd3ecbd38a9a017ff04540cdc4057df4724d5a2b6b80b352ff3093533f10f8a
6
+ metadata.gz: 82c44122fc6e8f1a6f16de5613b9c255204f35f476ddab38518273061ae0de2e86a6aa67d1e27ab2c669266e0a552e97e2ebb11b6a59eebd190cf815972d871b
7
+ data.tar.gz: 915f40cb8faf4d4c8b1ae962b3350aa2d6e21090fbc52191553645116d5c8aca3740cd6d97e817894df20c331bcbaa546347330abae888f6932287a51e61c5a2
data/README.md CHANGED
@@ -20,25 +20,12 @@ input = [
20
20
  'Ringo is a doctor.',
21
21
  ]
22
22
 
23
- voyage_ai = VoyageAI::Client.new(api_key: 'pa-...')
24
- result = voyage_ai.embed(input)
23
+ voyageai = VoyageAI::Client.new(api_key: 'pa-...') # or configure ENV['VOYAGEAI_API_KEY']
24
+
25
+ result = voyageai.embed(input)
25
26
  embed.model # "..."
26
27
  embed.usage # "#<VoyageAI::Usage total_tokens=...>"
27
28
  embed.embeddings.each do |embedding|
28
- embedding # "#<VoyageAI::Embedding index=... embedding=...>
29
+ embedding.index # "#<VoyageAI::Embedding index=... embedding=...>
29
30
  end
30
31
  ```
31
-
32
- ## Development
33
-
34
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
-
36
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
-
38
- ## Contributing
39
-
40
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/voyageai.
41
-
42
- ## License
43
-
44
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -16,9 +16,9 @@ module VoyageAI
16
16
  end
17
17
  end
18
18
 
19
- # @param api_key [String] optional if ENV['VOYAGE_API_KEY'] otherwise required
20
- def initialize(api_key: ENV.fetch("VOYAGE_API_KEY", nil))
21
- @api_key = api_key || raise(ArgumentError, "api_key is required or ENV['VOYAGE_API_KEY'] must be present")
19
+ # @param api_key [String] optional if ENV['VOYAGEAI_API_KEY'] otherwise required
20
+ def initialize(api_key: ENV.fetch("VOYAGEAI_API_KEY", nil))
21
+ @api_key = api_key || raise(ArgumentError, "api_key is required or ENV['VOYAGEAI_API_KEY'] must be present")
22
22
  end
23
23
 
24
24
  # @return [String]
@@ -36,7 +36,7 @@ module VoyageAI
36
36
  payload = { input: input, model: model }
37
37
  response = HTTP
38
38
  .accept(:json)
39
- .auth(@api_key)
39
+ .auth("Bearer #{@api_key}")
40
40
  .post("#{BASE_URL}/embeddings", json: payload)
41
41
 
42
42
  raise RequestError.new(response:) unless response.status.ok?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VoyageAI
4
- VERSION = "0.1.0"
4
+ VERSION = "1.0.0"
5
5
  end
data/lib/voyageai.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "http"
3
4
  require "zeitwerk"
4
5
 
5
6
  loader = Zeitwerk::Loader.for_gem
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voyageai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2024-10-21 00:00:00.000000000 Z
@@ -63,7 +63,7 @@ metadata:
63
63
  homepage_uri: https://github.com/ksylvest/voyageai.
64
64
  changelog_uri: https://github.com/ksylvest/voyageai./releases
65
65
  rubygems_mfa_required: 'true'
66
- post_install_message:
66
+ post_install_message:
67
67
  rdoc_options: []
68
68
  require_paths:
69
69
  - lib
@@ -78,8 +78,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  requirements: []
81
- rubygems_version: 3.5.21
82
- signing_key:
81
+ rubygems_version: 3.5.18
82
+ signing_key:
83
83
  specification_version: 4
84
84
  summary: A client for voyageai.com.
85
85
  test_files: []