AI-Assisted Query Generation
Using Neurelo’s AI Assist capability to generate Custom Queries
Last updated
Using Neurelo’s AI Assist capability to generate Custom Queries
Last updated
Custom Query with AI Assist runs on a smart AI engine based on a Large Language Model (LLM). This setup allows developers to easily generate query code, test and confirm the query, and quickly deploy complex queries as custom API endpoints without a hitch.
The AI assist part makes building these queries a breeze by giving clever suggestions and optimizations. The AI is trained to understand the specific language and rules of databases (MongoDB, PostgreSQL, MySQL), including syntax and meaning, along with the context of your application like schema and data models.
This feature is particularly useful when you need to generate complex queries quickly and accurately. Here’s how to use it:
Accessing AI Assist:
Locate the "AI Assist" button on the Custom Query page. This button is situated next to the "Test Query" button. Refer to the provided image for its exact location.
Click on the "AI Assist" button to activate the feature.
Entering Your Query Prompt:
Upon clicking AI Assist, a side panel on the right will appear prompting you to enter your query requirements.
For example, if you need to retrieve all authors who have written a certain number of books, input a prompt that clearly states this requirement.
Sending the Query Prompt:
After typing your prompt, click the "Send" button.
The AI Assist module will then process your request and start generating the corresponding query.
Reviewing the Generated Query:
Once the query generation is complete, the AI Assist will display the query based on your provided prompt, as illustrated in the below image.
You can review this query to ensure it meets your requirements and make any necessary adjustments.
Advantages of AI-Assisted Query Generation:
This feature saves time and reduces the complexity involved in manually writing intricate queries.
It’s particularly beneficial for users who may not be proficient in query syntax but require specific data retrieval.
The accuracy of the generated queries is high but not 100%. Neurelo uses OpenAI's models for generating these queries and continues to work on fine-tuning them, however as the AI technology is still evolving, sometimes this feature may not work as expected. Please try re-generating with the same prompt or use a different prompt if you don’t get the results you expected, or see a failure.
You can also use the generated query as a starting point and edit those queries in the editor to get to the exact query you are looking to build
Beyond simply generating queries, Neurelo’s AI-Assisted Query Generation feature offers several tools to enhance user experience and efficiency. Here's an overview of these tools:
"Use This" Option:
The "Use This" option allows you to instantly copy the AI-generated query to the Query Editor.
Clicking this button transfers the query, making it ready for further editing, testing, or direct use.
"Delete All Prompts" Option:
If you have a list of prompts or queries previously generated, the "Delete All Prompts" options enables you to erase them all at once.
This is useful for clearing out old or irrelevant queries to maintain a clean workspace.
API Key Configuration:
The "API Key Configuration" option (Settings icon on the top right) lets you choose between using your own OpenAI API key or Neurelo's key (default). It is recommended to use your own OpenAI API key if possible.
"Re-generate" Option:
If the generated query doesn’t meet your expectations, or you need a different iteration, the "Re-generate" tool allows you to create a new version of the query based on the same prompt. This feature is useful for refining query outputs.
Copy Prompt Option:
The copy icon next to a prompt enables you to quickly copy the text of the prompt. This is handy for reusing or referencing a prompt in other applications or contexts.
Delete Option:
For removing a specific prompt and results, use the "Delete" option.
This option helps in managing your query list by allowing you to remove individual queries that are no longer needed.
Neurelo uses OpenAI to generate these queries and sends your schema to their models to be able to generate the queries for the prompt. You can use your own OpenAI API key if you would like the schema to sent to OpenAI in your account, rather than using Neurelo's account. No data from your database or other information about your organization or projects is send as part of this process.
Here are OpenAI's privacy terms - https://openai.com/enterprise-privacy Please do not use this feature if you don't want your schema to be sent to OpenAI.
These capabilities in the AI-Assisted Query Generation feature of Neurelo enhance the usability of the query generation process, offering options for customization, configuration, and organization.