In this section, we present how to bring Cohere models to MindsDB.

Cohere offers world-class generative models and industry-best retrieval capabilities, which is the key combination to unlocking Generative AI value for the enterprise.

Read on to find out how to use Cohere models within MinsdDB.


MindsDB provides the Cohere handler that enables you to create Cohere models within MindsDB.

AI Engine

Before creating a model, it is required to create an AI engine based on the provided handler.

If you installed MindsDB locally, make sure to install all Cohere dependencies by running pip install .[cohere] or from the requirements.txt file.

You can create an Cohere engine using this command:

CREATE ML_ENGINE cohere_engine
FROM cohere
    api_key = 'your-cohere-api-key';

Please note that you need to provide your Cohere API key. Once you sign up for a Cohere account, an API key can be requested from the Cohere dashboard. Learn more here.

The name of the engine (here, cohere_engine) should be used as a value for the engine parameter in the USING clause of the CREATE MODEL statement.

AI Model

The CREATE MODEL statement is used to create, train, and deploy models within MindsDB.

CREATE MODEL cohere_model
PREDICT language
    task = 'language-detection',
    column = 'text',
    engine = 'cohere_engine'


taskIt defines the task to be accomplished.
columnIt defines the column with the text to be acted upon.
engineIt defines the Cohere engine.
api_keyIt is used to provide your Cohere API key to gain access to the model.


Once you have created an Cohere model, you can use it to make predictions.

SELECT text, language
FROM mindsdb.cohere_model
WHERE question = 'Здравствуй, Мир';

On execution, we get:

| text            | language |
| Здравствуй, Мир |  Russian |

Supported Tasks

The following tasks are supported by the Cohere handler:

  • language-detection: detect the language of a given text.
  • text-generation: generate text based on a given prompt.
  • text-summarization: summarize a given text.

For more information about the Cohere handler, visit the repository here.