Skip to contents

Validate a message to ensure it has the required fields and the correct data types for the chat() function.

Usage

validate_message(message)

Arguments

message

A list with a single message of list class.

Value

TRUE if message is valid, otherwise an error is thrown.

Examples

validate_message(create_message("Hello"))
#> [1] TRUE
validate_message(list(role = "user", content = "Hello"))
#> [1] TRUE