nano-bots 3.0.1 → 3.1.0

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: 41b143719bce07dca70e81c3117e2e2c4778f7c336e6e5932fec4334985f134c
4
- data.tar.gz: 3bca5d654a4bbd0b32aa6ee2285340d20ed1fad1d1e1ccfa28757ca87b2f88d1
3
+ metadata.gz: 2e12fcee02d6989ee95b464eb0f7bf6f7da9a72e45cabae5aa97b08ce808f500
4
+ data.tar.gz: b6e6b6c53be1de5c990b07a0ecceae22378edd01c8a4db1825c030a8757aed15
5
5
  SHA512:
6
- metadata.gz: cc3a6927771552a866057a374667a767875073451b952bcb15254b3f8b59647c929dd911924cbb6f6f7430d68d6bca206fac0697711cd312d69b466d635e7971
7
- data.tar.gz: 9d398668b9bca96cc19ccbd4c6a94cb559108a7fe972ec4b49e84f30cd2eb26e65b67c1e10e3c9d1082b1d2257b6342ee48d0471555c038bfcead622d5853bfb
6
+ metadata.gz: b4869bdde28e1e84f86a2c44adabb92b3265d64ad5b232dbe0dfe93d1953826145548276268b2bca915930da5e2f8104e69411c35924e20d47b98331fca19a3e
7
+ data.tar.gz: 6a853ba120e634cbe35e6c721a7681a614ba3688a76108fea6f0141014d928e8993760b99642facfafe78c55f1bcbb62cad34569b27912bd6598515395588d65
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ gemspec
6
6
 
7
7
  group :test, :development do
8
8
  gem 'pry-byebug', '~> 3.10', '>= 3.10.1'
9
- gem 'rspec', '~> 3.12'
10
- gem 'rubocop', '~> 1.59'
11
- gem 'rubocop-rspec', '~> 2.26', '>= 2.26.1'
9
+ gem 'rspec', '~> 3.13'
10
+ gem 'rubocop', '~> 1.63', '>= 1.63.5'
11
+ gem 'rubocop-rspec', '~> 2.29', '>= 2.29.2'
12
12
  end
data/Gemfile.lock CHANGED
@@ -1,21 +1,24 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nano-bots (3.0.1)
4
+ nano-bots (3.1.0)
5
5
  babosa (~> 2.0)
6
- cohere-ai (~> 1.0, >= 1.0.2)
7
- concurrent-ruby (~> 1.2, >= 1.2.2)
8
- dotenv (~> 2.8, >= 2.8.1)
9
- gemini-ai (~> 3.1, >= 3.1.3)
10
- maritaca-ai (~> 1.0, >= 1.0.1)
11
- mistral-ai (~> 1.1, >= 1.1.2)
12
- ollama-ai (~> 1.0, >= 1.0.1)
6
+ cohere-ai (~> 1.1)
7
+ concurrent-ruby (~> 1.2, >= 1.2.3)
8
+ dotenv (~> 3.1, >= 3.1.2)
9
+ faraday (~> 2.9)
10
+ faraday-typhoeus (~> 1.1)
11
+ gemini-ai (~> 4.0)
12
+ maritaca-ai (~> 1.2)
13
+ mistral-ai (~> 1.2)
14
+ ollama-ai (~> 1.2, >= 1.2.1)
13
15
  pry (~> 0.14.2)
14
16
  rainbow (~> 3.1, >= 3.1.1)
15
17
  rbnacl (~> 7.1, >= 7.1.1)
16
18
  redcarpet (~> 3.6)
17
- ruby-openai (~> 6.3, >= 6.3.1)
19
+ ruby-openai (~> 7.0, >= 7.0.1)
18
20
  sweet-moon (~> 0.0.7)
21
+ typhoeus (~> 1.4, >= 1.4.1)
19
22
 
20
23
  GEM
21
24
  remote: https://rubygems.org/
@@ -24,13 +27,17 @@ GEM
24
27
  public_suffix (>= 2.0.2, < 6.0)
25
28
  ast (2.4.2)
26
29
  babosa (2.0.0)
30
+ base64 (0.2.0)
27
31
  byebug (11.1.3)
28
32
  coderay (1.1.3)
29
- cohere-ai (1.0.2)
33
+ cohere-ai (1.1.0)
30
34
  faraday (~> 2.9)
31
- concurrent-ruby (1.2.2)
32
- diff-lcs (1.5.0)
33
- dotenv (2.8.1)
35
+ faraday-typhoeus (~> 1.1)
36
+ concurrent-ruby (1.2.3)
37
+ diff-lcs (1.5.1)
38
+ dotenv (3.1.2)
39
+ ethon (0.16.0)
40
+ ffi (>= 1.15.0)
34
41
  event_stream_parser (1.0.0)
35
42
  faraday (2.9.0)
36
43
  faraday-net_http (>= 2.0, < 3.2)
@@ -38,38 +45,48 @@ GEM
38
45
  multipart-post (~> 2)
39
46
  faraday-net_http (3.1.0)
40
47
  net-http
48
+ faraday-typhoeus (1.1.0)
49
+ faraday (~> 2.0)
50
+ typhoeus (~> 1.4)
41
51
  ffi (1.16.3)
42
- gemini-ai (3.1.3)
52
+ gemini-ai (4.0.0)
43
53
  event_stream_parser (~> 1.0)
44
54
  faraday (~> 2.9)
55
+ faraday-typhoeus (~> 1.1)
45
56
  googleauth (~> 1.8)
46
- google-cloud-env (2.1.0)
57
+ typhoeus (~> 1.4, >= 1.4.1)
58
+ google-cloud-env (2.1.1)
47
59
  faraday (>= 1.0, < 3.a)
48
- googleauth (1.9.1)
60
+ googleauth (1.11.0)
49
61
  faraday (>= 1.0, < 3.a)
50
62
  google-cloud-env (~> 2.1)
51
63
  jwt (>= 1.4, < 3.0)
52
64
  multi_json (~> 1.11)
53
65
  os (>= 0.9, < 2.0)
54
66
  signet (>= 0.16, < 2.a)
55
- json (2.7.1)
56
- jwt (2.7.1)
67
+ json (2.7.2)
68
+ jwt (2.8.1)
69
+ base64
57
70
  language_server-protocol (3.17.0.3)
58
- maritaca-ai (1.0.1)
71
+ maritaca-ai (1.2.0)
72
+ event_stream_parser (~> 1.0)
59
73
  faraday (~> 2.9)
60
- method_source (1.0.0)
61
- mistral-ai (1.1.2)
74
+ faraday-typhoeus (~> 1.1)
75
+ method_source (1.1.0)
76
+ mistral-ai (1.2.0)
62
77
  event_stream_parser (~> 1.0)
63
78
  faraday (~> 2.9)
79
+ faraday-typhoeus (~> 1.1)
64
80
  multi_json (1.15.0)
65
- multipart-post (2.3.0)
81
+ multipart-post (2.4.1)
66
82
  net-http (0.4.1)
67
83
  uri
68
- ollama-ai (1.0.1)
84
+ ollama-ai (1.2.1)
69
85
  faraday (~> 2.9)
86
+ faraday-typhoeus (~> 1.1)
70
87
  os (1.1.4)
71
88
  parallel (1.24.0)
72
- parser (3.3.0.3)
89
+ parser (3.3.1.0)
73
90
  ast (~> 2.4.1)
74
91
  racc
75
92
  pry (0.14.2)
@@ -78,60 +95,67 @@ GEM
78
95
  pry-byebug (3.10.1)
79
96
  byebug (~> 11.0)
80
97
  pry (>= 0.13, < 0.15)
81
- public_suffix (5.0.4)
98
+ public_suffix (5.0.5)
82
99
  racc (1.7.3)
83
100
  rainbow (3.1.1)
84
101
  rbnacl (7.1.1)
85
102
  ffi
86
103
  redcarpet (3.6.0)
87
- regexp_parser (2.9.0)
88
- rexml (3.2.6)
89
- rspec (3.12.0)
90
- rspec-core (~> 3.12.0)
91
- rspec-expectations (~> 3.12.0)
92
- rspec-mocks (~> 3.12.0)
93
- rspec-core (3.12.2)
94
- rspec-support (~> 3.12.0)
95
- rspec-expectations (3.12.3)
104
+ regexp_parser (2.9.2)
105
+ rexml (3.2.8)
106
+ strscan (>= 3.0.9)
107
+ rspec (3.13.0)
108
+ rspec-core (~> 3.13.0)
109
+ rspec-expectations (~> 3.13.0)
110
+ rspec-mocks (~> 3.13.0)
111
+ rspec-core (3.13.0)
112
+ rspec-support (~> 3.13.0)
113
+ rspec-expectations (3.13.0)
96
114
  diff-lcs (>= 1.2.0, < 2.0)
97
- rspec-support (~> 3.12.0)
98
- rspec-mocks (3.12.6)
115
+ rspec-support (~> 3.13.0)
116
+ rspec-mocks (3.13.1)
99
117
  diff-lcs (>= 1.2.0, < 2.0)
100
- rspec-support (~> 3.12.0)
101
- rspec-support (3.12.1)
102
- rubocop (1.59.0)
118
+ rspec-support (~> 3.13.0)
119
+ rspec-support (3.13.1)
120
+ rubocop (1.63.5)
103
121
  json (~> 2.3)
104
122
  language_server-protocol (>= 3.17.0)
105
123
  parallel (~> 1.10)
106
- parser (>= 3.2.2.4)
124
+ parser (>= 3.3.0.2)
107
125
  rainbow (>= 2.2.2, < 4.0)
108
126
  regexp_parser (>= 1.8, < 3.0)
109
127
  rexml (>= 3.2.5, < 4.0)
110
- rubocop-ast (>= 1.30.0, < 2.0)
128
+ rubocop-ast (>= 1.31.1, < 2.0)
111
129
  ruby-progressbar (~> 1.7)
112
130
  unicode-display_width (>= 2.4.0, < 3.0)
113
- rubocop-ast (1.30.0)
114
- parser (>= 3.2.1.0)
131
+ rubocop-ast (1.31.3)
132
+ parser (>= 3.3.1.0)
115
133
  rubocop-capybara (2.20.0)
116
134
  rubocop (~> 1.41)
117
135
  rubocop-factory_bot (2.25.1)
118
136
  rubocop (~> 1.41)
119
- rubocop-rspec (2.26.1)
137
+ rubocop-rspec (2.29.2)
120
138
  rubocop (~> 1.40)
121
139
  rubocop-capybara (~> 2.17)
122
140
  rubocop-factory_bot (~> 2.22)
123
- ruby-openai (6.3.1)
141
+ rubocop-rspec_rails (~> 2.28)
142
+ rubocop-rspec_rails (2.28.3)
143
+ rubocop (~> 1.40)
144
+ ruby-openai (7.0.1)
124
145
  event_stream_parser (>= 0.3.0, < 2.0.0)
125
146
  faraday (>= 1)
126
147
  faraday-multipart (>= 1)
127
148
  ruby-progressbar (1.13.0)
128
- signet (0.18.0)
149
+ signet (0.19.0)
129
150
  addressable (~> 2.8)
130
151
  faraday (>= 0.17.5, < 3.a)
131
152
  jwt (>= 1.5, < 3.0)
132
153
  multi_json (~> 1.10)
154
+ strscan (3.1.0)
133
155
  sweet-moon (0.0.7)
134
156
  ffi (~> 1.15, >= 1.15.5)
157
+ typhoeus (1.4.1)
158
+ ethon (>= 0.9.0)
135
159
  unicode-display_width (2.5.0)
136
160
  uri (0.13.0)
137
161
 
@@ -141,9 +165,9 @@ PLATFORMS
141
165
  DEPENDENCIES
142
166
  nano-bots!
143
167
  pry-byebug (~> 3.10, >= 3.10.1)
144
- rspec (~> 3.12)
145
- rubocop (~> 1.59)
146
- rubocop-rspec (~> 2.26, >= 2.26.1)
168
+ rspec (~> 3.13)
169
+ rubocop (~> 1.63, >= 1.63.5)
170
+ rubocop-rspec (~> 2.29, >= 2.29.2)
147
171
 
148
172
  BUNDLED WITH
149
173
  2.4.22
data/README.md CHANGED
@@ -9,7 +9,7 @@ https://user-images.githubusercontent.com/113217272/238141567-c58a240c-7b67-4b3b
9
9
  ## TL;DR and Quick Start
10
10
 
11
11
  ```sh
12
- gem install nano-bots -v 3.0.1
12
+ gem install nano-bots -v 3.1.0
13
13
  ```
14
14
 
15
15
  ```bash
@@ -50,7 +50,7 @@ provider:
50
50
  access-token: ENV/OPENAI_API_KEY
51
51
  settings:
52
52
  user: ENV/NANO_BOTS_END_USER
53
- model: gpt-4-1106-preview
53
+ model: gpt-4o
54
54
  ```
55
55
 
56
56
  ```bash
@@ -59,7 +59,7 @@ nb gpt.yml - eval "hi"
59
59
  ```
60
60
 
61
61
  ```ruby
62
- gem 'nano-bots', '~> 3.0.1'
62
+ gem 'nano-bots', '~> 3.1.0'
63
63
  ```
64
64
 
65
65
  ```ruby
@@ -76,43 +76,43 @@ end
76
76
 
77
77
  - [TL;DR and Quick Start](#tldr-and-quick-start)
78
78
  - [Usage](#usage)
79
- - [Command Line](#command-line)
80
- - [Debugging](#debugging)
81
- - [Library](#library)
79
+ - [Command Line](#command-line)
80
+ - [Debugging](#debugging)
81
+ - [Library](#library)
82
82
  - [Setup](#setup)
83
- - [Cohere Command](#cohere-command)
84
- - [Maritaca AI MariTalk](#maritaca-ai-maritalk)
85
- - [Mistral AI](#mistral-ai)
86
- - [Ollama](#ollama)
87
- - [OpenAI ChatGPT](#openai-chatgpt)
88
- - [Google Gemini](#google-gemini)
89
- - [Option 1: API Key (Generative Language API)](#option-1-api-key-generative-language-api)
90
- - [Option 2: Service Account Credentials File (Vertex AI API)](#option-2-service-account-credentials-file-vertex-ai-api)
91
- - [Option 3: Application Default Credentials (Vertex AI API)](#option-3-application-default-credentials-vertex-ai-api)
92
- - [Custom Project ID](#custom-project-id)
83
+ - [Cohere Command](#cohere-command)
84
+ - [Maritaca AI MariTalk](#maritaca-ai-maritalk)
85
+ - [Mistral AI](#mistral-ai)
86
+ - [Ollama](#ollama)
87
+ - [OpenAI ChatGPT](#openai-chatgpt)
88
+ - [Google Gemini](#google-gemini)
89
+ - [Option 1: API Key (Generative Language API)](#option-1-api-key-generative-language-api)
90
+ - [Option 2: Service Account Credentials File (Vertex AI API)](#option-2-service-account-credentials-file-vertex-ai-api)
91
+ - [Option 3: Application Default Credentials (Vertex AI API)](#option-3-application-default-credentials-vertex-ai-api)
92
+ - [Custom Project ID](#custom-project-id)
93
93
  - [Cartridges](#cartridges)
94
- - [Tools (Functions)](#tools-functions)
95
- - [Experimental Clojure Support](#experimental-clojure-support)
96
- - [Marketplace](#marketplace)
94
+ - [Tools (Functions)](#tools-functions)
95
+ - [Experimental Clojure Support](#experimental-clojure-support)
96
+ - [Marketplace](#marketplace)
97
97
  - [Security and Privacy](#security-and-privacy)
98
- - [Cryptography](#cryptography)
99
- - [End-user IDs](#end-user-ids)
100
- - [Decrypting](#decrypting)
98
+ - [Cryptography](#cryptography)
99
+ - [End-user IDs](#end-user-ids)
100
+ - [Decrypting](#decrypting)
101
101
  - [Supported Providers](#supported-providers)
102
102
  - [Docker](#docker)
103
- - [Cohere Command Container](#cohere-command-container)
104
- - [Maritaca AI MariTalk Container](#maritaca-ai-maritalk-container)
105
- - [Mistral AI Container](#mistral-ai-container)
106
- - [Ollama Container](#ollama-container)
107
- - [OpenAI ChatGPT Container](#openai-chatgpt-container)
108
- - [Google Gemini Container](#google-gemini-container)
109
- - [Option 1: API Key (Generative Language API) Config](#option-1-api-key-generative-language-api-config)
110
- - [Option 2: Service Account Credentials File (Vertex AI API) Config](#option-2-service-account-credentials-file-vertex-ai-api-config)
111
- - [Option 3: Application Default Credentials (Vertex AI API) Config](#option-3-application-default-credentials-vertex-ai-api-config)
112
- - [Custom Project ID Config](#custom-project-id-config)
113
- - [Running the Container](#running-the-container)
103
+ - [Cohere Command Container](#cohere-command-container)
104
+ - [Maritaca AI MariTalk Container](#maritaca-ai-maritalk-container)
105
+ - [Mistral AI Container](#mistral-ai-container)
106
+ - [Ollama Container](#ollama-container)
107
+ - [OpenAI ChatGPT Container](#openai-chatgpt-container)
108
+ - [Google Gemini Container](#google-gemini-container)
109
+ - [Option 1: API Key (Generative Language API) Config](#option-1-api-key-generative-language-api-config)
110
+ - [Option 2: Service Account Credentials File (Vertex AI API) Config](#option-2-service-account-credentials-file-vertex-ai-api-config)
111
+ - [Option 3: Application Default Credentials (Vertex AI API) Config](#option-3-application-default-credentials-vertex-ai-api-config)
112
+ - [Custom Project ID Config](#custom-project-id-config)
113
+ - [Running the Container](#running-the-container)
114
114
  - [Development](#development)
115
- - [Publish to RubyGems](#publish-to-rubygems)
115
+ - [Publish to RubyGems](#publish-to-rubygems)
116
116
 
117
117
  ## Usage
118
118
 
@@ -250,13 +250,13 @@ end
250
250
  To install the CLI on your system:
251
251
 
252
252
  ```sh
253
- gem install nano-bots -v 3.0.1
253
+ gem install nano-bots -v 3.1.0
254
254
  ```
255
255
 
256
256
  To use it in a Ruby project as a library, add to your `Gemfile`:
257
257
 
258
258
  ```ruby
259
- gem 'nano-bots', '~> 3.0.1'
259
+ gem 'nano-bots', '~> 3.1.0'
260
260
  ```
261
261
 
262
262
  ```sh
@@ -372,7 +372,7 @@ provider:
372
372
  credentials:
373
373
  api-key: ENV/MARITACA_API_KEY
374
374
  settings:
375
- model: maritalk
375
+ model: sabia-2-medium
376
376
  ```
377
377
 
378
378
  Read the [full specification](https://spec.nbots.io/#/README?id=mistral-ai) for Mistral AI.
@@ -424,7 +424,7 @@ provider:
424
424
  credentials:
425
425
  api-key: ENV/MISTRAL_API_KEY
426
426
  settings:
427
- model: mistral-medium
427
+ model: mistral-medium-latest
428
428
  ```
429
429
 
430
430
  Read the [full specification](https://spec.nbots.io/#/README?id=mistral-ai) for Mistral AI.
@@ -476,7 +476,7 @@ provider:
476
476
  credentials:
477
477
  address: ENV/OLLAMA_API_ADDRESS
478
478
  settings:
479
- model: llama2
479
+ model: llama3
480
480
  ```
481
481
 
482
482
  Read the [full specification](https://spec.nbots.io/#/README?id=ollama) for Ollama.
@@ -529,7 +529,7 @@ provider:
529
529
  access-token: ENV/OPENAI_API_KEY
530
530
  settings:
531
531
  user: ENV/NANO_BOTS_END_USER
532
- model: gpt-4-1106-preview
532
+ model: gpt-4o
533
533
  ```
534
534
 
535
535
  Read the [full specification](https://spec.nbots.io/#/README?id=openai-chatgpt) for OpenAI ChatGPT.
@@ -758,7 +758,7 @@ provider:
758
758
  access-token: ENV/OPENAI_API_KEY
759
759
  settings:
760
760
  user: ENV/NANO_BOTS_END_USER
761
- model: gpt-4-1106-preview
761
+ model: gpt-4o
762
762
  ```
763
763
 
764
764
  ### Tools (Functions)
@@ -786,7 +786,7 @@ The randomly generated number is 59.
786
786
 
787
787
  🤖> |
788
788
  ```
789
- To successfully use Tools (Functions), you need to specify a provider and a model that supports them. As of the writing of this README, the provider that supports them is [OpenAI](https://platform.openai.com/docs/models), with models `gpt-3.5-turbo-1106` and `gpt-4-1106-preview`, and [Google](https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/function-calling#supported_models), with the `vertex-ai-api` service and the model `gemini-pro`. Other providers do not yet have support.
789
+ To successfully use Tools (Functions), you need to specify a provider and a model that supports them. As of the writing of this README, the provider that supports them is [OpenAI](https://platform.openai.com/docs/models), with models `gpt-3.5-turbo-1106` and `gpt-4o`, and [Google](https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/function-calling#supported_models), with the `vertex-ai-api` service and the model `gemini-pro`. Other providers do not yet have support.
790
790
 
791
791
  Check the [Nano Bots specification](https://spec.nbots.io/#/README?id=tools-functions-2) to learn more about Tools (Functions).
792
792
 
@@ -945,10 +945,10 @@ If you lose your password, you lose your data. It is not possible to recover it
945
945
  - [x] [Maritaca AI MariTalk](https://www.maritaca.ai)
946
946
  - [x] [Mistral AI](https://mistral.ai)
947
947
  - [x] [Ollama](https://ollama.ai)
948
- - [x] [01.AI Yi](https://01.ai)
949
- - [x] [LMSYS Vicuna](https://github.com/lm-sys/FastChat)
950
- - [x] [Meta Llama](https://ai.meta.com/llama/)
951
- - [x] [WizardLM](https://wizardlm.github.io)
948
+ - [x] [01.AI Yi](https://01.ai)
949
+ - [x] [LMSYS Vicuna](https://github.com/lm-sys/FastChat)
950
+ - [x] [Meta Llama](https://ai.meta.com/llama/)
951
+ - [x] [WizardLM](https://wizardlm.github.io)
952
952
  - [x] [Open AI ChatGPT](https://openai.com/chatgpt)
953
953
 
954
954
  01.AI Yi, LMSYS Vicuna, Meta Llama, and WizardLM are open-source models that are supported through [Ollama](https://ollama.ai).
@@ -972,7 +972,7 @@ Set your provider credentials and choose your desired path for the cartridges fi
972
972
  services:
973
973
  nano-bots:
974
974
  image: ruby:3.2.2-slim-bookworm
975
- command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.0.1 && bash"
975
+ command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.1.0 && bash"
976
976
  environment:
977
977
  COHERE_API_KEY: your-api-key
978
978
  NANO_BOTS_ENCRYPTION_PASSWORD: UNSAFE
@@ -989,7 +989,7 @@ services:
989
989
  services:
990
990
  nano-bots:
991
991
  image: ruby:3.2.2-slim-bookworm
992
- command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.0.1 && bash"
992
+ command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.1.0 && bash"
993
993
  environment:
994
994
  MARITACA_API_KEY: your-api-key
995
995
  NANO_BOTS_ENCRYPTION_PASSWORD: UNSAFE
@@ -1006,7 +1006,7 @@ services:
1006
1006
  services:
1007
1007
  nano-bots:
1008
1008
  image: ruby:3.2.2-slim-bookworm
1009
- command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.0.1 && bash"
1009
+ command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.1.0 && bash"
1010
1010
  environment:
1011
1011
  MISTRAL_API_KEY: your-api-key
1012
1012
  NANO_BOTS_ENCRYPTION_PASSWORD: UNSAFE
@@ -1025,7 +1025,7 @@ Remember that your `localhost` is by default inaccessible from inside Docker. Yo
1025
1025
  services:
1026
1026
  nano-bots:
1027
1027
  image: ruby:3.2.2-slim-bookworm
1028
- command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.0.1 && bash"
1028
+ command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.1.0 && bash"
1029
1029
  environment:
1030
1030
  OLLAMA_API_ADDRESS: http://localhost:11434
1031
1031
  NANO_BOTS_ENCRYPTION_PASSWORD: UNSAFE
@@ -1044,7 +1044,7 @@ services:
1044
1044
  services:
1045
1045
  nano-bots:
1046
1046
  image: ruby:3.2.2-slim-bookworm
1047
- command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.0.1 && bash"
1047
+ command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.1.0 && bash"
1048
1048
  environment:
1049
1049
  OPENAI_API_KEY: your-access-token
1050
1050
  NANO_BOTS_ENCRYPTION_PASSWORD: UNSAFE
@@ -1063,7 +1063,7 @@ services:
1063
1063
  services:
1064
1064
  nano-bots:
1065
1065
  image: ruby:3.2.2-slim-bookworm
1066
- command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.0.1 && bash"
1066
+ command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.1.0 && bash"
1067
1067
  environment:
1068
1068
  GOOGLE_API_KEY: your-api-key
1069
1069
  NANO_BOTS_ENCRYPTION_PASSWORD: UNSAFE
@@ -1080,7 +1080,7 @@ services:
1080
1080
  services:
1081
1081
  nano-bots:
1082
1082
  image: ruby:3.2.2-slim-bookworm
1083
- command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.0.1 && bash"
1083
+ command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.1.0 && bash"
1084
1084
  environment:
1085
1085
  GOOGLE_CREDENTIALS_FILE_PATH: /root/.config/google-credentials.json
1086
1086
  GOOGLE_REGION: us-east4
@@ -1099,7 +1099,7 @@ services:
1099
1099
  services:
1100
1100
  nano-bots:
1101
1101
  image: ruby:3.2.2-slim-bookworm
1102
- command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.0.1 && bash"
1102
+ command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.1.0 && bash"
1103
1103
  environment:
1104
1104
  GOOGLE_REGION: us-east4
1105
1105
  NANO_BOTS_ENCRYPTION_PASSWORD: UNSAFE
@@ -1161,5 +1161,5 @@ gem build nano-bots.gemspec
1161
1161
 
1162
1162
  gem signin
1163
1163
 
1164
- gem push nano-bots-3.0.1.gem
1164
+ gem push nano-bots-3.1.0.gem
1165
1165
  ```
@@ -66,10 +66,7 @@ module NanoBot
66
66
  end
67
67
  end
68
68
 
69
- # TODO: Does Gemini have system messages?
70
- %i[backdrop directive].each do |key|
71
- next unless input[:behavior][key]
72
-
69
+ if input[:behavior][:backdrop]
73
70
  messages.prepend(
74
71
  { role: 'model',
75
72
  parts: { text: 'Understood.' },
@@ -78,13 +75,20 @@ module NanoBot
78
75
 
79
76
  messages.prepend(
80
77
  { role: 'user',
81
- parts: { text: input[:behavior][key] },
78
+ parts: { text: input[:behavior][:backdrop] },
82
79
  _meta: { at: Time.now } }
83
80
  )
84
81
  end
85
82
 
86
83
  payload = { contents: messages, generationConfig: { candidateCount: 1 } }
87
84
 
85
+ if input[:behavior][:directive]
86
+ payload[:system_instruction] = {
87
+ role: 'user',
88
+ parts: { text: input[:behavior][:directive] }
89
+ }
90
+ end
91
+
88
92
  if @settings
89
93
  SETTINGS.each_key do |key|
90
94
  SETTINGS[key].each do |sub_key|
@@ -193,9 +197,13 @@ module NanoBot
193
197
  end
194
198
 
195
199
  content = result.map do |answer|
196
- answer.dig('candidates', 0, 'content', 'parts').filter do |part|
197
- part.key?('text')
198
- end.map { |part| part['text'] }.join
200
+ parts = answer.dig('candidates', 0, 'content', 'parts')
201
+
202
+ if parts
203
+ parts.filter { |part| part.key?('text') }.map { |part| part['text'] }.join
204
+ else
205
+ ''
206
+ end
199
207
  end.join
200
208
 
201
209
  feedback.call(
@@ -15,7 +15,7 @@ module NanoBot
15
15
  attr_reader :settings
16
16
 
17
17
  CHAT_SETTINGS = %i[
18
- max_tokens model do_sample temperature top_p repetition_penalty stopping_tokens
18
+ max_tokens model stream do_sample temperature top_p repetition_penalty stopping_tokens
19
19
  ].freeze
20
20
 
21
21
  def initialize(options, settings, credentials, _environment)
@@ -27,13 +27,14 @@ module NanoBot
27
27
  {}
28
28
  end
29
29
 
30
- unless maritaca_options.key?(:stream)
31
- maritaca_options[:stream] = Logic::Helpers::Hash.fetch(
32
- Logic::Cartridge::Default.instance.values, %i[provider options stream]
30
+ unless @settings.key?(:stream)
31
+ @settings = Marshal.load(Marshal.dump(@settings))
32
+ @settings[:stream] = Logic::Helpers::Hash.fetch(
33
+ Logic::Cartridge::Default.instance.values, %i[provider settings stream]
33
34
  )
34
35
  end
35
36
 
36
- maritaca_options[:server_sent_events] = maritaca_options.delete(:stream)
37
+ maritaca_options[:server_sent_events] = @settings[:stream]
37
38
 
38
39
  @client = ::Maritaca.new(
39
40
  credentials: credentials.transform_keys { |key| key.to_s.gsub('-', '_').to_sym },
@@ -71,7 +72,7 @@ module NanoBot
71
72
  content = ''
72
73
 
73
74
  stream_call_back = proc do |event, _raw|
74
- partial_content = event['answer']
75
+ partial_content = event['text']
75
76
 
76
77
  if partial_content
77
78
  content += partial_content
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'openai'
4
4
 
5
+ require 'faraday/typhoeus'
6
+
5
7
  require_relative 'base'
6
8
  require_relative '../crypto'
7
9
 
@@ -35,7 +37,9 @@ module NanoBot
35
37
  "#{@credentials[:address].to_s.sub(%r{/$}, '')}/"
36
38
  end
37
39
 
38
- @client = ::OpenAI::Client.new(uri_base:, access_token: @credentials[:'access-token'])
40
+ @client = ::OpenAI::Client.new(uri_base:, access_token: @credentials[:'access-token']) do |faraday|
41
+ faraday.adapter :typhoeus
42
+ end
39
43
  end
40
44
 
41
45
  def evaluate(input, streaming, cartridge, &feedback)
@@ -2,7 +2,7 @@
2
2
  services:
3
3
  nano-bots:
4
4
  image: ruby:3.2.2-slim-bookworm
5
- command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.0.1 && bash"
5
+ command: sh -c "apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libsodium-dev lua5.4-dev curl && curl -s https://raw.githubusercontent.com/babashka/babashka/master/install | bash && gem install nano-bots -v 3.1.0 && bash"
6
6
  environment:
7
7
  COHERE_API_KEY: your-api-key
8
8
 
data/nano-bots.gemspec CHANGED
@@ -32,20 +32,24 @@ Gem::Specification.new do |spec|
32
32
  spec.executables = ['nb']
33
33
 
34
34
  spec.add_dependency 'babosa', '~> 2.0'
35
- spec.add_dependency 'concurrent-ruby', '~> 1.2', '>= 1.2.2'
36
- spec.add_dependency 'dotenv', '~> 2.8', '>= 2.8.1'
35
+ spec.add_dependency 'concurrent-ruby', '~> 1.2', '>= 1.2.3'
36
+ spec.add_dependency 'dotenv', '~> 3.1', '>= 3.1.2'
37
37
  spec.add_dependency 'pry', '~> 0.14.2'
38
38
  spec.add_dependency 'rainbow', '~> 3.1', '>= 3.1.1'
39
39
  spec.add_dependency 'rbnacl', '~> 7.1', '>= 7.1.1'
40
40
  spec.add_dependency 'redcarpet', '~> 3.6'
41
41
  spec.add_dependency 'sweet-moon', '~> 0.0.7'
42
42
 
43
- spec.add_dependency 'cohere-ai', '~> 1.0', '>= 1.0.2'
44
- spec.add_dependency 'gemini-ai', '~> 3.1', '>= 3.1.3'
45
- spec.add_dependency 'maritaca-ai', '~> 1.0', '>= 1.0.1'
46
- spec.add_dependency 'mistral-ai', '~> 1.1', '>= 1.1.2'
47
- spec.add_dependency 'ollama-ai', '~> 1.0', '>= 1.0.1'
48
- spec.add_dependency 'ruby-openai', '~> 6.3', '>= 6.3.1'
43
+ spec.add_dependency 'cohere-ai', '~> 1.1'
44
+ spec.add_dependency 'gemini-ai', '~> 4.0'
45
+ spec.add_dependency 'maritaca-ai', '~> 1.2'
46
+ spec.add_dependency 'mistral-ai', '~> 1.2'
47
+ spec.add_dependency 'ollama-ai', '~> 1.2', '>= 1.2.1'
48
+ spec.add_dependency 'ruby-openai', '~> 7.0', '>= 7.0.1'
49
+
50
+ spec.add_dependency 'faraday', '~> 2.9'
51
+ spec.add_dependency 'faraday-typhoeus', '~> 1.1'
52
+ spec.add_dependency 'typhoeus', '~> 1.4', '>= 1.4.1'
49
53
 
50
54
  spec.metadata['rubygems_mfa_required'] = 'true'
51
55
  end
@@ -14,4 +14,4 @@ provider:
14
14
  access-token: ENV/OPENAI_API_KEY
15
15
  settings:
16
16
  user: ENV/NANO_BOTS_END_USER
17
- model: gpt-3.5-turbo-1106
17
+ model: gpt-3.5-turbo
data/static/gem.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module NanoBot
4
4
  GEM = {
5
5
  name: 'nano-bots',
6
- version: '3.0.1',
6
+ version: '3.1.0',
7
7
  specification: '3.0.0',
8
8
  author: 'icebaker',
9
9
  summary: 'Ruby Implementation of Nano Bots: small, AI-powered bots for OpenAI ChatGPT, Ollama, Mistral AI, Cohere Command, Maritaca AI MariTalk, and Google Gemini.',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nano-bots
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - icebaker
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-13 00:00:00.000000000 Z
11
+ date: 2024-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: babosa
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '1.2'
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 1.2.2
36
+ version: 1.2.3
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,27 +43,27 @@ dependencies:
43
43
  version: '1.2'
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 1.2.2
46
+ version: 1.2.3
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: dotenv
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '2.8'
53
+ version: '3.1'
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 2.8.1
56
+ version: 3.1.2
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '2.8'
63
+ version: '3.1'
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
- version: 2.8.1
66
+ version: 3.1.2
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: pry
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -152,125 +152,149 @@ dependencies:
152
152
  requirements:
153
153
  - - "~>"
154
154
  - !ruby/object:Gem::Version
155
- version: '1.0'
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- version: 1.0.2
155
+ version: '1.1'
159
156
  type: :runtime
160
157
  prerelease: false
161
158
  version_requirements: !ruby/object:Gem::Requirement
162
159
  requirements:
163
160
  - - "~>"
164
161
  - !ruby/object:Gem::Version
165
- version: '1.0'
166
- - - ">="
167
- - !ruby/object:Gem::Version
168
- version: 1.0.2
162
+ version: '1.1'
169
163
  - !ruby/object:Gem::Dependency
170
164
  name: gemini-ai
171
165
  requirement: !ruby/object:Gem::Requirement
172
166
  requirements:
173
167
  - - "~>"
174
168
  - !ruby/object:Gem::Version
175
- version: '3.1'
176
- - - ">="
169
+ version: '4.0'
170
+ type: :runtime
171
+ prerelease: false
172
+ version_requirements: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - "~>"
175
+ - !ruby/object:Gem::Version
176
+ version: '4.0'
177
+ - !ruby/object:Gem::Dependency
178
+ name: maritaca-ai
179
+ requirement: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - "~>"
177
182
  - !ruby/object:Gem::Version
178
- version: 3.1.3
183
+ version: '1.2'
179
184
  type: :runtime
180
185
  prerelease: false
181
186
  version_requirements: !ruby/object:Gem::Requirement
182
187
  requirements:
183
188
  - - "~>"
184
189
  - !ruby/object:Gem::Version
185
- version: '3.1'
186
- - - ">="
190
+ version: '1.2'
191
+ - !ruby/object:Gem::Dependency
192
+ name: mistral-ai
193
+ requirement: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - "~>"
187
196
  - !ruby/object:Gem::Version
188
- version: 3.1.3
197
+ version: '1.2'
198
+ type: :runtime
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - "~>"
203
+ - !ruby/object:Gem::Version
204
+ version: '1.2'
189
205
  - !ruby/object:Gem::Dependency
190
- name: maritaca-ai
206
+ name: ollama-ai
191
207
  requirement: !ruby/object:Gem::Requirement
192
208
  requirements:
193
209
  - - "~>"
194
210
  - !ruby/object:Gem::Version
195
- version: '1.0'
211
+ version: '1.2'
196
212
  - - ">="
197
213
  - !ruby/object:Gem::Version
198
- version: 1.0.1
214
+ version: 1.2.1
199
215
  type: :runtime
200
216
  prerelease: false
201
217
  version_requirements: !ruby/object:Gem::Requirement
202
218
  requirements:
203
219
  - - "~>"
204
220
  - !ruby/object:Gem::Version
205
- version: '1.0'
221
+ version: '1.2'
206
222
  - - ">="
207
223
  - !ruby/object:Gem::Version
208
- version: 1.0.1
224
+ version: 1.2.1
209
225
  - !ruby/object:Gem::Dependency
210
- name: mistral-ai
226
+ name: ruby-openai
211
227
  requirement: !ruby/object:Gem::Requirement
212
228
  requirements:
213
229
  - - "~>"
214
230
  - !ruby/object:Gem::Version
215
- version: '1.1'
231
+ version: '7.0'
216
232
  - - ">="
217
233
  - !ruby/object:Gem::Version
218
- version: 1.1.2
234
+ version: 7.0.1
219
235
  type: :runtime
220
236
  prerelease: false
221
237
  version_requirements: !ruby/object:Gem::Requirement
222
238
  requirements:
223
239
  - - "~>"
224
240
  - !ruby/object:Gem::Version
225
- version: '1.1'
241
+ version: '7.0'
226
242
  - - ">="
227
243
  - !ruby/object:Gem::Version
228
- version: 1.1.2
244
+ version: 7.0.1
229
245
  - !ruby/object:Gem::Dependency
230
- name: ollama-ai
246
+ name: faraday
231
247
  requirement: !ruby/object:Gem::Requirement
232
248
  requirements:
233
249
  - - "~>"
234
250
  - !ruby/object:Gem::Version
235
- version: '1.0'
236
- - - ">="
237
- - !ruby/object:Gem::Version
238
- version: 1.0.1
251
+ version: '2.9'
239
252
  type: :runtime
240
253
  prerelease: false
241
254
  version_requirements: !ruby/object:Gem::Requirement
242
255
  requirements:
243
256
  - - "~>"
244
257
  - !ruby/object:Gem::Version
245
- version: '1.0'
246
- - - ">="
258
+ version: '2.9'
259
+ - !ruby/object:Gem::Dependency
260
+ name: faraday-typhoeus
261
+ requirement: !ruby/object:Gem::Requirement
262
+ requirements:
263
+ - - "~>"
247
264
  - !ruby/object:Gem::Version
248
- version: 1.0.1
265
+ version: '1.1'
266
+ type: :runtime
267
+ prerelease: false
268
+ version_requirements: !ruby/object:Gem::Requirement
269
+ requirements:
270
+ - - "~>"
271
+ - !ruby/object:Gem::Version
272
+ version: '1.1'
249
273
  - !ruby/object:Gem::Dependency
250
- name: ruby-openai
274
+ name: typhoeus
251
275
  requirement: !ruby/object:Gem::Requirement
252
276
  requirements:
253
277
  - - "~>"
254
278
  - !ruby/object:Gem::Version
255
- version: '6.3'
279
+ version: '1.4'
256
280
  - - ">="
257
281
  - !ruby/object:Gem::Version
258
- version: 6.3.1
282
+ version: 1.4.1
259
283
  type: :runtime
260
284
  prerelease: false
261
285
  version_requirements: !ruby/object:Gem::Requirement
262
286
  requirements:
263
287
  - - "~>"
264
288
  - !ruby/object:Gem::Version
265
- version: '6.3'
289
+ version: '1.4'
266
290
  - - ">="
267
291
  - !ruby/object:Gem::Version
268
- version: 6.3.1
292
+ version: 1.4.1
269
293
  description: 'Ruby Implementation of Nano Bots: small, AI-powered bots that can be
270
294
  easily shared as a single file, designed to support multiple providers such as OpenAI
271
295
  ChatGPT, Ollama, Mistral AI, Cohere Command, Maritaca AI MariTalk, and Google Gemini,
272
296
  with support for calling Tools (Functions).'
273
- email:
297
+ email:
274
298
  executables:
275
299
  - nb
276
300
  extensions: []
@@ -344,7 +368,7 @@ metadata:
344
368
  homepage_uri: https://github.com/icebaker/ruby-nano-bots
345
369
  source_code_uri: https://github.com/icebaker/ruby-nano-bots
346
370
  rubygems_mfa_required: 'true'
347
- post_install_message:
371
+ post_install_message:
348
372
  rdoc_options: []
349
373
  require_paths:
350
374
  - ports/dsl
@@ -360,7 +384,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
360
384
  version: '0'
361
385
  requirements: []
362
386
  rubygems_version: 3.3.3
363
- signing_key:
387
+ signing_key:
364
388
  specification_version: 4
365
389
  summary: 'Ruby Implementation of Nano Bots: small, AI-powered bots for OpenAI ChatGPT,
366
390
  Ollama, Mistral AI, Cohere Command, Maritaca AI MariTalk, and Google Gemini.'