chat_gpt_client 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -0
- data/lib/chat_gpt/client.rb +2 -2
- data/lib/chat_gpt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59c26df8d1c546231a9d61f1ce2a5edd9120b5145735c4f2b49ab817816294b9
|
4
|
+
data.tar.gz: 222bf04989aa046aca57a560441c78c1301bfa72a3eab515e7182fa9af846d29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43a53ed20cc8b199f750e3727fe3aabc22dfc67a80a099662c55bc604a0e1b22713a0d99e76875d597ed4f57e3ea35fd1b5039921f0a91f91a76be4f92f97061
|
7
|
+
data.tar.gz: bef11e29cede10873df76443e10bb20d895e40b82acafb5f61d346d0545f845bf2887ed4574aa2012bf65e452d3346c27f77603e87cc25e9e4bea166a81a072b
|
data/Gemfile.lock
CHANGED
data/lib/chat_gpt/client.rb
CHANGED
@@ -5,7 +5,7 @@ module ChatGPT
|
|
5
5
|
class Client
|
6
6
|
def initialize(api_key: ENV["OPENAI_API_KEY"], system_prompt: nil)
|
7
7
|
if api_key.nil? || api_key.empty?
|
8
|
-
raise Error, "You must provide an API token or set the OPENAI_API_KEY environment variable"
|
8
|
+
raise ChatGPT::Error, "You must provide an API token or set the OPENAI_API_KEY environment variable"
|
9
9
|
end
|
10
10
|
|
11
11
|
@api_key = api_key
|
@@ -58,7 +58,7 @@ module ChatGPT
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def extract_response(response)
|
61
|
-
raise Error, "Error: #{response.code} - #{response.body}" unless response.code == "200"
|
61
|
+
raise ChatGPT::Error, "Error: #{response.code} - #{response.body}" unless response.code == "200"
|
62
62
|
|
63
63
|
JSON.parse(response.body)
|
64
64
|
end
|
data/lib/chat_gpt/version.rb
CHANGED