eli5.llm
- explain_prediction_openai_client(client: OpenAI, doc: str | list[dict], *, model: str, **kwargs)[source]
Calls OpenAI client, obtaining response for
doc(a string, or a list of messages), with logprobs enabled, and explains the prediction, highlighting tokens proportionally to the log probability. More likely tokens are highlighted in green, while unlikely tokens are highlighted in red. . Other keyword arguments are passed to OpenAI client, withmodelkeyword argument required.
- explain_prediction_openai_completion(completion: ChatCompletion, doc=None)[source]
Creates an explanation of the ChatCompletion’s logprobs highlighting them proportionally to the log probability. More likely tokens are highlighted in green, while unlikely tokens are highlighted in red.
docargument is ignored.
- explain_prediction_openai_logprobs(logprobs: ChoiceLogprobs, doc=None)[source]
Creates an explanation of the logprobs (available as
.choices[idx].logprobson a ChatCompletion object), highlighting them proportionally to the log probability. More likely tokens are highlighted in green, while unlikely tokens are highlighted in red.docargument is ignored.