What is Best AI Model for SQL and MongoDB Query Generation

Hi everyone,

I’m working on a project that requires generating SQL and MongoDB queries dynamically based on user inputs. I’m considering using OpenAI models (GPT-4-turbo or others) for this task and would love some recommendations.

The key requirements are:

  • Generating complex SQL queries (joins, aggregations, conditions, etc.)
  • Constructing MongoDB queries with filters, aggregations, and nested structures
  • Ensuring accuracy and optimization of the generated queries
  • Potential fine-tuning or prompt engineering for better results

Has anyone used OpenAI models for similar use cases? Which model or approach would be best suited for SQL and NoSQL query generation? Also, are there best practices for refining the output?

Looking forward to your insights!

Thanks.

2 Likes

In my opinion, after extensive use, testing and comparing, Claude 3.5 Sonnet is the best model to code with. Prompting does matter a lot, so research a bit about best practices for prompting. But other than that, I think you should be just fine with Claude. :hugs:

2 Likes

You could just use custom GPTs specialized in those relative technologies.

Here are two custom GPts that could definitely hepl you in SQL and MongoDB technologies:

SQL : SQL Mastery Guide GPT | The Wise Duck Dev GPTS

MongoDB : MongoDB Advisor GPT | The Wise Duck Dev GPTS

Hope it will help you.