class_docstr: This integration seamlessly combines MindsDB and Leonardo AI to create a powerful
  AI-driven solution for creative content generation.
  
  Content Generation with Leonardo AI: Harness the power of advanced generative
  models for creative content production. From realistic images to artistic text, Leonardo
  AI opens up new possibilities for content creators.
class_docstr_tok: ["This","integration","seamlessly","combines","MindsDB","and","Leonardo","AI","to","create","a","powerful","AI-driven","solution","for","creative","content","generation",".","Content","Generation","with","Leonardo","AI",":","Harness","the","power","of","advanced","generative","models","for","creative","content","production",".","From","realistic","images","to","artistic","text",",","Leonardo","AI","opens","up","new","possibilities","for","content","creators","."]
code: def create(self, target: str, args=None, **kwargs):
      args["target"] = target
  
      if "using" not in args:
          raise Exception("Leornardo Engine requires a USING clause!")
  
      self.model_storage.json_set("args", args)
      api_key = self._get_leonardo_api_key(
          args, self.engine_storage
      )  # fetch api key
  
      # check if API key is valid
      self.connection = requests.get(
          "https://cloud.leonardo.ai/api/rest/v1/me",
          headers={
              "accept": "application/json",
              "authorization": f"Bearer {api_key}",
          },
      )
  
      # if valid, check if the model is valid
      try:
          if self.connection.status_code == 200:
              # get all the available models
              available_models = self._get_platform_model(args)
              if not args["using"]["model"]:
                  args["using"]["model"] = self.default_model
              elif (
                  args["using"]["model"] not in available_models
              ):  # if invalid model_id is provided
                  raise Exception(
                      "Invalid Model ID. Please use a valid Model"
                  )
          else:
              raise Exception(
                  "Unable to make connection, please verify the API key."
              )
      except Exception:
          raise Exception(
              "Auth Connection Error, please the modelId or API key"
          )
  
file_path: mindsdb/mindsdb/integrations/handlers/leonardoai_handler/leonardo_ai_handler.py
imports: import os
  import requests
  import time
  from typing import Dict, Optional
  from mindsdb.integrations.libs.llm_utils import get_completed_prompts
  import pandas
  from mindsdb.integrations.libs.base import BaseMLEngine
  from mindsdb.utilities import log
  from mindsdb.interfaces.storage.model_fs import HandlerStorage
  from mindsdb.utilities.config import Config
label_desc: Use image node_id 2 for calling the LeonardoAIHandler obj's underlying member method code with example usage: obj.create(target, args) without return types