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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9bf458b653b2838e74a859b33401ba09bdccbaa71960015b50a017c89f921f1
4
- data.tar.gz: 4a50722759de44ff44e6bc5f1306d49e158f7551a8faa0d6e0600f42c5d501a2
3
+ metadata.gz: 506af84fa7319c6087e3d3b5c2c3a4c29663d01fda670dd0c66556f49e2fb591
4
+ data.tar.gz: 455b150a1831b3bfb0a2793dc0de602b4aa3460faddb868ced8050fe347d19c2
5
5
  SHA512:
6
- metadata.gz: 89ac1d384eeba3c0754339672569f20192688c3376413f6d19e01083ea08c2b2cf6e1e241d210a0699c077d26e0b5a7a2801eff86d46d98cafba02fc6606c498
7
- data.tar.gz: a9e3cb2e9fdfaf7aa62d85d854e1176365d7f5b6bea7cdbf5113c1b0082459aa9e9f8cea7a78fdb0d7e2bfe6dc491c273949c98acfca73ad5ee580132b966e63
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.4)
5
- faraday (>= 1.0.0)
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 (1.2.0)
14
- multipart-post (>= 1.2, < 3)
15
- ruby2_keywords
16
- faraday_middleware (1.2.0)
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
- ![Tests status](https://github.com/andreibondarev/cohere-ruby/actions/workflows/ci.yml/badge.svg) [![Gem Version](https://badge.fury.io/rb/cohere-ruby.svg)](https://badge.fury.io/rb/cohere-ruby)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cohere
4
- VERSION = "0.9.4"
4
+ VERSION = "0.9.6"
5
5
  end
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
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-05-19 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: faraday
@@ -16,28 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0
20
- type: :runtime
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: 1.0.0
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: 1.0.0
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