def ev.openai

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

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

234def ev.openai(+s: String) -> Ev:
235  +d = ev.doc(doc(Bytes.from_string(s)))
236  +why = look(d, "error.message")
237  Bool.pick(Ev, String.eq(s, "[DONE]"), EEnd{},
238    Bool.pick(Ev, String.is_empty(why), ev.text(look(d, "choices.0.delta.content")), EFail{ErrApi{200, why}}))

Uses (11)

Used by (1)