Module: LLM::Anthropic::ResponseParser
- Defined in:
- lib/llm/providers/anthropic/response_parser.rb,
lib/llm/providers/anthropic/response_parser/completion_parser.rb
Defined Under Namespace
Classes: CompletionParser
Instance Method Summary
collapse
Instance Method Details
#parse_completion(body) ⇒ Hash
20
21
22
|
# File 'lib/llm/providers/anthropic/response_parser.rb', line 20
def parse_completion(body)
CompletionParser.new(body).format(self)
end
|
#parse_embedding(body) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/llm/providers/anthropic/response_parser.rb', line 8
def parse_embedding(body)
{
model: body["model"],
embeddings: body["data"].map { _1["embedding"] },
total_tokens: body.dig("usage", "total_tokens")
}
end
|