/ainlbot

nlbot for development a new features

Primary LanguagePython

API-server

Example local build cmd:

docker build -f Dockerfile -t nlsql-api-server .

Example local run cmd:

docker run --rm -p 8080:80 --env-file .env nlsql-api-server

Docker env params:

  • DatabaseType (Options: 'mysql', 'mssql', 'snowflake', 'redshift', 'postgresql', 'bigquery')
  • DataSource (For 'snowflake' analogue of the 'Account' db parameter)
  • Warehouse (Used when DataSource='snowflake')
  • DbSchema (Used when DataSource='snowflake')
  • DbName
  • DbUser
  • DbPassword
  • DbPort (Used when DataSource is 'mysql' or 'postgresql')
  • ApiEndPoint
  • ApiToken
  • AppId
  • AuthTenantID (Optional)
  • AppPassword
  • StaticEndPoint
  • client_email (_Used when DataSource='bigquery'*)
  • token_uri (_Used when DataSource='bigquery'*)
  • private_key (_Used when DataSource='bigquery'*)
  • project_id (_Used when DataSource='bigquery'*)
  • FromYear (Starting year from which to measure trusted data)
  • ToYear (The final year up to which trusted data is measured (inclusive))
  • CorridorsMode (1 = standard mode (flat corridors over given time period, minimum 1 year of data); 2 = seasonal mode (monthly calculated corridors, minimum 2 years' of data))
  • WindowSize (Size of the rolling window when using seasonal corridors mode (default = 5))
  • BoundarySensitivity (Sensitivity for the lower and upper bounds for anomaly detection (mean +- BoundarySensitivity * standard deviation))
  • EmailAddress (Email address for sending anomaly detection email)
  • EmailPassword (Password for senders email (app password may need to be used for gmail and outlook accounts))
  • RecipientEmail (Email addresses of recipients (seperated by comma (no space)))
  • AzureAppName (Azure app name where interactive graph files are stored)
  • OpenAiAPI (API key for OpenAI integration (informative emails))
  • OpenAiBase (Base URL for OpenAI integration)
  • OpenAiType (Type of OpenAI service, (e.g. azure))
  • OpenAiVersion (Open AI version)
  • OpenAiName (Name of OpenAI model to be used)
  • SystemMessage (System Message for OpenAI for initial context and instructions given to OpenAI model)
  • Frequency (Frequency (in days) for which the anomaly detection should take place)

API endpoint: /nlsql-analyzer

Method: POST

JSON: {"channel_id": str, "text": str}

Nginx

location ~* \.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|mid|midi|wav|bmp|rtf|js|swf|docx|xlsx|svg|csv|html)$ to root /var/www/html

location /api/messages to proxy_pass http://localhost:8000