voyageai 0.1.0 → 1.0.1
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: 7f4d48a99c21b4d0120511d09b89038e3a6082a145e620fb6ecaf427f0247390
|
4
|
+
data.tar.gz: 4d931a99a02500a3173404b0ec7ada0c9f1a5203f074d09ddd6ef7769a884aed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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: 0.1
|
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.
|
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: []
|