chat_gpt_error_handler 0.2.2.1 → 0.2.3

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: 8d58bdea8e5604d2160eec14444c9be586d5ebab1e6ac16ee9c76175080b8984
4
- data.tar.gz: 0b20217fe18f736085f47bde8be9cc4a4a0905291b504490d4e39bfe76dd756f
3
+ metadata.gz: b5cf8b5513b4691e6fdc33962168fe60b074634637814d101ed5d7e38378645d
4
+ data.tar.gz: b58f3066774ada0edc7f9e769d61ae073bfaba4eda62ede43e8de9247bd1d1cf
5
5
  SHA512:
6
- metadata.gz: 792a0f62cab7ffa3b770225ad9edd8c122d7e2f7bb2b506bdf381af766c60ea5cc147073b2a4babc3b1cea2494054555710fef600ead813e91f89e14405de448
7
- data.tar.gz: 96d5581efe1cb5954c429f973fd2527d415a886da0267ea620c7deac813cc6cbcb37512c37244f453a38235057a05e72082f3240da3647503d0bf0a9243ea474
6
+ metadata.gz: 6da82e0360ab40b1bb8688c7b4d5d101a29d439541d7ddd026ea61d7c08221ad915cff0f6873098626bdab9737bb83c09615b5eeb39eaea1545a4e68fd4251e6
7
+ data.tar.gz: 8116fc3c2318c4663eb97f0510c0dcc2e2fb114696247b85c5078b1cfbc3f0db5fadc288f514bba7aedbcb03a793c8926579cf55059c7e421ca88dacad19811f
@@ -34,22 +34,25 @@ module ChatGptErrorHandler
34
34
  fix the error. Clearly list possible reasons and a solution.
35
35
  Your answer will be displayed in the terminal for the user to see right
36
36
  before the backtrace of the error. Do NOT repeat the error message back verbatim.
37
- Here is the error message: '#{error.message}'. Possible reason or solution?"
38
- response = client.completions(
39
- parameters: {
40
- model: "text-davinci-002",
41
- prompt: prompt,
42
- n: 1,
43
- temperature: 0.85,
44
- max_tokens: 250,
45
- stop: nil
46
- }
47
- )
37
+ I will give you the error and I want the possible reason or solution?"
38
+
39
+ query = error.message
40
+
41
+ response = client.chat(
42
+ parameters: {
43
+ model: "gpt-3.5-turbo-0613",
44
+ messages: [
45
+ { role: "system", content: prompt },
46
+ { role: "user", content: query },
47
+ ],
48
+ temperature: 0.85,
49
+ },
50
+ )
48
51
 
49
52
  response_text = if response["choices"].nil?
50
53
  "GPT returned an empty response to your error message."
51
54
  else
52
- response["choices"].map { |c| c["text"].to_s }.join("")
55
+ response["choices"][0]["message"]["content"]
53
56
  end
54
57
 
55
58
  shortened_response_text = []
@@ -1,3 +1,3 @@
1
1
  module ChatGptErrorHandler
2
- VERSION = "0.2.2.1"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chat_gpt_error_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Schwaderer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-28 00:00:00.000000000 Z
11
+ date: 2023-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails