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
19
20
21
|
# File 'lib/llm/providers/anthropic/response_parser.rb', line 19
def parse_completion(body)
CompletionParser.new(body).format(self)
end
|
#parse_embedding(body) ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/llm/providers/anthropic/response_parser.rb', line 7
def parse_embedding(body)
{
model: body["model"],
embeddings: body["data"].map { _1["embedding"] },
total_tokens: body.dig("usage", "total_tokens")
}
end
|