Class: LLM::Response::Completion
- Inherits:
-
LLM::Response
- Object
- LLM::Response
- LLM::Response::Completion
- Defined in:
- lib/llm/response/completion.rb
Instance Method Summary collapse
-
#model ⇒ String
Returns the model name used for the completion.
-
#choices ⇒ Array<LLM::Message>
(also: #messages)
Returns an array of messages.
-
#prompt_tokens ⇒ Integer
Returns the count of prompt tokens.
-
#completion_tokens ⇒ Integer
Returns the count of completion tokens.
-
#total_tokens ⇒ Integer
Returns the total count of tokens.
Methods inherited from LLM::Response
Constructor Details
This class inherits a constructor from LLM::Response
Instance Method Details
#model ⇒ String
Returns the model name used for the completion
8 9 10 |
# File 'lib/llm/response/completion.rb', line 8 def model parsed[:model] end |
#choices ⇒ Array<LLM::Message> Also known as: messages
Returns an array of messages
15 16 17 |
# File 'lib/llm/response/completion.rb', line 15 def choices parsed[:choices] end |
#prompt_tokens ⇒ Integer
Returns the count of prompt tokens
23 24 25 |
# File 'lib/llm/response/completion.rb', line 23 def prompt_tokens parsed[:prompt_tokens] end |
#completion_tokens ⇒ Integer
Returns the count of completion tokens
30 31 32 |
# File 'lib/llm/response/completion.rb', line 30 def completion_tokens parsed[:completion_tokens] end |
#total_tokens ⇒ Integer
Returns the total count of tokens
37 38 39 |
# File 'lib/llm/response/completion.rb', line 37 def total_tokens prompt_tokens + completion_tokens end |