cohere-ruby 0.9.4 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -9
- data/README.md +7 -1
- data/lib/cohere/client.rb +4 -5
- data/lib/cohere/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: 506af84fa7319c6087e3d3b5c2c3a4c29663d01fda670dd0c66556f49e2fb591
|
4
|
+
data.tar.gz: 455b150a1831b3bfb0a2793dc0de602b4aa3460faddb868ced8050fe347d19c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3146c898ed6d61a010f7876939d116ee78c16c859a9cb9cf7f8206f5795fabd327eb16770cbf7c7a626a102d27efbe570c3a351ed9eae00357b5c90946404641
|
7
|
+
data.tar.gz: 8ceb823d98361cc736a9c31e569cd2453c0ce10b7fcd696ef2ee6cdb07effd8cc2d491cf2d8b4ff97b15214293ddbe3a1ada728ed65563966bdf51035be69b90
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cohere-ruby (0.9.
|
5
|
-
faraday (>=
|
6
|
-
faraday_middleware (>= 1.0.0)
|
4
|
+
cohere-ruby (0.9.6)
|
5
|
+
faraday (>= 2.0.1, < 3.0)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
10
9
|
specs:
|
11
10
|
ast (2.4.2)
|
12
11
|
diff-lcs (1.5.0)
|
13
|
-
faraday (
|
14
|
-
|
15
|
-
ruby2_keywords
|
16
|
-
|
17
|
-
faraday (~> 1.0)
|
12
|
+
faraday (2.7.10)
|
13
|
+
faraday-net_http (>= 2.0, < 3.1)
|
14
|
+
ruby2_keywords (>= 0.0.4)
|
15
|
+
faraday-net_http (3.0.2)
|
18
16
|
json (2.6.3)
|
19
17
|
language_server-protocol (3.17.0.3)
|
20
18
|
lint_roller (1.0.0)
|
21
|
-
multipart-post (2.3.0)
|
22
19
|
parallel (1.23.0)
|
23
20
|
parser (3.2.2.1)
|
24
21
|
ast (~> 2.4.1)
|
@@ -71,6 +68,7 @@ GEM
|
|
71
68
|
|
72
69
|
PLATFORMS
|
73
70
|
x86_64-darwin-19
|
71
|
+
x86_64-darwin-21
|
74
72
|
x86_64-linux
|
75
73
|
|
76
74
|
DEPENDENCIES
|
data/README.md
CHANGED
@@ -8,7 +8,13 @@
|
|
8
8
|
|
9
9
|
Cohere API client for Ruby.
|
10
10
|
|
11
|
-
|
11
|
+
Part of the [Langchain.rb](https://github.com/andreibondarev/langchainrb) stack.
|
12
|
+
|
13
|
+
![Tests status](https://github.com/andreibondarev/cohere-ruby/actions/workflows/ci.yml/badge.svg)
|
14
|
+
[![Gem Version](https://badge.fury.io/rb/cohere-ruby.svg)](https://badge.fury.io/rb/cohere-ruby)
|
15
|
+
[![Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/gems/cohere-ruby)
|
16
|
+
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/andreibondarev/cohere-ruby/blob/main/LICENSE.txt)
|
17
|
+
[![](https://dcbadge.vercel.app/api/server/WDARp7J2n8?compact=true&style=flat)](https://discord.gg/WDARp7J2n8)
|
12
18
|
|
13
19
|
## Installation
|
14
20
|
|
data/lib/cohere/client.rb
CHANGED
@@ -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 Cohere
|
7
6
|
class Client
|
@@ -83,16 +82,16 @@ module Cohere
|
|
83
82
|
response.body
|
84
83
|
end
|
85
84
|
|
86
|
-
def tokenize(text:)
|
85
|
+
def tokenize(text:, model: nil)
|
87
86
|
response = connection.post("tokenize") do |req|
|
88
|
-
req.body = {text: text}
|
87
|
+
req.body = model.nil? ? {text: text} : {text: text, model: model}
|
89
88
|
end
|
90
89
|
response.body
|
91
90
|
end
|
92
91
|
|
93
|
-
def detokenize(tokens:)
|
92
|
+
def detokenize(tokens:, model: nil)
|
94
93
|
response = connection.post("detokenize") do |req|
|
95
|
-
req.body = {tokens: tokens}
|
94
|
+
req.body = model.nil? ? {tokens: tokens} : {tokens: tokens, model: model}
|
96
95
|
end
|
97
96
|
response.body
|
98
97
|
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.6
|
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: faraday
|
@@ -16,28 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
19
|
+
version: 2.0.1
|
20
|
+
- - "<"
|
25
21
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: faraday_middleware
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0.0
|
22
|
+
version: '3.0'
|
34
23
|
type: :runtime
|
35
24
|
prerelease: false
|
36
25
|
version_requirements: !ruby/object:Gem::Requirement
|
37
26
|
requirements:
|
38
27
|
- - ">="
|
39
28
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
29
|
+
version: 2.0.1
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
41
33
|
description: Cohere API client for Ruby.
|
42
34
|
email:
|
43
35
|
- andrei.bondarev13@gmail.com
|