CAGR Insights – 10 Jan 2026

CAGR Insights is a weekly newsletter full of insights from around the world of the web.

Here’s what we are reading this weekend:

  • How the ‘No Buy 2026’ trend could help you get your budget on track this year: Is this the year of cutting back? Read here
  • Is a US market correction coming? Read here
  • Budget 2026: Why do India’s farms suddenly matter? Read here

———————————————————————————————–

CHINA: THE EMERGING TECH HEGEMON

In this edition, we turn our spotlight to China. While global markets remain fixated elsewhere, China is quietly building the future through tech-led manufacturing, robotics, and AI—and with valuations still depressed, this growth story may be one of the most interesting opportunities for investors today.

China is the second largest economy in the world after United States. It’s GDP in 2024 stood at 18.49 trillion (US dollars) which is 4 times the GDP of the 3rd largest economy in the world – Japan. China’s growth story is not just inspiring but also the one we can learn from, their reforms which are characterised by long term visualization and rapid economic growth.

In its 15th five-year plan held in October 2025, the Chinese government highlighted their plans to stay resilient in a volatile world with technological self-sufficiency, and innovation remaining their primary focus.

During the new FYP period (2026-2030), China aims to seek breakthroughs in areas such as advanced tech driven manufacturing and develop a lead in AI with the aim to reduce its dependence on foreign countries. 

To achieve its vision, China has been focusing on R&D as a key driver for achieving its goals

China’s government R&D spending is set to surpass that of the US in 2026, with an 8.3% budget hike focused on basic science.

How does China compare against US on the technological landscape?

Tech Driven Manufacturing

China has been expanding into emerging sectors like batteries, electric vehicles (EVs) and autonomous vehicles.

Developing autonomous-driving capability requires a large installed base of modern vehicles that can run advanced driver-assistance systems. China has built a base on a scale no other country can match, largely because of its overcapacity. 

More than 60% of the EVs sold in China now come equipped with driver-assistance features that support partial automation, often at no additional cost for consumers.

And China’s scale in the whole EV space provides the necessary base for driving automation. The total EV sales in 2024 reached 16.9 million and China dominates this market accounting for over 67% of the total world sales.

China’s massive scale in EV is supplemented by the huge workforce behind it.

BYD’s massive workforce scale—600K-700K total employees versus Tesla’s 125K—gives China a decisive edge in rapidly deploying AI across physical ecosystems like EVs, drones, and factories.

China’s dominance in the EV space is not just domestic. It has also been able to garner a significant share globally, as evidenced by the rising number of exports. 8 out of the top 11 EV companies’ origin from China and are less expensive compared to their US counterparts.

What makes China interesting at this point is the fact that EV supremacy will be faster for countries which have access to rare earth materials like cobalt, lithium, graphite etc.

If we dig deeper and look where do these rare earth materials reside, we realize that China is way ahead of the entire world.  

China is projected to have the largest share (60%) of global refined critical mineral supply by 2030.

Nickel is the only outlier in the rare earth minerals where China lags Indonesia (71%). We feel that China’s supremacy in rare earth materials places it at a very advantageous position to leverage the EV wave over the next decade.

How has the equity market perceived the EV space so far?

Despite China’s dominance in the EV ecosystem, this leadership is yet to translate into commensurate equity market returns.

In fact, leading Chinese EV players are currently trading at significantly lower valuations compared to their global peers, despite stronger scale, integration, and cost advantages.

Robotics

What was once seen as a weakness — chronic manufacturing overcapacity — has effectively become China’s strategic strength. Overcapacity is what helped China mass deploy autonomous driving capability on modern vehicles.

The same dynamic is now playing out in robotics. Buoyed by generous local subsidies and a strong national industrial policy push, robot manufacturing in China has expanded rapidly in recent years. Chinese factories now install around 280,000 industrial robots annually — roughly half of the global total — with nearly 60% of those units supplied by domestic manufacturers offering significantly cheaper machines.

According to the International Federation of Robotics, China accounted for 54% of all industrial robot installations in 2024. And that percentage is expected to grow in coming years.

Artificial Intelligence

Artificial Intelligence is the next big technological advancement that is taking the world by storm. And this is one space which are witnessing the emergence of two big hegemons – US and China.

The USA-China AI competition is reshaping global technology landscapes, driving unprecedented innovation while creating new geopolitical tensions. Rather than a winner-take-all scenario, we’re likely heading toward a bifurcated AI ecosystem where both superpowers excel in different domains.

China is investing heavily in creating home – grown AI talent. There is considerable focus on rapid skill development in the AI space. However, better opportunities in the US have been causing some level of brain drain from China to the US. It will be interesting to observe how China addresses this issue in the years to come.

Further, China is much ahead in testing and adopting some of the AI technologies on their domestic industries. This should give China the benefit of having a faster and bigger feedback loop to re-iterate and evolve with speed.

Which country captures the larger AI market-share will depend on who is able to create a more sustainable eco-system. And this eco-system will be driven by two key aspects:

  1. Adequate electricity which can fuel the needs of AI systems
  2. Supporting infrastructure that allows these systems to operate safely, such as data centres

Not only does US have a much older power grid, but it is also far behind China in terms of electricity generation capacity. Just for context, China added 427GW of new power capacity in 2024, which is more than one-third of the entire US grid and more than half of all global electricity growth.

Perhaps even more important, China added 304GW of solar generation capacity in the first 10 months of 2025 – greater than the entire installed solar capacity in the US of about 259GW.

Not to mention, Industrial electricity bills are also on average 30% cheaper in China than in the United States.

China is investing huge sums to build new capacity in order to keep up with rising electricity demand. China aims to establish a new grid system to support a west-to-east power transmission program exceeding 420 gigawatts by 2030, according to the guidance issued by the National Energy Administration and the National Development and Reform Commission.

While China seems to have a much better hold on the electricity front, The People’s Republic has lagged the United States in building new data centres and bringing more computing power online. This has resulted in US Chip Control continuing to remain a formidable constraint. Bernstein’s research outfit’s analysts estimate Chinese firms will spend just $147 billion on AI capital expenditures in 2027. That’s less than Amazon’s expected total capex that year, per Visible Alpha forecasts.

As AI moves from our screens into the physical world, the question is no longer whose models hit technical benchmarks, but who can build and sustain an ecosystem that embeds AI into everyday products and services. Viewed through this lens, China enjoys a distinct advantage that does not show up in standard measures of AI performance. Counterintuitively, China’s strength stems from what economists have long treated as one of its deepest structural weaknesses: overcapacity.

Conclusion

China and the US are the two hegemonic forces shaping the global economy, yet the market outcomes for both could not be more different.

While China has spent the last 15–20 years aggressively scaling its technology-driven manufacturing base and expanding its economic footprint, its capital markets have yet to fully reward this growth in the way US markets have.

Over this period, China has built world-class capabilities across EVs, batteries, solar, electronics, and now robotics, even as its equity valuations have remained compressed.

Chinese markets remain undervalued at ~13x forward P/E (40% below S&P 500).

The tech sector in China particularly remains undervalued compared to US.

However, if we look at the last two-year trajectory of the Chinese markets, we can see that there seems to be a roaring come back. Perhaps, the initiatives are now paying off as investors are returning to Chinese markets.

As we begin to see early signs of market uptick, we believe this could mark the start of a more sustained re-rating cycle in Chinese markets, especially given the strategic positioning of its industries and the relatively low valuation multiples at which many Chinese stocks continue to trade.

This could very well be the start of momentum in the Chinese markets!

****
That’s it from our side. Have a great weekend ahead!

If you have any feedback that you would like to share, simply reply to this email.

The content of this newsletter is not an offer to sell or the solicitation of an offer to buy any security in any jurisdiction. The content is distributed for informational purposes only and should not be construed as investment advice or a recommendation to sell or buy any security or other investment or undertake any investment strategy. There are no warranties, expressed or implied, as to the accuracy, completeness, or results obtained from any information outlined in this newsletter unless mentioned explicitly. The writer may have positions in and may, from time to time, make purchases or sales of the securities or other investments discussed or evaluated in this newsletter.

How to Create a Chatbot in Python Step-by-Step

How To Create an Intelligent Chatbot in Python Using the spaCy NLP Library

python chatbot

If you’re going to work with the provided chat history sample, you can skip to the next section, where you’ll clean your chat export. The ChatterBot library comes with some corpora that you can use to train your chatbot. However, at the time of writing, there are some issues if you try to use these resources straight out of the box. In lines 9 to 12, you set up the first training round, where you pass a list of two strings to trainer.train().

Since this is a publicly available endpoint, we won’t need to go into details about JWTs and authentication. Next create an environment file by running touch .env in the terminal. We will define our app variables and secret variables within the .env file. GPT-J-6B is a generative language model which was trained with 6 Billion parameters and performs closely with OpenAI’s GPT-3 on some tasks.

Now, when we send a GET request to the /refresh_token endpoint with any token, the endpoint will fetch the data from the Redis database. Next, we add some tweaking to the input to make the interaction with the model more conversational by changing the format of the input. For up to 30k tokens, Huggingface provides access to the inference API for free. In the next section, we will focus on communicating with the AI model and handling the data transfer between client, server, worker, and the external API. We can store this JSON data in Redis so we don’t lose the chat history once the connection is lost, because our WebSocket does not store state. Next, to run our newly created Producer, update chat.py and the WebSocket /chat endpoint like below.

GPT-J-6B is a generative language model which was trained with 6 Billion parameters and performs closely with OpenAI’s GPT-3 on some tasks. I’ve carefully divided the project into sections to ensure that you can easily select the phase that is important to you in case you do not wish to code the full application. ChatterBot is a Python library designed to respond to user inputs with automated responses. It uses various machine learning (ML) algorithms to generate a variety of responses, allowing developers to build chatbots that can deliver appropriate responses in a variety of scenarios. Using the ChatterBot library and the right strategy, you can create chatbots for consumers that are natural and relevant.

We are defining the function that will pick a response by passing in the user’s message. For this function, we will need to import a library called random. Since we don’t our bot to repeat the same response each time, we will pick random response each time the user asks the same question. When it gets a response, the response is added to a response channel and the chat history is updated.

Enter email address to continue

You can use hybrid chatbots to reduce abandoned carts on your website. When users take too long to complete a purchase, the chatbot can pop up with an incentive. And if users abandon their carts, the chatbot can remind them whenever they revisit your store. Beyond that, the chatbot can work those strange hours, so you don’t need your reps to work around the clock.

Now, since we can only compute errors at the output, we have to propagate this error backward to learn the correct set of weights and biases. According to IBM, organizations spend over $1.3 trillion annually to address novel customer queries and chatbots can be of great help in cutting down the cost to as much as 30%. We will give you a full project code outlining every step and enabling you to start. This code can be modified to suit your unique requirements and used as the foundation for a chatbot. The right dependencies need to be established before we can create a chatbot.

Simplilearn’s Python Training will help you learn in-demand skills such as deep learning, reinforcement learning, NLP, computer vision, generative AI, explainable AI, and many more. To get started with chatbot development, you’ll need to set up your Python environment. Ensure you have Python installed, and then install the necessary libraries. A great next step for your chatbot to become better at handling inputs is to include more and better training data. ChatterBot is a Python library that makes it easy to generate automated

responses to a user’s input. ChatterBot uses a selection of machine learning

algorithms to produce different types of responses.

Which language is best for a chatbot?

You can also check Redis Insight to see your chat data stored with the token as a JSON key and the data as a value. In the src root, create a new folder named socket and add a file named connection.py. In this file, we will define the class https://chat.openai.com/ that controls the connections to our WebSockets, and all the helper methods to connect and disconnect. One of the best ways to learn how to develop full stack applications is to build projects that cover the end-to-end development process.

The final else block is to handle the case where the user’s statement’s similarity value does not reach the threshold value. The chatbot will use the OpenWeather API to tell the user what the current weather is in any city of the world, but you can implement your chatbot to handle a use case with another API. ChatterBot uses complete lines as messages when a chatbot replies to a user message. In the case of this chat export, it would therefore include all the message metadata. That means your friendly pot would be studying the dates, times, and usernames! The dataset has about 16 instances of intents, each having its own tag, context, patterns, and responses.

How to Build a Chatbot Using the Python ChatterBot Library

You can Get started with Redis Cloud for free here and follow This tutorial to set up a Redis database and Redis Insight, a GUI to interact with Redis. First we need to import chat from src.chat within our main.py file. Then we will include the router by literally calling an include_router method on the initialized FastAPI class and passing chat as the argument. When we send prompts to GPT, we need a way to store the prompts and easily retrieve the response. However, there is still more to making a chatbot fully functional and feel natural. This mostly lies in how you map the current dialogue state to what actions the chatbot is supposed to take — or in short, dialogue management.

At this point, you can already have fun conversations with your chatbot, even though they may be somewhat nonsensical. Depending on the amount and quality of your training data, your chatbot might already be more or less useful. Your chatbot has increased its range of responses based on the training data that you fed to it.

How to Make a Chatbot in Python: Step by Step – Simplilearn

How to Make a Chatbot in Python: Step by Step.

Posted: Wed, 10 Jul 2024 07:00:00 GMT [source]

It becomes easier for the users to make chatbots using the ChatterBot library with more accurate responses. Finally, in line 13, you call .get_response() on the ChatBot instance that you created earlier and pass it the user input that you collected in line 9 and assigned to query. Running these commands in your terminal application installs ChatterBot and its dependencies into a new Python virtual environment. If you’re comfortable with these concepts, then you’ll probably be comfortable writing the code for this tutorial. If you don’t have all of the prerequisite knowledge before starting this tutorial, that’s okay! You can always stop and review the resources linked here if you get stuck.

The bot will not answer any questions then, but another function is forward. Classes are code templates used for creating objects, and we’re going to use them to build our chatbot. Now that we’re armed with some background knowledge, it’s time to build our own chatbot. We’ll be using the ChatterBot library to create our Python chatbot, so  ensure you have access to a version of Python that works with your chosen version of ChatterBot. Use Flask to create a web interface for your chatbot, allowing users to interact with it through a browser.

Introduction to Strings in Python

For this, you could compare the user’s statement with more than one option and find which has the highest semantic similarity. If you’re not interested in houseplants, then Chat GPT pick your own chatbot idea with unique data to use for training. Repeat the process that you learned in this tutorial, but clean and use your own data for training.

python chatbot

To do so, you can use the “File Browser” feature while you are accessing your cloud desktop. If you’re interested in becoming a project instructor and creating Guided Projects to help millions of learners around the world, please apply today at teach.coursera.org. Any competent computer user with basic familiarity with python programming.

We will use WebSockets to ensure bi-directional communication between the client and server so that we can send responses to the user in real-time. To set up the project structure, create a folder namedfullstack-ai-chatbot. Then create two folders within the project called client and server. The server will hold the code for the backend, while the client will hold the code for the frontend. Its versatility, extensive libraries like NLTK and spaCy for natural language processing, and frameworks like ChatterBot make it an excellent choice. Python’s simplicity, readability, and strong community support contribute to its popularity in developing effective and interactive chatbot applications.

Maybe at the time this was a very science-fictiony concept, given that AI back then wasn’t advanced enough to become a surrogate human, but now?. I fear that people will give up on finding love (or even social interaction) among humans and seek it out in the digital realm. I won’t tell you what it means, but just search up the definition of the term waifu and just cringe. You can foun additiona information about ai customer service and artificial intelligence and NLP. Go to the address shown in the output, and you will get the app with the chatbot in the browser. A JSON file by the name ‘intents.json’, which will contain all the necessary text that is required to build our chatbot. According to a Uberall report, 80 % of customers have had a positive experience using a chatbot.

Websockets and Connection Manager

Here are some of the advantages of using chatbots I’ve discovered and how they’re changing the dynamics of customer interaction. This project showcases engaging interactions between two AI chatbots. Setting a low minimum value (for example, 0.1) will cause the chatbot to misinterpret the user by taking statements (like statement 3) as similar to statement 1, which is incorrect. Setting a minimum value that’s too high (like 0.9) will exclude some statements that are actually similar to statement 1, such as statement 2. Here the weather and statement variables contain spaCy tokens as a result of passing each corresponding string to the nlp() function.

python chatbot

This took a few minutes and required that I plug into a power source for my computer. Python plays a crucial role in this process with its easy syntax, abundance of libraries, and its ability to integrate with web applications and various APIs. With this comprehensive guide, I’ll take you on a journey to transform you from an AI enthusiast into a skilled creator of AI-powered conversational interfaces.

Because your chatbot is only dealing with text, select WITHOUT MEDIA. To start off, you’ll learn how to export data from a WhatsApp chat conversation. To train your chatbot to respond to industry-relevant questions, you’ll probably need to work with custom data, for example from existing support requests or chat logs from your company.

They have all harnessed this fun utility to drive business advantages, from, e.g., the digital commerce sector to healthcare institutions. This is one of the few guided projects where everything is explained clearly. Note that we are using the same hard-coded token to add to the cache and get from the cache, temporarily just to test this out. You can always tune the number of messages in the history you want to extract, but I think 4 messages is a pretty good number for a demo. Now when you try to connect to the /chat endpoint in Postman, you will get a 403 error.

Now, recall from your high school classes that a computer only understands numbers. Therefore, if we want to apply a neural network algorithm on the text, it is important that we convert it to numbers first. And one way to achieve this is using the Bag-of-words (BoW) model. It is one of the most common models used to represent text through numbers so that machine learning algorithms can be applied on it. You’ll need the ability to interpret natural language and some fundamental programming knowledge to learn how to create chatbots. But with the correct tools and commitment, chatbots can be taught and developed effectively.

Natural Language Processing, often abbreviated as NLP, is the cornerstone of any intelligent chatbot. NLP is a subfield of AI that focuses on the interaction between humans and computers using natural language. The ultimate objective of NLP is to read, decipher, understand, and make sense of human language in a valuable way. Because chatbots handle most of the repetitive and simple customer queries, your employees can focus on more productive tasks — thus improving their work experience. A successful chatbot can resolve simple questions and direct users to the right self-service tools, like knowledge base articles and video tutorials.

As technology continues to evolve, developers can expect exciting opportunities and new trends to emerge in this field. You have created a chatbot that is intelligent enough to respond to a user’s statement—even when the user phrases their statement in different ways. The chatbot uses the OpenWeather API to get the current weather in a city specified by the user. ChatterBot is a Python library designed to facilitate the creation of chatbots and conversational agents. It provides a simple and flexible framework for building chat-based applications using natural language processing (NLP) techniques. The library allows developers to create chatbots that can engage in conversations, understand user inputs, and generate appropriate responses.

You want to extract the name of the city from the user’s statement. In the next section, you’ll create a script to query the OpenWeather API for the current weather in a city. SpaCy’s language models are pre-trained NLP models that you can use to process statements to extract meaning. You’ll be working with the English language model, so you’ll download that. This tutorial assumes you are already familiar with Python—if you would like to improve your knowledge of Python, check out our How To Code in Python 3 series. This tutorial does not require foreknowledge of natural language processing.

ValueError when running chatBot program in new computer – SitePoint

ValueError when running chatBot program in new computer.

Posted: Fri, 26 Apr 2024 07:00:00 GMT [source]

Although the chatbots have come so far down the line, the journey started from a very basic performance. Let’s take a look at the evolution of chatbots over the last few decades. Python Chatbot Project Machine Learning-Explore chatbot implementation steps in detail to learn how to build a chatbot in python from scratch.

You have successfully created an intelligent chatbot capable of responding to dynamic user requests. You can try out more examples to discover the full capabilities of the bot. To do this, you can get other API endpoints from OpenWeather and other sources. Another way to extend the chatbot is to make it capable of responding to more user requests.

  • One of the best ways to learn how to develop full stack applications is to build projects that cover the end-to-end development process.
  • Recall that we are sending text data over WebSockets, but our chat data needs to hold more information than just the text.
  • With chatbots, NLP comes into play to enable bots to understand and respond to user queries in human language.
  • This is one of the few guided projects where everything is explained clearly.
  • Nobody likes to be alone always, but sometimes loneliness could be a better medicine to hunch the thirst for a peaceful environment.

This is important if we want to hold context in the conversation. We will not be building or deploying any language models on Hugginface. Instead, we’ll focus on using Huggingface’s accelerated inference API to connect to pre-trained models. We are adding the create_rejson_connection method to connect to Redis with the rejson Client. This gives us the methods to create and manipulate JSON data in Redis, which are not available with aioredis.

python chatbot

It’s rare that input data comes exactly in the form that you need it, so you’ll clean the chat export data to get it into a useful input format. This process will show you some tools you can use for data cleaning, which may help you prepare other input data to feed to your chatbot. Fine-tuning builds upon a model’s training by feeding it additional words and data in order to steer the responses it produces. Chat LMSys is known for its chatbot arena leaderboard, but it can also be used as a chatbot and AI playground. Nobody likes to be alone always, but sometimes loneliness could be a better medicine to hunch the thirst for a peaceful environment.

A simple chatbot in Python is a basic conversational program that responds to user inputs using predefined rules or patterns. It processes user messages, matches them with available responses, and generates relevant replies, often lacking the complexity of machine learning-based bots. In this python chatbot tutorial, we’ll use exciting NLP libraries and learn how to make a chatbot from scratch in Python. ChatterBot is a library in python which generates a response to user input.

You can imagine that training your chatbot with more input data, particularly more relevant data, will produce better results. All of this data would interfere with the output of your chatbot python chatbot and would certainly make it sound much less conversational. Once you’ve clicked on Export chat, you need to decide whether or not to include media, such as photos or audio messages.

Next, you’ll create a function to get the current weather in a city from the OpenWeather API. In this section, you will create a script that accepts a city name from the user, queries the OpenWeather API for the current weather in that city, and displays the response. Because the industry-specific chat data in the provided WhatsApp chat export focused on houseplants, Chatpot now has some opinions on houseplant care. It’ll readily share them with you if you ask about it—or really, when you ask about anything.