View source: R/call_model_api.R
validate_modality | R Documentation |
Validates that the modality specified in the query is allowed for the v2.0 model. This function checks that the 'modality' value is one of the supported modalities.
validate_modality(query)
query |
A list containing the query data. |
Invisibly returns TRUE if validation passes. Throws an error If the modality key is missing or if the selected modality is not allowed.
# Create a valid query
query <- get_valid_query()
validate_modality(query) # Passes validation
# Example with invalid modality
## Not run:
invalid_query <- get_valid_query()
invalid_query$modality <- "unsupported_modality"
validate_modality(invalid_query) # Throws error for invalid modality
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.