cohere-ruby 0.9.9 → 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/cohere/client.rb +9 -4
- data/lib/cohere/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c5f0625529c315bd0a953bb8e0acf36fbebe685b13decde1fe26d93b5d97ab8
|
4
|
+
data.tar.gz: 504ce83377f6f2175b2d7ab9f899c307a7a02563c75b8c630b249d0e7487c746
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dc8c2c85e551438f597346679c3bb198808e906eb9317dd05c26511556e34f512707cbc4bb3046487de9e498ca7b92c6405d2f9c3e4175f466e49618c7215b9
|
7
|
+
data.tar.gz: 0024a4c8c6091fa78fe83dcd7879ea8a511436e4ddc16929dd3e88e517901ba1ac569e16c519f47abccbba08a0cdd43fe795c4e867b4e252f0d5003a9ffb5b3e
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/cohere/client.rb
CHANGED
@@ -8,12 +8,13 @@ module Cohere
|
|
8
8
|
|
9
9
|
ENDPOINT_URL = "https://api.cohere.ai/v1"
|
10
10
|
|
11
|
-
def initialize(api_key)
|
11
|
+
def initialize(api_key:, timeout: nil)
|
12
12
|
@api_key = api_key
|
13
|
+
@timeout = timeout
|
13
14
|
end
|
14
15
|
|
15
16
|
def chat(
|
16
|
-
message
|
17
|
+
message: nil,
|
17
18
|
model: nil,
|
18
19
|
stream: false,
|
19
20
|
preamble: nil,
|
@@ -29,13 +30,16 @@ module Cohere
|
|
29
30
|
max_tokens: nil,
|
30
31
|
k: nil,
|
31
32
|
p: nil,
|
33
|
+
seed: nil,
|
32
34
|
frequency_penalty: nil,
|
33
35
|
presence_penalty: nil,
|
34
36
|
tools: [],
|
35
37
|
&block
|
36
38
|
)
|
37
39
|
response = connection.post("chat") do |req|
|
38
|
-
req.body = {
|
40
|
+
req.body = {}
|
41
|
+
|
42
|
+
req.body[:message] = message if message
|
39
43
|
req.body[:model] = model if model
|
40
44
|
if stream || block
|
41
45
|
req.body[:stream] = true
|
@@ -54,6 +58,7 @@ module Cohere
|
|
54
58
|
req.body[:max_tokens] = max_tokens if max_tokens
|
55
59
|
req.body[:k] = k if k
|
56
60
|
req.body[:p] = p if p
|
61
|
+
req.body[:seed] = seed if seed
|
57
62
|
req.body[:frequency_penalty] = frequency_penalty if frequency_penalty
|
58
63
|
req.body[:presence_penalty] = presence_penalty if presence_penalty
|
59
64
|
req.body[:tools] = tools if tools
|
@@ -179,7 +184,7 @@ module Cohere
|
|
179
184
|
|
180
185
|
# standard:disable Lint/DuplicateMethods
|
181
186
|
def connection
|
182
|
-
@connection ||= Faraday.new(url: ENDPOINT_URL) do |faraday|
|
187
|
+
@connection ||= Faraday.new(url: ENDPOINT_URL, request: {timeout: @timeout}) do |faraday|
|
183
188
|
if api_key
|
184
189
|
faraday.request :authorization, :Bearer, api_key
|
185
190
|
end
|
data/lib/cohere/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cohere-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Bondarev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|