Public Plugin

Database SQL

This is a public plugin on the GPTBots platform that developers can use to connect their own databases and perform business data queries and analytics through natural language.

URL

scheme://database_url

  • Scheme only supports http and https

  • URL format: dialect://username:password@HOST:PORT/database_name

ParameterDescription

dialect

Database type, all lowercase, currently only supports mysql, clickhouse

username

Database username

password

Database password

HOST

Database hostname or IP address

PORT

Database port

database_name

Database name

The LLM used by this plugin is ChatGPT-3.5-16K. The total number of tokens for all table structure information and the first sample row of each table in the database should not exceed 16K, otherwise the LLM will exceed the limit and report an error.

paths

Only one uniform resource locator (URI) is supported, with only one get method allowed in the URI, one query parameter q, and the rest are agreed to be common.

Plugin Protocol

{
  "openapi": "3.0.0",
  "servers": [
    {
      "url": "http://mysql://common_u:$123&456@127.0.0.1:3306/db_crm"
    }
  ],
  "paths": {
    "/": {
      "get": {
        "description": "CRM Database",
        "operationId": "Extract query request questions about CRM data, do not generate SQL.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "queried question",
            "required": true,
            "schema": {
              "type": "string",
              "default": "question"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "Authentication failed"
          }
        }
      }
    }
  }
}

Last updated