Table of Contents

Class NativeAPI.Responses

public static class NativeAPI.Responses
Inheritance
object
NativeAPI.Responses

Methods

litert_lm_responses_delete(nint)

Destroys a LiteRT LM Responses object.

public static extern void litert_lm_responses_delete(nint responses)

Parameters

responses nint

The responses to destroy.

litert_lm_responses_get_num_candidates(nint)

Returns the number of response candidates.

public static extern int litert_lm_responses_get_num_candidates(nint responses)

Parameters

responses nint

The responses object.

Returns

int

The number of candidates.

litert_lm_responses_get_num_token_scores_at(nint, int)

Returns the number of tokens for which scores are present at a given index.

public static extern int litert_lm_responses_get_num_token_scores_at(nint responses, int index)

Parameters

responses nint

The responses object.

index int

The index of the response.

Returns

int

The number of token scores. Returns 0 if index is out of bounds or no token scores are present.

litert_lm_responses_get_response_text_at(nint, int)

Returns the response text at a given index.

public static extern nint litert_lm_responses_get_response_text_at(nint responses, int index)

Parameters

responses nint

The responses object.

index int

The index of the response.

Returns

nint

The response text. The returned string is owned by the Responses object and is valid only for its lifetime. Returns nint.Zero if index is out of bounds.

litert_lm_responses_get_score_at(nint, int)

Returns the score at a given index.

public static extern float litert_lm_responses_get_score_at(nint responses, int index)

Parameters

responses nint

The responses object.

index int

The index of the response.

Returns

float

The score. Returns 0.0f if index is out of bounds or no score is present.

litert_lm_responses_get_token_length_at(nint, int)

Returns the token length at a given index.

public static extern int litert_lm_responses_get_token_length_at(nint responses, int index)

Parameters

responses nint

The responses object.

index int

The index of the response.

Returns

int

The token length. Returns 0 if index is out of bounds or no token length is present.

litert_lm_responses_get_token_scores_at(nint, int)

Returns the token scores at a given index.

public static extern nint litert_lm_responses_get_token_scores_at(nint responses, int index)

Parameters

responses nint

The responses object.

index int

The index of the response.

Returns

nint

A pointer to the internal array of token scores. Returns nint.Zero if index is out of bounds or no token scores are present.

litert_lm_responses_has_score_at(nint, int)

Returns whether the response contains a score at the given index.

public static extern bool litert_lm_responses_has_score_at(nint responses, int index)

Parameters

responses nint

The responses object.

index int

The index of the response.

Returns

bool

true if the score is available at the given index, false otherwise.

litert_lm_responses_has_token_length_at(nint, int)

Returns whether the response contains a token length at the given index.

public static extern bool litert_lm_responses_has_token_length_at(nint responses, int index)

Parameters

responses nint

The responses object.

index int

The index of the response.

Returns

bool

true if the token length is available at the given index, false otherwise.

litert_lm_responses_has_token_scores_at(nint, int)

Returns whether the response contains token scores at the given index.

public static extern bool litert_lm_responses_has_token_scores_at(nint responses, int index)

Parameters

responses nint

The responses object.

index int

The index of the response.

Returns

bool

true if token scores are available at the given index, false otherwise.