Class: LLM::Anthropic::ResponseParser::CompletionParser
- Inherits:
-
Object
- Object
- LLM::Anthropic::ResponseParser::CompletionParser
- Defined in:
- lib/llm/providers/anthropic/response_parser/completion_parser.rb
Instance Method Summary collapse
- #format(response) ⇒ Object
-
#initialize(body) ⇒ CompletionParser
constructor
A new instance of CompletionParser.
Constructor Details
#initialize(body) ⇒ CompletionParser
Returns a new instance of CompletionParser.
7 8 9 |
# File 'lib/llm/providers/anthropic/response_parser/completion_parser.rb', line 7 def initialize(body) @body = OpenStruct.from_hash(body) end |
Instance Method Details
#format(response) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/llm/providers/anthropic/response_parser/completion_parser.rb', line 11 def format(response) { model:, prompt_tokens:, completion_tokens:, total_tokens:, choices: format_choices(response) } end |