Stocks are soaring, and there's one big reason why.

Artificial intelligence (AI) has captivated the market following the launch of ChatGPT late last year, and investors are betting on an AI-driven boom, as the new technology could disrupt everything from internet search to cloud computing to even automobiles, by way of self-driving cars.

The Nasdaq is up nearly 40% this year, in large part because of excitement over the potential of artificial intelligence, and stocks with exposure to AI have skyrocketed this year. 

Let's look at three of those AI stocks to see if they are still buys. 

A robot holding a computer with a stock chart on it.

Image source: Getty Images.

1. Nvidia

There may be no stock more closely associated with AI than Nvidia (NVDA 6.18%). The semiconductor stock helped give the AI rally another major leg up in May, when the company gave blowout guidance for its second quarter, saying that it expected revenue of $11 billion in revenue in the quarter because of demand for its AI chips, trouncing the analyst consensus at $6 billion.

The forecast led Wall Street to believe that it was significantly underestimating demand for AI capabilities, including chips, sparking a broad rally in tech stocks and a surge in Nvidia.

The chip stock topped a $1 trillion market cap and has now more than tripled this year. There's no question that Nvidia, which invented the graphics processing unit used for applications such as gaming, autonomous vehicles, and AI, is the leader in AI chips.

However, Nvidia's valuation has gotten stretched in the rally. The stock now trades at a price-to-earnings ratio of 161. Forward estimates call for earnings to soar from the AI boom, and the stock could continue to move higher if Nvidia can block competitors and capture the opportunity in AI. In the near term, momentum and excitement over AI could push the stock higher as well.

2. C3.ai

C3.ai (AI 3.02%) is a much smaller company than Nvidia, but it's been just as big of a player in the AI rally. It's a software-as-a-service company that makes AI-based applications for things like demand forecasting and inventory management. 

Like Nvidia, the stock has more than tripled this year. Investors see it as a stock to own to capitalize on the AI boom, given its name and its ticker.

However, unlike Nvidia, C3.ai has little to show for it despite the new wave of interest in AI. It just reported a fiscal year with flat revenue growth and wide losses.

CEO Thomas Siebel has said the company is seeing a surge of interest from customers, but the company is forecasting revenue growth of only 15% this year, suggesting that its gains this year are due to hype rather than improving fundamentals.

The stock is also expensive, at a price-to-sales ratio of 16, a level usually reserved for stocks with much higher growth rates.

At this point, investors are best off avoiding C3.ai. 

3. Microsoft

Microsoft (MSFT 1.82%) is the most valuable company in the U.S. after Apple, and its sprawling tech empire spans its Windows operating system, Azure cloud infrastructure business, and Office software suite, among other key businesses.

However, more than any other company, Microsoft now seems to be leading the way in AI. The tech giant has a strategic partnership with OpenAI and invested $13 billion in the AI startup.

That's allowed it to leverage OpenAI and ChatGPT technology in a wide range of products, including Bing, where it's posing the most serious challenge to Google search in memory, as well as its Office suite, known as Microsoft 365; Azure OpenAI, which gives companies to generative AI tools; and GitHub, where coders can take advantage of an AI co-pilot.

In fact, Microsoft just announced an AI co-pilot subscription plan for its Office software, charging $30 a month per user for the new feature. The stock got another bump on the news. 

Microsoft shares are up 50% this year, and, like other AI winners, the stock looks pricey, trading at a P/E of 39. While that's expensive for a company of its size, the new Office AI launch shows there are still plenty of ways for Microsoft to monetize the new technology.

Expect the stock to keep moving higher, especially as demand for cloud computing and enterprise software appears to be recovering from last year's slowdown.