maritaca-ai 1.0.0 → 1.0.1

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: d09d3d7f30a05367ba9488b60754235fb4ecd4ad204e699aa7b7035a75329d4b
4
- data.tar.gz: f235d41d277a28ca87c6dca8037e8bb706145cf75e46386ac40e39ba28f945cf
3
+ metadata.gz: 528dad62e33505dbe008d7a4a2829f8d0fb91d7ae621884cf4eb436777785589
4
+ data.tar.gz: fa2f39f286f091d238aee2ba8da22419c0880867892139a8d2c581f78d10f3f4
5
5
  SHA512:
6
- metadata.gz: 7b2ef8109622f102f41f2a14b1c21177c5ffa0af47417b5b0d17b61f334fe32e336ae25a5fb6cc9d08c31d60f6055cde42f9ac2503169abaa0bc6ee097bc4bca
7
- data.tar.gz: 5da080135ef573549d4948c4b242dd4bc840be4db30b0313a5608f36613cd8e1cd00a1b5db503d65f2dad7ac195a411617ad8c43bae5ebd998d582fb8f374ad1
6
+ metadata.gz: 23cb4d50db7d60142fe05313031c16096200b59ff7d10fb4bc51316b64396085d28a4916f2402bc9ff9ada668beb914e701a0b384297a5fd7b47e68a76112610
7
+ data.tar.gz: 0b0a0ab8c1d4f3f5d69ac0a95a5e63533419f4fb64ca70ffc882bc9e87d8a3867ae68a4d865b7a2a0546869eb2d479a5404cf8aa01025fd4e7ebe56530cee5fa
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  *.gem
2
2
  .devcontainer
3
+ .env
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ source 'https://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  group :test, :development do
8
+ gem 'dotenv', '~> 2.8', '>= 2.8.1'
8
9
  gem 'pry-byebug', '~> 3.10', '>= 3.10.1'
9
10
  gem 'rubocop', '~> 1.58'
10
11
  end
data/Gemfile.lock CHANGED
@@ -1,26 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- maritaca-ai (1.0.0)
5
- faraday (~> 2.8, >= 2.8.1)
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
- faraday (2.8.1)
15
- base64
16
- faraday-net_http (>= 2.0, < 3.1)
17
- ruby2_keywords (>= 0.0.4)
18
- faraday-net_http (3.0.2)
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.2.2.4)
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.8.3)
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.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
- - [Chat](#chat)
47
- - [Back-and-Forth Conversations](#back-and-forth-conversations)
48
- - [Without Chat](#without-chat)
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.0
68
+ gem install maritaca-ai -v 1.0.1
69
69
  ```
70
70
 
71
71
  ```sh
72
- gem 'maritaca-ai', '~> 1.0.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
- #### Chat
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
- #### Back-and-Forth Conversations
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
- #### Without Chat
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.0.gem
293
+ gem push maritaca-ai-1.0.1.gem
292
294
  ```
293
295
 
294
296
  ### Updating the README
@@ -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 '../ports/dsl/maritaca-ai/errors'
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
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.require_paths = ['ports/dsl']
31
31
 
32
- spec.add_dependency 'faraday', '~> 2.8', '>= 2.8.1'
32
+ spec.add_dependency 'faraday', '~> 2.9'
33
33
 
34
34
  spec.metadata['rubygems_mfa_required'] = 'true'
35
35
  end
data/static/gem.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Maritaca
4
4
  GEM = {
5
5
  name: 'maritaca-ai',
6
- version: '1.0.0',
6
+ version: '1.0.1',
7
7
  author: 'gbaptista',
8
8
  summary: 'Interact with Maritaca AI.',
9
9
  description: "A Ruby gem for interacting with Maritaca AI's large language models.",
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.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.0
43
+ gem install maritaca-ai -v 1.0.1
44
44
  ```
45
45
 
46
46
  ```sh
47
- gem 'maritaca-ai', '~> 1.0.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
- #### Chat
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
- #### Back-and-Forth Conversations
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
- #### Without Chat
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.0.gem
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.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: 2023-12-30 00:00:00.000000000 Z
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.8'
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.8'
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.5.3
71
+ rubygems_version: 3.3.3
78
72
  signing_key:
79
73
  specification_version: 4
80
74
  summary: Interact with Maritaca AI.