Table of Contents

Class NativeAPI.TokenUnion

public static class NativeAPI.TokenUnion
Inheritance
object
NativeAPI.TokenUnion

Methods

litert_lm_token_union_delete(nint)

Destroys a LiteRT LM Token Union.

public static extern void litert_lm_token_union_delete(nint tokenUnion)

Parameters

tokenUnion nint

The token union to destroy.

litert_lm_token_union_get_ids(nint, out nint, out nuint)

Returns the token ids from a token union.

public static extern int litert_lm_token_union_get_ids(nint tokenUnion, out nint outTokens, out nuint outNumTokens)

Parameters

tokenUnion nint

The token union.

outTokens nint

A pointer to receive the internal array of token ids. The received pointer is valid only for the lifetime of the TokenUnion object.

outNumTokens nuint

A pointer to receive the number of token ids.

Returns

int

0 on success, non-zero if the type is not Ids.

litert_lm_token_union_get_string(nint)

Returns the string value from a token union.

public static extern nint litert_lm_token_union_get_string(nint tokenUnion)

Parameters

tokenUnion nint

The token union.

Returns

nint

The string value, or nint.Zero if the type is not String. The returned string is owned by the TokenUnion object and is valid only for its lifetime.

litert_lm_token_union_get_type(nint)

Returns the type of the token union.

public static extern TokenUnionType litert_lm_token_union_get_type(nint tokenUnion)

Parameters

tokenUnion nint

The token union.

Returns

TokenUnionType

The type of the token union.