AI in Context: First Test of Several Generative AI Code Generators

AI in Context: First Test of Several Generative AI Code Generators

Generative AI has many applications, including code generation. I usually program in Python, so I tested five code generators to see how they performed on an HTML file search operation. I restricted myself to browser-based generators. I did not test all such generators, but the results show an interesting range in quality and completeness.

The Task: Extracting the Title from an HTML File

I do a lot of text manipulation using Python. For example, the text source for my book Dancing with Qubits, Second Edition, combines HTML and LaTeX. I process the HTML and pull out the LaTeX in PRE blocks that have a special class designator. I run these through pdflatex to create small PDF files and then use ImageMagick to generate JPG images. I then insert IMG tags with links to the images into the final HTML file.

I also have special SPAN tags with HTML math in the content areas and LaTeX markup in an attribute. This combination allowed Packt Publishing and me to create an eBook, a PDF for printing the book, and a color-highlighted PDF for purchasers of the other two forms. Sometimes, I think it took me longer to write the processing software than the book itself.

Over several years, I wrote all the code and used an earlier version to generate my Dancing with Python book. I use certain idioms repeatedly, especially to parse HTML files. The workhorse Python package I use is beautifulsoup4. It has methods to read a file or string containing HTML and then search or navigate the document tree.

Since I had not used a generative AI code generator before except for regular expressions, I thought a fun initial task would be asking several of them to write code to read an HTML file and print the TITLE tag’s contents. There are more code generators than I have shown, and I have only used browser-based prompt and response services.

Many AI code generators have extensions for Integrated Development Environments (IDEs), such as Visual Studio Code. I will examine some of these in a future Analyst Insight.

The Prompt

The prompt I used with each code generation service is:

Write me Python code that parses an HTML file and prints the title.

I will score the code this way:

    • 0 points total if the code is not Python. I stop looking at the code.
    • 5 points if it reads a file, 1 point if it uses a with statement, and 1 point if it specifies an encoding.
    • 5 points if it checks that the HTML file exists.
    • If it doesn’t read a file, 1 point if it reads a string.
    • 5 points if it finds the TITLE tag and contents.
    • 1 point if it checks that the title exists
    • 2 points if it prints the title.

The code should be in Python, read an HTML file using modern Python syntax, understand that the title is in an HTML tag, extract the tag’s contents, and print the result. The maximum score is 20.

ZZZ Code AI

The input:

AI in Context: First Test of Several Generative AI Code Generators

The output:

AI in Context: First Test of Several Generative AI Code Generators

The score: 8 = 1 (reads string) + 5 (finds title) + 2 (prints title)

The main issue with this code is that I asked for code to read a file, and it reads a string instead.

Codeium

The input:

AI in Context: First Test of Several Generative AI Code Generators

The output:

AI in Context: First Test of Several Generative AI Code Generators

The score: 13 = 6 (reads file using with) + 5 (finds title) + 2 (prints title)

This code did not get the points for checking that the file exists, using file encoding, or checking that the title existed.

Microsoft Copilot

The input:

AI in Context: First Test of Several Generative AI Code Generators

The output:

AI in Context: First Test of Several Generative AI Code Generators

The score: 14 = 6 (reads file using with) + 5 (finds title) + 1 (checks title exists) + 2 (prints title)

Very nice touch at the end noting that I should change the file name in the code! The code should have checked that the file existed.

OpenAI ChatGPT 3.5

The input:

AI in Context: First Test of Several Generative AI Code Generators

The output:

AI in Context: First Test of Several Generative AI Code Generators

AI in Context: First Test of Several Generative AI Code Generators

The score: 15 = 7 (reads file using with and encoding) + 5 (finds title) + 1 (checks that the title exists) + 2 (prints title)

This is great code, except it doesn’t check if the file exists. The extra factoring out of the function to find the title is very nice, as is the instruction for installing the beautifulsoup4 package.

CodePal

The input:

AI in Context: First Test of Several Generative AI Code Generators

The output:

AI in Context: First Test of Several Generative AI Code Generators

AI in Context: First Test of Several Generative AI Code Generators

AI in Context: First Test of Several Generative AI Code Generators

The score: 19 = 5 (check if file exists) + 6 (uses file and reads it using with) + 5 (finds title) + 1 (checks that the file exists) + 2 (prints title)

This is the most complete code with the top score, only losing a point by not specifying a file encoding. It has extensive error checking, something I would require in production quality code.

Key Takeaway: Generative AI code generators can give developers a head start in developing applications. Human intervention may be required to ensure the code checks for errors and uses modern coding practices and libraries.

I was impressed at first with the code these five services generated. They appeared to use the standard Python package to perform the requested action. On closer comparison, one did not follow the prompt well, and most others had limited to no error checking. Do not use generated code without carefully inspecting what it does and how. Though my example did not have security considerations, you should carefully examine the code to guarantee it does not open holes that hackers could exploit.

Disclosure: The Futurum Group is a research and advisory firm that engages or has engaged in research, analysis, and advisory services with many technology companies, including those mentioned in this article. The author does not hold any equity positions with any company mentioned in this article.

Analysis and opinions expressed herein are specific to the analyst individually and data and other information that might have been provided for validation, not those of The Futurum Group as a whole.

Other Insights from The Futurum Group:

AI in Context: UXL to Be an Open-Source Alternative to NVIDIA’s CUDA?

Quantum in Context: A Qubit Primer

AI in Context: Remarks on the NVIDIA GTC 2024 GenAI and Ethics Panel

Author Information

Dr. Bob Sutor

Dr. Bob Sutor is an expert in quantum technologies with 40+ years of experience. He is the accomplished author of the quantum computing book Dancing with Qubits, Second Edition. Bob is dedicated to evolving quantum to help solve society's critical computational problems.

Related Insights
How Presidio's ISO/IEC 42001 Certification Sets a New Standard in AI Governance
July 16, 2026

How Presidio’s ISO/IEC 42001 Certification Sets a New Standard in AI Governance

Presidio achieves ISO/IEC 42001 certification as a credentialed AI partner, addressing the 55.6% expertise gap among channel partners and setting a new competitive standard in enterprise AI governance....
Peraton's New CFO Signals Strategic Shift Amid Growing National Security Demands
July 16, 2026

Peraton’s New CFO Signals Strategic Shift Amid Growing National Security Demands

Peraton names Salim Omar as Chief Financial Officer to drive disciplined financial strategy and accelerate growth in the expanding government AI services market, forecast to reach $41.8B by 2029....
HCLTech and Guardian Forge Strategic Alliance for AI-Driven Transformation
July 16, 2026

HCLTech and Guardian Forge Strategic Alliance for AI-Driven Transformation

HCLTech and Guardian Life Insurance partner for seven years on AI-powered modernization, exemplifying how AI consulting and cloud migration are reshaping the channel ecosystem....
Why Ignoring Security in AI Deployments Could Cost You More Than You Think
July 16, 2026

Why Ignoring Security in AI Deployments Could Cost You More Than You Think

Organizations deploying AI without robust security risk data breaches, regulatory failure, and reputational damage—Concentrix shows why integrating security from the start costs less than treating it as an afterthought....
Nokia's AI-RAN Platform Puts a Number on the Software-Defined RAN Bet
July 15, 2026

Nokia’s AI-RAN Platform Puts a Number on the Software-Defined RAN Bet

Nick Patience, VP & Practice Lead for AI Platforms at Futurum, unpacks Nokia's new AI-RAN platform launch with NVIDIA and asks whether its 2x spectral efficiency target by 2028 holds...
The Active Storage Revolution: VAST and Cloudera Team Up to Cure Enterprise GPU Starvation
July 15, 2026

The Active Storage Revolution: VAST and Cloudera Team Up to Cure Enterprise GPU Starvation

Brad Shimmin, VP and Practice Lead at Futurum, explores the new strategic partnership between VAST Data and Cloudera. By integrating the VAST AI OS with Cloudera data services, the vendors...

Book a Demo

Welcome

The vision behind everything in Futurum’s Custom Research practice is this: research should show you what is happening, what comes next, and what to do about it. It should be personal to each audience, easy for people to grasp, and structured so LLMs can reason over it accurately. And it should be fast and turnkey; you want answers now, not another project to carry for quarters.

Whether you are defining business, channel, or go-to-market strategy; evaluating vendors or justifying ROI; or commissioning research to fill an emerging market need, we have your back, with a program that answers your questions with the objectivity and credibility to drive real decisions.

To do it, we bring unmatched data to bear: Futurum research, surveys, and market projections; validated market feeds; ETR’s 15 years of insight from 10,000 technology decision-makers; G2’s buyer and user data; and what our analysts hear every day. Add leading primary collection, from AI-moderated voice interviews to surveys and analyst-led interviews, all turnkey, and every project comes out credible, nuanced, and actionable.

And we don’t just drop the results in your lap. For internal work, we provide analyst-led sessions, interactive dashboards, and a range of formats. For market-facing work, Futurum delivers turnkey activation and amplification that actually gets seen, by people and by LLMs, through our media and share of voice. This is research that moves decisions and markets.

We will meet you wherever you are, from a fast-turn brief to a multi-year program, and shape the work to your goals, timeline, and budget. The right program for your moment.

If any of this is useful, I would love to talk.

Benjamin Brown, VP Custom Research, Futurum Research

Benjamin Brown

VP, Custom Research · The Futurum Group

Newsletter Sign-up Form

Get important insights straight to your inbox, receive first looks at eBooks, exclusive event invitations, custom content, and more. We promise not to spam you or sell your name to anyone. You can always unsubscribe at any time.

All fields are required






Thank you, we received your request, a member of our team will be in contact with you.