API#

The Dataherald Engine exposes RESTful APIs that can be used to:

  • 🔌 Connect to and manage connections to databases

  • 🔑 Add context to the engine through scanning the databases, adding database level instructions, adding descriptions to tables and columns and adding golden records

  • 🙋‍♀️ Ask natural language questions from the relational data

Our APIs have resource-oriented URL built around standard HTTP response codes and verbs. The core resources are described below.

Database Connections#

The database-connections object allows you to define connections to your relational data stores.

Related endpoints are:

Database connection resource example:

{
    "alias": "string",
    "use_ssh": false,
    "connection_uri": "string",
    "path_to_credentials_file": "string",
    "llm_api_key": "string",
    "ssh_settings": {
        "db_name": "string",
        "host": "string",
        "username": "string",
        "password": "string",
        "remote_host": "string",
        "remote_db_name": "string",
        "remote_db_password": "string",
        "private_key_password": "string",
        "db_driver": "string"
    }
}

Responses#

The responses object is created from the answering natural language questions from the relational data.

The related endpoints are:

Response resource example:

{
  "question_id": "string",
  "response": "string",
  "intermediate_steps": [
    "string"
  ],
  "sql_query": "string",
  "sql_query_result": {
    "columns": [
      "string"
    ],
    "rows": [
      {}
    ]
  },
  "sql_generation_status": "INVALID",
  "error_message": "string",
  "exec_time": 0,
  "total_tokens": 0,
  "total_cost": 0,
  "confidence_score": 0,
  "created_at": "2023-10-12T16:26:40.951158"
}

Table Descriptions#

The table-descriptions object is used to add context about the tables and columns in the relational database. These are then used to help the LLM build valid SQL to answer natural language questions.

Related endpoints are:

Table description resource example:

{
    "columns": [{}],
    "db_connection_id": "string",
    "description": "string",
    "examples": [{}],
    "table_name": "string",
    "table_schema": "string"
}

Database Instructions#

The database-instructions object is used to set constraints on the SQL that is generated by the LLM. These are then used to help the LLM build valid SQL to answer natural language questions based on your business rules.

Related endpoints are:

Instruction resource example:

{
    "db_connection_id": "string",
    "instruction": "string",
}