voyageai 0.1.0 → 1.0.1

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: 0e168ee217dd0d4a6bd9ac0f220369bddc558d15cb157187d725f4ee4a2340d2
4
- data.tar.gz: f2a891d5dcb4654f7ac9143eb0e6d95bd800f77b39d0acdcd38c05616a2c4cde
3
+ metadata.gz: 7f4d48a99c21b4d0120511d09b89038e3a6082a145e620fb6ecaf427f0247390
4
+ data.tar.gz: 4d931a99a02500a3173404b0ec7ada0c9f1a5203f074d09ddd6ef7769a884aed
5
5
  SHA512:
6
- metadata.gz: fe1eaccbf9d80eb5a33dcb407f9bd6e2bc578a8bbdc5627c5aeaededde53493cb17f97fb07992e671151aad576ed39ee82b093330ab932c5cf0360e4d2ab6b12
7
- data.tar.gz: 7ef2238c0073848e4d9bfcebda47d271806d1bde7801ffc180a7654f82f5d24b0bd3ecbd38a9a017ff04540cdc4057df4724d5a2b6b80b352ff3093533f10f8a
6
+ metadata.gz: 4f559800105a83db3479237cfa5c2fcd576d609a15a3d88dfc8f448750ee4fd2189abf6ce11d039f2879958b8ba418e00e214b850ce357487a562a4e13fc1f9f
7
+ data.tar.gz: 8cfaf28bcc73fc5540a17cf857c2458dc4197e4d452e0cd2dbdd409e6d1024992f1eb22998a19ca5733cb7ae3c2208863f71d66b475c60084cba749c9d9b5dab
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.1"
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.1
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: []