maritaca-ai 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +13 -11
- data/README.md +12 -10
- data/controllers/client.rb +4 -5
- data/maritaca-ai.gemspec +1 -1
- data/static/gem.rb +1 -1
- data/template.md +9 -7
- metadata +5 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 528dad62e33505dbe008d7a4a2829f8d0fb91d7ae621884cf4eb436777785589
|
4
|
+
data.tar.gz: fa2f39f286f091d238aee2ba8da22419c0880867892139a8d2c581f78d10f3f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23cb4d50db7d60142fe05313031c16096200b59ff7d10fb4bc51316b64396085d28a4916f2402bc9ff9ada668beb914e701a0b384297a5fd7b47e68a76112610
|
7
|
+
data.tar.gz: 0b0a0ab8c1d4f3f5d69ac0a95a5e63533419f4fb64ca70ffc882bc9e87d8a3867ae68a4d865b7a2a0546869eb2d479a5404cf8aa01025fd4e7ebe56530cee5fa
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,26 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
maritaca-ai (1.0.
|
5
|
-
faraday (~> 2.
|
4
|
+
maritaca-ai (1.0.1)
|
5
|
+
faraday (~> 2.9)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.4.2)
|
11
|
-
base64 (0.2.0)
|
12
11
|
byebug (11.1.3)
|
13
12
|
coderay (1.1.3)
|
14
|
-
|
15
|
-
|
16
|
-
faraday-net_http (>= 2.0, < 3.
|
17
|
-
|
18
|
-
|
13
|
+
dotenv (2.8.1)
|
14
|
+
faraday (2.9.0)
|
15
|
+
faraday-net_http (>= 2.0, < 3.2)
|
16
|
+
faraday-net_http (3.1.0)
|
17
|
+
net-http
|
19
18
|
json (2.7.1)
|
20
19
|
language_server-protocol (3.17.0.3)
|
21
20
|
method_source (1.0.0)
|
21
|
+
net-http (0.4.1)
|
22
|
+
uri
|
22
23
|
parallel (1.24.0)
|
23
|
-
parser (3.
|
24
|
+
parser (3.3.0.3)
|
24
25
|
ast (~> 2.4.1)
|
25
26
|
racc
|
26
27
|
pry (0.14.2)
|
@@ -31,7 +32,7 @@ GEM
|
|
31
32
|
pry (>= 0.13, < 0.15)
|
32
33
|
racc (1.7.3)
|
33
34
|
rainbow (3.1.1)
|
34
|
-
regexp_parser (2.
|
35
|
+
regexp_parser (2.9.0)
|
35
36
|
rexml (3.2.6)
|
36
37
|
rubocop (1.59.0)
|
37
38
|
json (~> 2.3)
|
@@ -47,13 +48,14 @@ GEM
|
|
47
48
|
rubocop-ast (1.30.0)
|
48
49
|
parser (>= 3.2.1.0)
|
49
50
|
ruby-progressbar (1.13.0)
|
50
|
-
ruby2_keywords (0.0.5)
|
51
51
|
unicode-display_width (2.5.0)
|
52
|
+
uri (0.13.0)
|
52
53
|
|
53
54
|
PLATFORMS
|
54
55
|
x86_64-linux
|
55
56
|
|
56
57
|
DEPENDENCIES
|
58
|
+
dotenv (~> 2.8, >= 2.8.1)
|
57
59
|
maritaca-ai!
|
58
60
|
pry-byebug (~> 3.10, >= 3.10.1)
|
59
61
|
rubocop (~> 1.58)
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ A Ruby gem for interacting with [MariTalk](https://chat.maritaca.ai) from [Marit
|
|
9
9
|
## TL;DR and Quick Start
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'maritaca-ai', '~> 1.0.
|
12
|
+
gem 'maritaca-ai', '~> 1.0.1'
|
13
13
|
```
|
14
14
|
|
15
15
|
```ruby
|
@@ -43,9 +43,9 @@ Result:
|
|
43
43
|
- [Custom Address](#custom-address)
|
44
44
|
- [Methods](#methods)
|
45
45
|
- [chat_inference](#chat_inference)
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
- [Chat](#chat)
|
47
|
+
- [Back-and-Forth Conversations](#back-and-forth-conversations)
|
48
|
+
- [Without Chat](#without-chat)
|
49
49
|
- [New Functionalities and APIs](#new-functionalities-and-apis)
|
50
50
|
- [Request Options](#request-options)
|
51
51
|
- [Timeout](#timeout)
|
@@ -65,11 +65,11 @@ Result:
|
|
65
65
|
### Installing
|
66
66
|
|
67
67
|
```sh
|
68
|
-
gem install maritaca-ai -v 1.0.
|
68
|
+
gem install maritaca-ai -v 1.0.1
|
69
69
|
```
|
70
70
|
|
71
71
|
```sh
|
72
|
-
gem 'maritaca-ai', '~> 1.0.
|
72
|
+
gem 'maritaca-ai', '~> 1.0.1'
|
73
73
|
```
|
74
74
|
|
75
75
|
### Credentials
|
@@ -116,7 +116,7 @@ client = Maritaca.new(
|
|
116
116
|
|
117
117
|
#### chat_inference
|
118
118
|
|
119
|
-
|
119
|
+
##### Chat
|
120
120
|
|
121
121
|
```ruby
|
122
122
|
result = client.chat_inference(
|
@@ -131,7 +131,7 @@ Result:
|
|
131
131
|
{ 'answer' => 'Oi! Como posso ajudá-lo(a) hoje?' }
|
132
132
|
```
|
133
133
|
|
134
|
-
|
134
|
+
##### Back-and-Forth Conversations
|
135
135
|
|
136
136
|
To maintain a back-and-forth conversation, you need to append the received responses and build a history for your requests:
|
137
137
|
|
@@ -152,7 +152,7 @@ Result:
|
|
152
152
|
{ 'answer' => 'Seu nome é Tamanduá.' }
|
153
153
|
```
|
154
154
|
|
155
|
-
|
155
|
+
##### Without Chat
|
156
156
|
|
157
157
|
You can prompt the model without using chat mode:
|
158
158
|
|
@@ -275,6 +275,8 @@ RequestError
|
|
275
275
|
```bash
|
276
276
|
bundle
|
277
277
|
rubocop -A
|
278
|
+
|
279
|
+
bundle exec ruby spec/tasks/run-client.rb
|
278
280
|
```
|
279
281
|
|
280
282
|
### Purpose
|
@@ -288,7 +290,7 @@ gem build maritaca-ai.gemspec
|
|
288
290
|
|
289
291
|
gem signin
|
290
292
|
|
291
|
-
gem push maritaca-ai-1.0.
|
293
|
+
gem push maritaca-ai-1.0.1.gem
|
292
294
|
```
|
293
295
|
|
294
296
|
### Updating the README
|
data/controllers/client.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'event_stream_parser'
|
4
3
|
require 'faraday'
|
5
4
|
require 'json'
|
6
5
|
|
7
|
-
require_relative '../
|
6
|
+
require_relative '../components/errors'
|
8
7
|
|
9
8
|
module Maritaca
|
10
9
|
module Controllers
|
@@ -24,7 +23,7 @@ module Maritaca
|
|
24
23
|
end
|
25
24
|
|
26
25
|
if @api_key.nil? && @address == "#{DEFAULT_ADDRESS}/"
|
27
|
-
raise MissingAPIKeyError, 'Missing API Key, which is required.'
|
26
|
+
raise Errors::MissingAPIKeyError, 'Missing API Key, which is required.'
|
28
27
|
end
|
29
28
|
|
30
29
|
@request_options = config.dig(:options, :connection, :request)
|
@@ -47,7 +46,7 @@ module Maritaca
|
|
47
46
|
url = "#{@address}#{path}"
|
48
47
|
|
49
48
|
if !callback.nil? && !server_sent_events_enabled
|
50
|
-
raise BlockWithoutServerSentEventsError,
|
49
|
+
raise Errors::BlockWithoutServerSentEventsError,
|
51
50
|
'You are trying to use a block without Server Sent Events (SSE) enabled.'
|
52
51
|
end
|
53
52
|
|
@@ -95,7 +94,7 @@ module Maritaca
|
|
95
94
|
|
96
95
|
results.map { |result| result[:event] }
|
97
96
|
rescue Faraday::ServerError => e
|
98
|
-
raise RequestError.new(e.message, request: e, payload:)
|
97
|
+
raise Errors::RequestError.new(e.message, request: e, payload:)
|
99
98
|
end
|
100
99
|
|
101
100
|
def safe_parse_json_with_fallback_to_raw(raw)
|
data/maritaca-ai.gemspec
CHANGED
data/static/gem.rb
CHANGED
data/template.md
CHANGED
@@ -9,7 +9,7 @@ A Ruby gem for interacting with [MariTalk](https://chat.maritaca.ai) from [Marit
|
|
9
9
|
## TL;DR and Quick Start
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'maritaca-ai', '~> 1.0.
|
12
|
+
gem 'maritaca-ai', '~> 1.0.1'
|
13
13
|
```
|
14
14
|
|
15
15
|
```ruby
|
@@ -40,11 +40,11 @@ Result:
|
|
40
40
|
### Installing
|
41
41
|
|
42
42
|
```sh
|
43
|
-
gem install maritaca-ai -v 1.0.
|
43
|
+
gem install maritaca-ai -v 1.0.1
|
44
44
|
```
|
45
45
|
|
46
46
|
```sh
|
47
|
-
gem 'maritaca-ai', '~> 1.0.
|
47
|
+
gem 'maritaca-ai', '~> 1.0.1'
|
48
48
|
```
|
49
49
|
|
50
50
|
### Credentials
|
@@ -91,7 +91,7 @@ client = Maritaca.new(
|
|
91
91
|
|
92
92
|
#### chat_inference
|
93
93
|
|
94
|
-
|
94
|
+
##### Chat
|
95
95
|
|
96
96
|
```ruby
|
97
97
|
result = client.chat_inference(
|
@@ -106,7 +106,7 @@ Result:
|
|
106
106
|
{ 'answer' => 'Oi! Como posso ajudá-lo(a) hoje?' }
|
107
107
|
```
|
108
108
|
|
109
|
-
|
109
|
+
##### Back-and-Forth Conversations
|
110
110
|
|
111
111
|
To maintain a back-and-forth conversation, you need to append the received responses and build a history for your requests:
|
112
112
|
|
@@ -127,7 +127,7 @@ Result:
|
|
127
127
|
{ 'answer' => 'Seu nome é Tamanduá.' }
|
128
128
|
```
|
129
129
|
|
130
|
-
|
130
|
+
##### Without Chat
|
131
131
|
|
132
132
|
You can prompt the model without using chat mode:
|
133
133
|
|
@@ -250,6 +250,8 @@ RequestError
|
|
250
250
|
```bash
|
251
251
|
bundle
|
252
252
|
rubocop -A
|
253
|
+
|
254
|
+
bundle exec ruby spec/tasks/run-client.rb
|
253
255
|
```
|
254
256
|
|
255
257
|
### Purpose
|
@@ -263,7 +265,7 @@ gem build maritaca-ai.gemspec
|
|
263
265
|
|
264
266
|
gem signin
|
265
267
|
|
266
|
-
gem push maritaca-ai-1.0.
|
268
|
+
gem push maritaca-ai-1.0.1.gem
|
267
269
|
```
|
268
270
|
|
269
271
|
### Updating the README
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maritaca-ai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gbaptista
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,20 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 2.8.1
|
19
|
+
version: '2.9'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '2.
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 2.8.1
|
26
|
+
version: '2.9'
|
33
27
|
description: A Ruby gem for interacting with Maritaca AI's large language models.
|
34
28
|
email:
|
35
29
|
executables: []
|
@@ -74,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
68
|
- !ruby/object:Gem::Version
|
75
69
|
version: '0'
|
76
70
|
requirements: []
|
77
|
-
rubygems_version: 3.
|
71
|
+
rubygems_version: 3.3.3
|
78
72
|
signing_key:
|
79
73
|
specification_version: 4
|
80
74
|
summary: Interact with Maritaca AI.
|