MindsDB connects to various data sources and LLMs, bringing data and AI together for easy AI automation.

With Portkey, you can run MindsDB AI systems with 250+ LLMs and implement enterprise-grade features like LLM observability, caching, advanced routing, and more to build production-grade MindsDB AI apps.

Prerequisites

Before proceeding, ensure the following prerequisites are met:

  1. Install MindsDB locally via Docker or Docker Desktop.
  2. To use Portkey within MindsDB, install the required dependencies following this instruction.
  3. Obtain the Portkey API key required to deploy and use Portkey within MindsDB.

Setup

1

Create an AI engine from the Portkey handler

  • You can pass all the parameters that are supported by Portkey inside the USING clause.
  • Check out the Portkey handler implementation here.

Portkey’s configs are a powerful way to build robust AI systems. You can use them to implement guardrails, caching, conditional routing and much more in your AI apps.

2

Create a model with portkey_engine

  • You can pass all the parameters supported by Portkey Chat completions here inside the USING clause.
Create Portkey Model
CREATE MODEL portkey_model
PREDICT answer
USING
      engine = 'portkey_engine',
      temperature = 0.2;

Learn more about the supported paramteres in Chat Completions here.

3

Query the model to get predictions

Query Portkey Model
SELECT question, answer
FROM portkey_model
WHERE question = 'Where is Stockholm located?';

Here is the output:

Output
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
| question                    | answer                                                                                                                                             |
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
| Where is Stockholm located? |  Stockholm is the capital and largest city of Sweden. It is located on Sweden's south-central east coast, where Lake Mälaren meets the Baltic Sea. |
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+

Next Steps

Check out the MindsDB Use Cases page to see more examples.