google_palm_api 0.1.1 → 0.1.3

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: ac7103e077c1ab4551ab2c296f2eb3d99eb3b7359e59eea1a3b1b4bbdcfea815
4
- data.tar.gz: ce2f516c03358ec6e1b320a333e2b630fd716565ed8c53e48528681a0c74eece
3
+ metadata.gz: d910709875d919c62d72f977b29003f0be01cd594e366460bef1435198ef37cc
4
+ data.tar.gz: 4b0a9ea6cf22c0c25d087fcf32887aacdffd0a0f8190c74e6224fbbb30d73caa
5
5
  SHA512:
6
- metadata.gz: eef61e7eb7981f6f12f5568deb359e5a71c2339d0696e4c6595b5521df9a5bb16649587ba0c773f2c563b9aa9b4d6a44403cf1f2634854f388ce40cf05644486
7
- data.tar.gz: 963774e47464929a32a2dc92247a8ed171eb79efb1b911bd0be25a28bb7396490e627a155f198e45354e42b5e96c15a57974befe4935d1836f2f7d42609048c0
6
+ metadata.gz: b9af87b9228cc0e938532eddc2de1498c069b11c2a7294e956d2e81c9f514e310a2da91f151ccd119fd8ea4b50bd870ae3da4d63612dd1d1b43ba952ea9892a4
7
+ data.tar.gz: a117f38ed0a839937dacfa0742b90412bbdc1c87ac1c3da70a1afa8ab476ac7e6f3bbfe4f116feb0ded41b95c63df18a48add73e38b60b37f2df159aed12cb03
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.2] - 2023-06-20
4
+ - Accept the `model:` param
5
+
3
6
  ## [0.1.1] - 2023-06-09
4
7
  - Fix the `generate_chat_message()`
5
8
 
data/Gemfile.lock CHANGED
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- google_palm_api (0.1.1)
5
- faraday (>= 1.0.0)
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 (1.10.3)
16
- faraday-em_http (~> 1.0)
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-em_http (1.0.0)
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
- ![Tests status](https://github.com/andreibondarev/google_palm_api/actions/workflows/ci.yml/badge.svg) [![Gem Version](https://badge.fury.io/rb/google_palm_api.svg)](https://badge.fury.io/rb/google_palm_api)
5
+ Part of the [Langchain.rb](https://github.com/andreibondarev/langchainrb) stack.
6
+
7
+ ![Tests status](https://github.com/andreibondarev/google_palm_api/actions/workflows/ci.yml/badge.svg)
8
+ [![Gem Version](https://badge.fury.io/rb/google_palm_api.svg)](https://badge.fury.io/rb/google_palm_api)
9
+ [![Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/gems/google_palm_api)
10
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/andreibondarev/google_palm_api/blob/main/LICENSE.txt)
11
+ [![](https://dcbadge.vercel.app/api/server/WDARp7J2n8?compact=true&style=flat)](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(model:, prompt:)
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}]}}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GooglePalmApi
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
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.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-06-09 00:00:00.000000000 Z
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: 1.0.0
34
- type: :runtime
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: 1.0.0
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: 1.0.0
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