r"""Get the probabilities of each token in the completion.
(completion: ChatCompletion)
| 101 | |
| 102 | |
| 103 | def get_probabilities(completion: ChatCompletion) -> List[List[TokenLogProb]]: |
| 104 | r"""Get the probabilities of each token in the completion.""" |
| 105 | log_probs = [] |
| 106 | for c in completion.choices: |
| 107 | content = c.logprobs.content |
| 108 | print(content) |
| 109 | log_probs_for_choice = [] |
| 110 | for openai_token_logprob in content: |
| 111 | token = openai_token_logprob.token |
| 112 | logprob = openai_token_logprob.logprob |
| 113 | log_probs_for_choice.append(TokenLogProb(token=token, logprob=logprob)) |
| 114 | log_probs.append(log_probs_for_choice) |
| 115 | return log_probs |
| 116 | |
| 117 | |
| 118 | class AzureAIClient(ModelClient): |
nothing calls this directly
no outgoing calls
no test coverage detected