Wall Street is abuzz with talk of generative artificial intelligence (AI), the technology behind viral chatbot ChatGPT. Generative AI turns prompts into novel text, images, and videos, and it promises to revolutionize countless industries. In fact, generative AI is already being used by healthcare professionals, media creators, and marketers.

But content generation is just one use case. AI software can also be used to identify objects, predict outcomes, and make decisions, all of which dramatically augment human productivity. To that end, asset manager Ark Invest believes AI software revenue will increase at 42% annually to reach $14 trillion by 2030.

Tesla (TSLA -1.06%) and Nvidia (NVDA -3.87%) are particularly well positioned to capitalize on that trend. Here's why both stocks are worth buying today.

1. Tesla

Tesla led the auto industry with 18% market share in battery-electric car sales last year, outpacing runner-up BYD by nearly 6 percentage points, despite missing its medium-term delivery target.

Tesla aims to grow deliveries by 50% annually over a multiyear horizon, but they increased just 40% last year as the company struggled with supply chain issues, forced factory closures, and economic headwinds.

Even so, Tesla reported impressive financial results. Revenue increased 51% to $81.5 billion and free cash flow (FCF) climbed 51% to $7.6 billion year over year. The company also achieved an industry-leading operating margin of 16.8%, an accomplishment CEO Elon Musk ascribes to its manufacturing technology. More importantly, management expects to maintain its operating margin even as volume production improves in the future.

TSLA Operating Margin (Annual) Chart

TSLA Operating Margin (Annual) data by YCharts

One reason for that confidence is AI software. Musk says Tesla is one of the world's leading AI companies, citing its full self-driving (FSD) platform, which features the "most efficient inference computer" and the "most advanced active safety" system in the world.

Tesla made its FSD Beta software generally available in North America last year, and the gross margin on that product is essentially100%. But the company has yet to scratch the surface of what experts believe will ultimately be a multitrillion-dollar market. In fact, Ark Invest says autonomous ride-hailing platforms could generate $9 trillion in revenue by 2030, and Tesla is a front-runner to dominate that industry.

Why? Data is the cornerstone of AI, and Tesla has far more autonomous-driving data than its peers because it has far more autopilot-enabled cars on the road. The company plans to capitalize on that advantage by mass-producing a robotaxi in 2024, and management believes FSD technology will ultimately be the most important source of profitability for the company.

Currently, shares trade at 8.3 times sales, an outrageously high valuation for an automaker, but a reasonable price to pay for a business that could disrupt the transportation and mobility industries with AI software. Risk-tolerant investors should consider buying a small position in this growth stock today.

2. Nvidia

Nvidia is best known for inventing the graphics processing unit (GPU), a chip that has become the gold standard in rendering realistic graphics and accelerating data center workloads like analytics and machine learning. In fact, Nvidia holds 90% market share in workstation graphics and supercomputer accelerators, and it has regularly achieved leading results at the MLPerf Benchmarks, an event that measures the performance of AI technologies.

Nvidia has doubled down on AI by branching into cloud software and services. For instance, Nvidia DGX Cloud provides on-demand access to AI infrastructure and software. It includes frameworks that accelerate the development of AI applications for specific industries like retail, logistics, and healthcare.

DGX Cloud also features generative AI services for text, visual content, and drug design. In short, Nvidia has made its AI technology more accessible than ever before. Businesses no longer need costly supercomputing systems on-premises. They can now provision infrastructure from the cloud.

Nvidia struggled with economic headwinds last year. High inflation curbed demand for gaming and data center chips, the two largest segments of its business, and that led to dismal financial results. Revenue was flat at $27 billion and FCF dropped 53% to $3.8 billion. But the company should have no trouble reaccelerating those metrics in a more favorable economy.

Forrester Research says Nvidia GPUs are synonymous with AI infrastructure. That brand authority means the company is perfectly positioned to benefit as AI becomes more widespread, and its growing library of cloud services should help it capitalize on the growing demand for AI software.

Management believes those products put Nvidia in front of a $1 trillion market opportunity. And while shares currently trade at a pricey 24.8 times sales, risk-tolerant investors should strongly consider buying a small position in this growth stock today. The current valuation multiple could come down quickly as newer products like DGX Cloud gain traction.