What happened

Shares of C3.ai (AI -0.85%) rallied out of the gate Tuesday, climbing as much as 7.4%. As of 11:36 a.m. ET, the stock was still up 3.6%.

The catalyst that sent the provider of enterprise artificial intelligence (AI) software climbing was not only the general tailwind that has been driving AI stocks lately, but better-than-expected results from a rival in the space.

So what

Fellow AI specialist Palantir Technologies (PLTR 0.56%) released its fourth-quarter report after the market close yesterday, and the results received a warm welcome from investors. Palantir delivered revenue that grew 18% year over year to $509.1 million, as the company experienced solid growth from both its government customers and commercial clients alike. Those segments generated revenue that grew 23% and 11%, respectively.

The big headline, however, was that Palantir was profitable according to generally accepted accounting principles (GAAP) for the first time in the company's history.

Now what

C3.ai stock was mauled badly by the bear market, driven down 79% from its peak reached in late 2021. The combination of a high valuation and lack of profits counted against the company as investors fled to safety in the face of deteriorating economic conditions.

However, the recent excitement in all things AI, stoked by OpenAI's ChatGPT, has investors rushing back into artificial intelligence and machine learning stocks. C3.ai has ridden the wave higher, with its stock up 94% so far this year

While it's easy to get caught up in the hype, it's important to remember that sentiment can turn on a dime, and C3.ai's stock will continue to be volatile from here. Investors should also keep in mind that this isn't an apples-to-apples comparison, and C3.ai has challenges ahead.

The company changed its pricing structure in mid-2022, changing from a subscription to a consumption-based model, and the jury is still out on whether that transition will ultimately be successful. 

Given the changes to its business model and the uncertain economy, investors should approach C3.ai with caution, making any investment a small part of a diverse portfolio.