Here is how you can create an ML engine directly from Java code:
Syntax
/**
* Create an ML engine
*
* @param name - Name of the ML engine
* @param handler - Handler object
* @param connectionData - Connection data
* @return MLEngine
*/
public MLEngine createMLEngine(String name, Handler handler, Map<String, String> connectionData);
/**
* Create an ML engine
*
* @param name - Name of the ML engine
* @param handlerName - Name of the handler
* @param connectionData - Connection data
* @return MLEngine
*/
public MLEngine createMLEngine(String name, String handlerName, Map<String, String> connectionData);
/**
* Create an ML engine
*
* @param name - Name of the ML engine
* @param handler - Handler object
* @return MLEngine
*/
public MLEngine createMLEngine(String name, Handler handler);
/**
* Create an ML engine
*
* @param name - Name of the ML engine
* @param handlerName - Name of the handler
* @return MLEngine
*/
public MLEngine createMLEngine(String name, String handlerName);
Example
Server server = MindsDB.connect();
MLEngine geminiEngine = server.createMLEngine("gemini_engine", "google_gemini", Map.of(
"api_key","your_api_key"
));
MLEngine ollamaEngine = server.createMLEngine("ollama_engine", "ollama");