# Choose Best

The Choose Best endpoint uses likelihood to perform classification. Given a query text that you'd like to classify between a number of options, Choose Best will return a score between the query and each option. For some examples of Choose Best see classifiying questions and sentiment analysis.

## Usage#

curl --location --request POST 'https://api.cohere.ai/{model}/choose-best' \
--data-raw '{
"query": "{query}",
"options": [{options}],
"mode": "{mode}"
}'

### Sample Response#

{
"scores": [
-8.244808,
-8.406918,
-10.184017
],
"tokens": [
["book"],
["glasses"],
["dog"]
],
"token_log_likelihoods": [
[-8.244808],
[-8.406918],
[-10.184017]
]
}


## Request#

### query#

string

Used to query the options.

### options#

array of strings
Each string concatenates to the query.

### mode#

One of PREPEND_OPTION|APPEND_OPTION to specify where the option string will be placed and how to compute the log-likelihood.

If PREPEND_OPTION is selected, the output will be the log-likelihood of the $query$ conditioned on the $option$:   $\log\ p(\textrm{query} | \textrm{option})$

If APPEND_OPTION is selected, the output will be the log-likelihood of the $option$ conditioned on the $query$:   $\log\ p(\textrm{option} | \textrm{query})$

See the Choose Best modes page for more details.

## Response#

### scores#

array of floats
An array of floats corresponding to a score for each of the options, where a higher score represents a more likely query-option pair. This score is computed as:
$\textrm{score} = \frac{\textrm{log\_likelihood}}{\textrm{n\_tokens}}$

where n_tokens is the number of tokens that are summed over to compute the log_likelihood.

### tokens#

array of tokens
An array of tokens corresponding to the tokens for each of the options. The tokens are represented as an array of strings.

### token_log_likelihoods#

array of token log likelihoods

An array of log likelihoods corresponding to the tokens of each of the options. The log likelihoods are represented as an array of floats.