def reply.of

bend-kit-llm@0.13.0.1 · llm.bend:189

import bend-kit-llm@0.13.0.1/llm.bend as Llm
import Base

189def reply.of(api: Api, +d: List<&2, Leaf>) -> Reply:
190  match api:
191    case Anthropic{}:
192      Reply{look(d, "id"), look(d, "model"), blocks(d), look(d, "stop_reason"),
193        count(look(d, "usage.input_tokens")), count(look(d, "usage.output_tokens"))}
194    case OpenAI{}:
195      Reply{look(d, "id"), look(d, "model"), look(d, "choices.0.message.content"), look(d, "choices.0.finish_reason"),
196        count(look(d, "usage.prompt_tokens")), count(look(d, "usage.completion_tokens"))}

Uses (7)

Used by (1)