google_palm_api 0.1.1 → 0.1.3
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +6 -28
- data/README.md +7 -1
- data/lib/google_palm_api/client.rb +8 -7
- data/lib/google_palm_api/version.rb +1 -1
- metadata +9 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d910709875d919c62d72f977b29003f0be01cd594e366460bef1435198ef37cc
|
|
4
|
+
data.tar.gz: 4b0a9ea6cf22c0c25d087fcf32887aacdffd0a0f8190c74e6224fbbb30d73caa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b9af87b9228cc0e938532eddc2de1498c069b11c2a7294e956d2e81c9f514e310a2da91f151ccd119fd8ea4b50bd870ae3da4d63612dd1d1b43ba952ea9892a4
|
|
7
|
+
data.tar.gz: a117f38ed0a839937dacfa0742b90412bbdc1c87ac1c3da70a1afa8ab476ac7e6f3bbfe4f116feb0ded41b95c63df18a48add73e38b60b37f2df159aed12cb03
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
google_palm_api (0.1.
|
|
5
|
-
faraday (>=
|
|
6
|
-
faraday_middleware (>= 1.0.0)
|
|
4
|
+
google_palm_api (0.1.3)
|
|
5
|
+
faraday (>= 2.0.1, < 3.0)
|
|
7
6
|
|
|
8
7
|
GEM
|
|
9
8
|
remote: https://rubygems.org/
|
|
@@ -12,36 +11,14 @@ GEM
|
|
|
12
11
|
byebug (11.1.3)
|
|
13
12
|
coderay (1.1.3)
|
|
14
13
|
diff-lcs (1.5.0)
|
|
15
|
-
faraday (
|
|
16
|
-
faraday-
|
|
17
|
-
faraday-em_synchrony (~> 1.0)
|
|
18
|
-
faraday-excon (~> 1.1)
|
|
19
|
-
faraday-httpclient (~> 1.0)
|
|
20
|
-
faraday-multipart (~> 1.0)
|
|
21
|
-
faraday-net_http (~> 1.0)
|
|
22
|
-
faraday-net_http_persistent (~> 1.0)
|
|
23
|
-
faraday-patron (~> 1.0)
|
|
24
|
-
faraday-rack (~> 1.0)
|
|
25
|
-
faraday-retry (~> 1.0)
|
|
14
|
+
faraday (2.7.10)
|
|
15
|
+
faraday-net_http (>= 2.0, < 3.1)
|
|
26
16
|
ruby2_keywords (>= 0.0.4)
|
|
27
|
-
faraday-
|
|
28
|
-
faraday-em_synchrony (1.0.0)
|
|
29
|
-
faraday-excon (1.1.0)
|
|
30
|
-
faraday-httpclient (1.0.1)
|
|
31
|
-
faraday-multipart (1.0.4)
|
|
32
|
-
multipart-post (~> 2)
|
|
33
|
-
faraday-net_http (1.0.1)
|
|
34
|
-
faraday-net_http_persistent (1.2.0)
|
|
35
|
-
faraday-patron (1.0.0)
|
|
36
|
-
faraday-rack (1.0.0)
|
|
37
|
-
faraday-retry (1.0.3)
|
|
38
|
-
faraday_middleware (1.2.0)
|
|
39
|
-
faraday (~> 1.0)
|
|
17
|
+
faraday-net_http (3.0.2)
|
|
40
18
|
json (2.6.3)
|
|
41
19
|
language_server-protocol (3.17.0.3)
|
|
42
20
|
lint_roller (1.0.0)
|
|
43
21
|
method_source (1.0.0)
|
|
44
|
-
multipart-post (2.3.0)
|
|
45
22
|
parallel (1.23.0)
|
|
46
23
|
parser (3.2.2.1)
|
|
47
24
|
ast (~> 2.4.1)
|
|
@@ -100,6 +77,7 @@ GEM
|
|
|
100
77
|
|
|
101
78
|
PLATFORMS
|
|
102
79
|
x86_64-darwin-19
|
|
80
|
+
x86_64-darwin-21
|
|
103
81
|
x86_64-linux
|
|
104
82
|
|
|
105
83
|
DEPENDENCIES
|
data/README.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Ruby API client for the Google PaLM APIs.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Part of the [Langchain.rb](https://github.com/andreibondarev/langchainrb) stack.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
[](https://badge.fury.io/rb/google_palm_api)
|
|
9
|
+
[](http://rubydoc.info/gems/google_palm_api)
|
|
10
|
+
[](https://github.com/andreibondarev/google_palm_api/blob/main/LICENSE.txt)
|
|
11
|
+
[](https://discord.gg/WDARp7J2n8)
|
|
6
12
|
|
|
7
13
|
|
|
8
14
|
## Installation
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "faraday"
|
|
4
|
-
require "faraday_middleware"
|
|
5
4
|
|
|
6
5
|
module GooglePalmApi
|
|
7
6
|
class Client
|
|
@@ -47,9 +46,10 @@ module GooglePalmApi
|
|
|
47
46
|
top_k: nil,
|
|
48
47
|
safety_settings: nil,
|
|
49
48
|
stop_sequences: nil,
|
|
50
|
-
client: nil
|
|
49
|
+
client: nil,
|
|
50
|
+
model: nil
|
|
51
51
|
)
|
|
52
|
-
response = connection.post("/v1beta2/models/#{DEFAULTS[:completion_model_name]}:generateText") do |req|
|
|
52
|
+
response = connection.post("/v1beta2/models/#{model || DEFAULTS[:completion_model_name]}:generateText") do |req|
|
|
53
53
|
req.params = {key: api_key}
|
|
54
54
|
|
|
55
55
|
req.body = {prompt: {text: prompt}}
|
|
@@ -93,10 +93,11 @@ module GooglePalmApi
|
|
|
93
93
|
candidate_count: nil,
|
|
94
94
|
top_p: nil,
|
|
95
95
|
top_k: nil,
|
|
96
|
-
client: nil
|
|
96
|
+
client: nil,
|
|
97
|
+
model: nil
|
|
97
98
|
)
|
|
98
99
|
# Overwrite the default ENDPOINT_URL for this method.
|
|
99
|
-
response = connection.post("/v1beta2/models/#{DEFAULTS[:chat_completion_model_name]}:generateMessage") do |req|
|
|
100
|
+
response = connection.post("/v1beta2/models/#{model || DEFAULTS[:chat_completion_model_name]}:generateMessage") do |req|
|
|
100
101
|
req.params = {key: api_key}
|
|
101
102
|
|
|
102
103
|
req.body = {prompt: {}}
|
|
@@ -165,8 +166,8 @@ module GooglePalmApi
|
|
|
165
166
|
# @param [String] prompt
|
|
166
167
|
# @return [Hash]
|
|
167
168
|
#
|
|
168
|
-
def count_message_tokens(
|
|
169
|
-
response = connection.post("/v1beta2/models/#{model}:countMessageTokens") do |req|
|
|
169
|
+
def count_message_tokens(prompt:, model: nil)
|
|
170
|
+
response = connection.post("/v1beta2/models/#{model || DEFAULTS[:chat_completion_model_name]}:countMessageTokens") do |req|
|
|
170
171
|
req.params = {key: api_key}
|
|
171
172
|
|
|
172
173
|
req.body = {prompt: {messages: [{content: prompt}]}}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google_palm_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrei Bondarev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-08-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pry-byebug
|
|
@@ -30,28 +30,20 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
34
|
-
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
33
|
+
version: 2.0.1
|
|
34
|
+
- - "<"
|
|
39
35
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: faraday_middleware
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ">="
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: 1.0.0
|
|
36
|
+
version: '3.0'
|
|
48
37
|
type: :runtime
|
|
49
38
|
prerelease: false
|
|
50
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
40
|
requirements:
|
|
52
41
|
- - ">="
|
|
53
42
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
43
|
+
version: 2.0.1
|
|
44
|
+
- - "<"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '3.0'
|
|
55
47
|
description: Ruby client for Google PaLM API
|
|
56
48
|
email:
|
|
57
49
|
- andrei.bondarev13@gmail.com
|