assertMetadata

fun assertMetadata(key: String, value: String)

Asserts the given metadata key-value pair is valid, and can be sent to the OpenAI API.

Parameters

key

The key, which must be <= 64 characters

value

The value, which must be <= 512 characters

Throws

If the key or value is too long


fun assertMetadata(metadata: Map<String, String>)

Asserts the given metadata map contains valid key-value pairs (see assertMetadata), and that the map has <= 16 key-value pairs.

Parameters

metadata

The map of metadata to validate

Throws

If the map has too many key-value pairs, or if any of the key-value pairs are invalid