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 +4 -4
- data/README.md +4 -17
- data/lib/voyageai/client.rb +4 -4
- data/lib/voyageai/version.rb +1 -1
- data/lib/voyageai.rb +1 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcd5e858654a8ebb7333cfad429f5aeb8aa2a0ba3fb23da3e70f48a7506143f7
|
4
|
+
data.tar.gz: a3bd1eb7e07deb63f99486f9c3fc79b736f8f9521b354ef3215cecce3718aa29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
24
|
-
|
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).
|
data/lib/voyageai/client.rb
CHANGED
@@ -16,9 +16,9 @@ module VoyageAI
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
# @param api_key [String] optional if ENV['
|
20
|
-
def initialize(api_key: ENV.fetch("
|
21
|
-
@api_key = api_key || raise(ArgumentError, "api_key is required or ENV['
|
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?
|
data/lib/voyageai/version.rb
CHANGED
data/lib/voyageai.rb
CHANGED
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:
|
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.
|
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: []
|