rubyai 0.0.2 → 0.1.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubyai.rb +3 -44
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5256791f12cb280da3330144e2b4d8e76e76e4731a21a66070d07a90c320b4a
4
- data.tar.gz: fdaf1f885972be0f5a45c497f2571f0cc93c11042abb1168cfb6fc41d34be46b
3
+ metadata.gz: bb31be8c4fbb608addbaa5fd17474999d20bd0ff12931d0701df19a3f1bbb060
4
+ data.tar.gz: cd2f8e0423796c303e4e11a1d0f2a1d503e7323b70c1d1cf0ffa53e82ef20471
5
5
  SHA512:
6
- metadata.gz: d01dbe922f83ca6d3c5b842b93ebb884d231941018f27f43ba2b74913df76ee923d9b0b0027d909c1c9ac76e0e749649d73dd8ea6f19eb740739b1a12a8383eb
7
- data.tar.gz: c88a986a14b3d7bd54ae020420748c090f6c2d9b2fa5a0ad8adc4ff50a425f35d0ea22bc0bd62468ab6ba2d1d26f25e5fc7c4b0116a6114ed762e7cfbbde326a
6
+ metadata.gz: b84eb8e2d8a807886b85e1ff3dd9904b2746fb1363147d0125497ef43035a4850123eb66c7f208828382c12db38ac5a547a0b7b4e82a84a207aa04a34533df7f
7
+ data.tar.gz: 772685e21ceaf86b478326ac00c878797fe01f272dbc2eb86f9d298cabb91fe98f0430e5765f46abd5fd01e6619b0ff9622038b014ca264fbb21e3a1525723fb
data/lib/rubyai.rb CHANGED
@@ -1,47 +1,6 @@
1
- require 'uri'
2
- require 'net/http'
3
- require 'json'
1
+ require_relative "rubyai/client"
2
+ require_relative "rubyai/configuration"
4
3
 
5
4
  module RubyAI
6
5
  class Error < StandardError; end
7
-
8
- class Client
9
- BASE_URL = URI.parse("https://api.openai.com/v1/chat/completions")
10
-
11
- def initialize(api_key, messages, temperature: 0.7, model: "gpt-3.5-turbo")
12
- @api_key = api_key
13
- @messages = messages
14
- @model = model
15
- @temperature = temperature
16
- end
17
-
18
- attr_accessor :api_key, :model, :messages, :temperature
19
-
20
- def call
21
- response = Net::HTTP.start(BASE_URL.host, BASE_URL.port, use_ssl: true) do |http|
22
- request = Net::HTTP::Post.new(BASE_URL.request_uri, header)
23
- request.body = body.to_json
24
- http.request(request)
25
- end
26
-
27
- JSON.parse(response.body)
28
- end
29
-
30
- private
31
-
32
- def body
33
- {
34
- 'model': model,
35
- 'messages': messages,
36
- 'temperature': temperature
37
- }
38
- end
39
-
40
- def header
41
- {
42
- 'Content-Type': 'application/json',
43
- 'Authorization': "Bearer #{api_key}"
44
- }
45
- end
46
- end
47
- end
6
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Shapalov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-22 00:00:00.000000000 Z
11
+ date: 2024-04-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -36,8 +36,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
38
  requirements: []
39
- rubygems_version: 3.2.33
39
+ rubygems_version: 3.5.6
40
40
  signing_key:
41
41
  specification_version: 4
42
- summary: A Ruby gem for the OpenAI GPT-3 API
42
+ summary: A Ruby gem for the OpenAI (GPT-3 and GPT-4) API
43
43
  test_files: []