Beta features are available to users before official release. Your testing and feedback are an enormous help, please leave any feedback or bug reports you have at support@logicloop.com. Note that beta features are subject to change.
LogicLoop's AI SQL capabilities are available via API if you wish to use AI to generate SQL in your own application. First, if you haven't already created a LogicLoop account you can do so here.
You can call our SQL generation endpoint in order to generate SQL based on a user request.
Method:POSTURL:https://app.logicloop.com/<YOUR_COMPANY_SLUG>/api/v1/ai/query_generateAuthorization:Key <YOUR_API_KEY>Params:prompt:A description of the data you're looking formodel:One of oa-v1, oa-v2, oa-v2-16k, oa-v3 or ant-v1. Defaults to oa-v1.data_source_type:One of postgres, mysql, redshift, snowflake, big_query or oracledata_schema:A list of dictionaries representing your data schema
Be sure to replace <YOUR_COMPANY_SLUG> which you can find by logging into your dashboard and looking at the URL:
You can find <YOUR API_KEY> by going to Settings > Users > click on your profile > copy the API Key.
You can use either the basic or advanced data schema format below depending on the level of granularity you are looking for.
[ {"table_name":"users","columns": [ {"name":"name","type":"string","description":"The users given name" }, {"name":"id","type":"int","description":"The users unique identifier","constraint":"primary key" }, {"name":"email","type":"string","description":"The users contact email address" } ] }, {"table_name":"orders","columns": [ {"name":"id","type":"int","description":"The orders unique identifier","constraint":"primary key" }, {"name":"user_id","type":"int","description":"The id of the user who this order belongs to","constraint":"foreign key references users(id)" }, {"name":"amount","type":"int","description":"The total price of the order in USD" }, {"name":"status","type":"enum(canceled, pending, completed)","description":"The shipping status of this order" } ] }]
Sample CURL request
Response
{"query_response":"SELECT name, id, email\nFROM users\nWHERE email NOT LIKE '%@%.%';\n"}