Module: LLM::Anthropic::Response::Completion

Defined in:
lib/llm/providers/anthropic/response/completion.rb

Instance Method Summary collapse

Instance Method Details

#choicesObject



5
# File 'lib/llm/providers/anthropic/response/completion.rb', line 5

def choices = format_choices

#roleObject



6
# File 'lib/llm/providers/anthropic/response/completion.rb', line 6

def role = body.role

#modelObject



7
# File 'lib/llm/providers/anthropic/response/completion.rb', line 7

def model = body.model

#prompt_tokensObject



8
# File 'lib/llm/providers/anthropic/response/completion.rb', line 8

def prompt_tokens = body.usage&.input_tokens || 0

#completion_tokensObject



9
# File 'lib/llm/providers/anthropic/response/completion.rb', line 9

def completion_tokens = body.usage&.output_tokens || 0

#total_tokensObject



10
# File 'lib/llm/providers/anthropic/response/completion.rb', line 10

def total_tokens = prompt_tokens + completion_tokens