Class: Copilot2GPT::ChatRequest
- Inherits:
-
Object
- Object
- Copilot2GPT::ChatRequest
- Defined in:
- lib/copilot2gpt/chat_request.rb
Instance Attribute Summary collapse
-
#intent ⇒ Object
Returns the value of attribute intent.
-
#messages ⇒ Object
Returns the value of attribute messages.
-
#model ⇒ Object
Returns the value of attribute model.
-
#n ⇒ Object
Returns the value of attribute n.
-
#one_time_return ⇒ Object
Returns the value of attribute one_time_return.
-
#stream ⇒ Object
Returns the value of attribute stream.
-
#temperature ⇒ Object
Returns the value of attribute temperature.
-
#top_p ⇒ Object
Returns the value of attribute top_p.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ ChatRequest
constructor
A new instance of ChatRequest.
- #to_json ⇒ Object
Constructor Details
#initialize(args) ⇒ ChatRequest
Returns a new instance of ChatRequest.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/copilot2gpt/chat_request.rb', line 5 def initialize(args) @messages = args[:messages] @model = args[:model] @temperature = args[:temperature] @top_p = args[:top_p] @n = args[:n] @stream = args[:stream] @intent = args[:intent] @one_time_return = args[:one_time_return] end |
Instance Attribute Details
#intent ⇒ Object
Returns the value of attribute intent.
3 4 5 |
# File 'lib/copilot2gpt/chat_request.rb', line 3 def intent @intent end |
#messages ⇒ Object
Returns the value of attribute messages.
3 4 5 |
# File 'lib/copilot2gpt/chat_request.rb', line 3 def @messages end |
#model ⇒ Object
Returns the value of attribute model.
3 4 5 |
# File 'lib/copilot2gpt/chat_request.rb', line 3 def model @model end |
#n ⇒ Object
Returns the value of attribute n.
3 4 5 |
# File 'lib/copilot2gpt/chat_request.rb', line 3 def n @n end |
#one_time_return ⇒ Object
Returns the value of attribute one_time_return.
3 4 5 |
# File 'lib/copilot2gpt/chat_request.rb', line 3 def one_time_return @one_time_return end |
#stream ⇒ Object
Returns the value of attribute stream.
3 4 5 |
# File 'lib/copilot2gpt/chat_request.rb', line 3 def stream @stream end |
#temperature ⇒ Object
Returns the value of attribute temperature.
3 4 5 |
# File 'lib/copilot2gpt/chat_request.rb', line 3 def temperature @temperature end |
#top_p ⇒ Object
Returns the value of attribute top_p.
3 4 5 |
# File 'lib/copilot2gpt/chat_request.rb', line 3 def top_p @top_p end |
Class Method Details
.with_default(content, params) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/copilot2gpt/chat_request.rb', line 30 def with_default(content, params) default = { messages: [ {"role" => "system", "content" => "\nYou are ChatGPT, a large language model trained by OpenAI.\nKnowledge cutoff: 2021-09\nCurrent model: gpt-4\nCurrent time: 2023/11/7 11: 39: 14\n"}, {"role" => "user", "content" => content} ], model: "gpt-4", temperature: 0.5, top_p: 1, n: 1, stream: true, intent: true, one_time_return: false }.merge(params) new(default) end |
Instance Method Details
#to_json ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/copilot2gpt/chat_request.rb', line 16 def to_json { messages: @messages, model: @model, temperature: @temperature, top_p: @top_p, n: @n, stream: @stream, intent: @intent, one_time_return: @one_time_return }.to_json end |