Skip to content

OpenAI.TokenEngine

Andrew Lambert edited this page Jun 1, 2024 · 4 revisions

OpenAI.TokenEngine

Class Declaration

 Protected Class TokenEngine

Remarks

This class represents the tokens of an API response. Not all endpoints provide token information.

Methods

Properties

Example

This example gets the first token of the response, its probability, and a list of alternate tokens and their probabilities.

 Dim reply As OpenAI.ChatCompletion = OpenAI.ChatCompletion.Create(chatlog, "user", "Who won the world series in 2020?")
 Dim token As String = chat.Tokens.Token(0)
 Dim probability As Double = chat.Tokens.Probability(0)
 Dim alternates() As String = chat.Tokens.AlternateTokens(0)
 Dim altprobs() As Double = chat.Tokens.AlternateProbabilities(0)
Clone this wiki locally