chat_gpt_client 0.1.1 → 0.2.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/chat_gpt/client.rb +4 -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: 63a9663535742a12f4720e60dfac2589c7cfcf02ffe9c63813aa06cb7b9335e2
|
4
|
+
data.tar.gz: 6a1d4649a5ef6ba7ed711f1ba15f905e8b24e913f1224360d3070c2a372ac1c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f7331daaa81a07cef793599a7026f4b73898574dde43fd60cc6f69b553b7102fda812fed5a78567ec9100c26a1dff4df4794c5e7cdbe889bf06b8b5eb7428a7
|
7
|
+
data.tar.gz: 3bbb94c0d72d0f9fbf5c83794a827c7470c6fc31e9ca83f0615274388511e070093c834b5668ecffee1272e0d8157985026ae19ed1186c81fc41de5950c699af
|
data/Gemfile.lock
CHANGED
data/lib/chat_gpt/client.rb
CHANGED
@@ -3,13 +3,14 @@
|
|
3
3
|
module ChatGPT
|
4
4
|
# The client for the OpenAI ChatGPT API
|
5
5
|
class Client
|
6
|
-
def initialize(api_key: ENV["OPENAI_API_KEY"], system_prompt: nil)
|
6
|
+
def initialize(api_key: ENV["OPENAI_API_KEY"], system_prompt: nil, temperature: nil)
|
7
7
|
if api_key.nil? || api_key.empty?
|
8
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
|
12
12
|
@system_prompt = system_prompt
|
13
|
+
@temperature = temperature
|
13
14
|
@history = []
|
14
15
|
end
|
15
16
|
|
@@ -66,7 +67,8 @@ module ChatGPT
|
|
66
67
|
def build_body
|
67
68
|
{
|
68
69
|
model: "gpt-3.5-turbo",
|
69
|
-
messages: history
|
70
|
+
messages: history,
|
71
|
+
temperature: @temperature
|
70
72
|
}
|
71
73
|
end
|
72
74
|
|
data/lib/chat_gpt/version.rb
CHANGED