ValidateText Method  
 

The ValidateText method performs basic validation on a message prompt before it is submitted to a model.

Syntax

object.ValidateText( Prompt )

Parameters

Prompt
A String which contains the prompt to evaluate.

Return Value

A value of True is returned if the method succeeds. If the method fails, it will return False and the LastError property will contain the error code.

Remarks

The ValidateText method is intended to help applications detect invalid or malformed input before sending a request to a model. It checks for common problems such as empty strings, text that consists only of spaces or linebreaks, illegal Unicode code points, non-printable characters, and input that appears to contain binary data. This method will return False if the string contains embedded null characters.

Applications that accept message text from users or other external sources should validate the text before submitting it to a model. This can help detect malformed or invalid input before a request is sent, reducing the chance of unexpected results or incurring unnecessary usage costs.

This method does not evaluate the quality, safety, or semantic meaning of the message. Although this method is most commonly used to check prompts sent to a model, it can be used to validate any type of text to ensure it is not malformed and contains printable characters.

See Also

Prompt Property, Response Property, NormalizeText Method, SendMessage Method