Class: Langchain::LLM::AwsBedrockMetaResponse
Instance Attribute Summary
Attributes inherited from BaseResponse
#context, #model, #raw_response
Instance Method Summary
collapse
#chat_completion, #chat_completions, #created_at, #embedding, #embeddings, #initialize
Instance Method Details
#completion ⇒ Object
5
6
7
|
# File 'lib/langchain/llm/response/aws_bedrock_meta_response.rb', line 5
def completion
completions.first
end
|
#completion_tokens ⇒ Object
21
22
23
|
# File 'lib/langchain/llm/response/aws_bedrock_meta_response.rb', line 21
def completion_tokens
raw_response.dig("generation_token_count").to_i
end
|
#completions ⇒ Object
9
10
11
|
# File 'lib/langchain/llm/response/aws_bedrock_meta_response.rb', line 9
def completions
[raw_response.dig("generation")]
end
|
#prompt_tokens ⇒ Object
17
18
19
|
# File 'lib/langchain/llm/response/aws_bedrock_meta_response.rb', line 17
def prompt_tokens
raw_response.dig("prompt_token_count").to_i
end
|
#stop_reason ⇒ Object
13
14
15
|
# File 'lib/langchain/llm/response/aws_bedrock_meta_response.rb', line 13
def stop_reason
raw_response.dig("stop_reason")
end
|
#total_tokens ⇒ Object
25
26
27
|
# File 'lib/langchain/llm/response/aws_bedrock_meta_response.rb', line 25
def total_tokens
prompt_tokens + completion_tokens
end
|