Class: Llmclt::Syntax::Chat
- Inherits:
-
Object
- Object
- Llmclt::Syntax::Chat
- Defined in:
- lib/llmclt/syntax/chat.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#histories ⇒ Object
readonly
Returns the value of attribute histories.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#prompts ⇒ Object
readonly
Returns the value of attribute prompts.
Instance Method Summary collapse
-
#initialize(prompts, config, histories: []) ⇒ Chat
constructor
A new instance of Chat.
- #to_json(*_args) ⇒ Object
- #to_jsonl ⇒ Object
Constructor Details
#initialize(prompts, config, histories: []) ⇒ Chat
Returns a new instance of Chat.
9 10 11 12 13 14 |
# File 'lib/llmclt/syntax/chat.rb', line 9 def initialize(prompts, config, histories: []) @prompts = Array(prompts) @config = config @histories = histories @params = build_params end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/llmclt/syntax/chat.rb', line 6 def config @config end |
#histories ⇒ Object (readonly)
Returns the value of attribute histories.
6 7 8 |
# File 'lib/llmclt/syntax/chat.rb', line 6 def histories @histories end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
7 8 9 |
# File 'lib/llmclt/syntax/chat.rb', line 7 def params @params end |
#prompts ⇒ Object (readonly)
Returns the value of attribute prompts.
6 7 8 |
# File 'lib/llmclt/syntax/chat.rb', line 6 def prompts @prompts end |
Instance Method Details
#to_json(*_args) ⇒ Object
16 17 18 |
# File 'lib/llmclt/syntax/chat.rb', line 16 def to_json(*_args) params.size == 1 ? params.first.to_json : params.to_json end |
#to_jsonl ⇒ Object
20 21 22 |
# File 'lib/llmclt/syntax/chat.rb', line 20 def to_jsonl params.map { |json| { request: json } }.map(&:to_json).join("\n") end |