Artificial intelligence (AI) is an exciting technology sweeping the world. AI has been around a while but recently caught fire as an investing trend and new avenue for tech companies. It recently reached new levels of sophistication and consumer appeal thanks to generative AI chatbots like ChatGPT.

Naturally, many corporations are looking to use AI to improve their businesses. And while some are likely to be successful, others might not be so lucky. Let's consider one stock in each of those categories. 

This tech giant knows how to innovate

Amazon (AMZN 3.43%) has delivered market-beating returns to its longtime shareholders. One reason it has been able to do that is that the company's management has constantly identified and pursued lucrative growth opportunities.

Now, the tech juggernaut wants to do the same thing with AI. Amazon offers a comprehensive suite of AI tools through its cloud computing arm, Amazon Web Services (AWS).

Earlier this year, the company announced Amazon Bedrock, a service that allows people to build generative AI applications like ChatGPT. Of course, generative AI need not focus on speech -- it can also produce images and videos.

This market is projected to grow rapidly in the coming years. Estimates vary, but some analysts see the generative AI space registering a compound annual growth rate of 35.6% through 2030. Amazon is looking to get a slice of this pie.

Given the company's track record and the amount of revenue, earnings, and cash it generates that can be used to invest in initiatives like these, Amazon could be one of the winners in the generative AI race thanks to Bedrock and other services.

But Amazon is such an excellent stock to buy because its future doesn't depend just on AI or any other single industry. Despite recent economic challenges, the company's core e-commerce and advertising businesses are doing well and can still grow.

Amazon's cloud computing unit has a bright future, too. Further, Amazon is beginning to enter in other markets, especially healthcare. Through its $3.9 billion acquisition of One Medical, Amazon now offers primary care services.

While this initiative may or may not prove fruitful, Amazon's strategy of going after new business opportunities will undoubtedly unearth some lucrative opportunities.

Meanwhile, the company has generally recorded excellent revenue and earnings, even with a surprise net loss last year.

AMZN Revenue (Annual) Chart

AMZN Revenue (Annual) data by YCharts

Amazon might be susceptible to economic cycles, but it has repeatedly proven its business's strength and resilience. That's why Amazon stock remains a buy. 

This company's AI bet might not be enough 

AI is helping many businesses improve their operations, but it is also a threat to others. Online learning platform Chegg (CHGG 3.20%) is an example.

The company runs a platform that provides homework and textbook solutions to students at various education levels. However, generative AI chatbots like ChatGPT risk making this service obsolete since they can answer somewhat complex questions accurately. ChatGPT can also help with writing assignments.

Chegg is under pressure and the company's shares are down by 66% year to date. But the company has tried to get ahead of the problem. According to management, students see ChatGPT and Chegg as complementary services. One company survey showed that 86% would prefer study help to be reviewed by actual human subject-matter experts.

Chegg introduced the beta version of CheggMate, an AI-powered student helper, earlier this year. The company says engagement of this service has been high, but it remains unproven as a long-term benefit to the bottom line.

Meanwhile, Chegg's top line and subscriptions have been moving in the wrong direction.

In the second quarter, the company's revenue dropped by 6% year over year to $182.9 million. It had 4.8 million subscribers as of the end of the quarter, a decline of 9% compared to the year-ago period. 

Chegg's prospects are uncertain at the moment, and that's why investors should avoid the stock, at least for now.