AI won't replace you - a person using LangChain will

We are witnessing an explosion of innovation in artificial intelligence at the moment. OpenAI and its rapid iteration of Chat GPT, now on Version 4 is leading this charge though Llama 2 is starting to outperform Chat GPT as well.

The truth is that AI won't replace you - a person using AI, specifically frameworks like Langchain, will. AI is a tool, and like any tool, it requires someone to use it effectively. The ability to use generative AI tools is a game-changer for anyone in practically any industry. Archimedes once said:

"Give me a place to stand, and a lever long enough, and I will move the world."

AI is the biggest lever in the world - and I'm going to give you a high level crash course on how you can use it and build a place to stand on.

What is LangChain and why should I care about it?

Simply put, LangChain is a framework for developing applications powered by language models. Yes, I know what you're thinking. "That means nothing. Can you explain it in plain English and tell me why I should care".

Okay, so here's why you should care.

LangChain let's you take any data source like a spreadsheet or a database and talk to it in English. Say you have a spreadsheet with accounting information in it, instead of figuring out the right Excel formula to calculate some number like total profit or cash in the bank after 3 years, you can simply connect that spreadsheet as a data source in LangChain, and then you ask it "What is the total profit for 2023?" and it will answer that for you.

I'm not sure most people or most companies understand how powerful this is. This is the holy grail for productivity. Most people know that one of the biggest problems in any modern company isn't the lack of data, but it's having tons of data and no easy ways to draw valuable insights from that data that can be applied to making better decisions.

Traditionally, to do that you would need business analysts and/or data engineers who could use BI tools, SQL queries or some other technical tool to manually make sense of the data and put a useful graph or number in front of various teams who could then use them in their day-to-day jobs. With generative AI and LangChain, every company in the world could have a simple app that allows any team member to upload company data safely to it and then instantly query it and ask questions to gain critical insights.

LangChain gives you the blocking blocks to load, transform, store and query your data! Imagine every company having their own internal ChatGPT - this is what can easily be created with LangChain.

Most Companies Are Getting It Wrong

You might have heard many companies are banning employees from using ChatGPT due to uploading proprietary data to it - which you obviously shouldn't do since ChatGPT is public large language model (key word being public).

However, by banning ChatGPT and not replacing it with an internal chatbot, these companies are essentially removing the lever that employees can use to be 10x more productive. What they should be doing is creating an internal app that allows team members to upload documents and data sources, and thereafter allows quering it using an internal chatbot. This keeps the company documentation fully under the company's control (within the app) while still benefitting from the power of LLMs.

You control what is sent to public LLMs like ChatGPT in LangChain itself because LangChain allows you to utilise public LLMs like ChatGPT and Llama in a very bespoke way, and you can control exactly what data you send to it and what data you don't send to it.

What Should You Do?

As a leader in any shape or form in your company, you should be looking to develop an internal chatbot that your employees can leverage.

A very basic version of this chatbot can take less than two weeks to develop with a few lines of code because of the incredibly powerful AI infrastructure and developer tooling that now exists. For Version 1, you should aim to develop a chatbot that combines three fundamental data sources as "tools" in a LangChain Agent. These three tools should be:

  • A BI database or another primary data source with your company proprietary data: This will allow the chatbot to provide contextual answers based on your proprietary data. ChatGPT can't answer questions about your company or customers because it cannot access this data. In your internal chatbot, you should expose the data to the relevant employees based on your information classification and data protection policies. This is your moat and nobody else can leverage your proprietary data.
  • An LLM: This is simply the large language model and general AI which is what ChatGPT is. This can answer general questions like "What is the capital of the United Kingdom?".
  • A search engine for real-time data: ChatGPT cannot look up information in real time (e.g the weather for tomorrow) unless you use it with the search/browsing plugin. So your chatbot app should also be able to hook into a search engine so that team members can quickly get real-time answers.

By combining those three, you will have an internal chatbot that becomes a swiss army knife for your team members and they won't need to use your company BI tools, databases spreadsheets, Google search or ChatGPT because your AI chatbot will have all of those capabilities and knowledge.

Now you're probably thinking this is really complicated. Wrong. Here's a few lines of Typescript code using the LangChain library I wrote to show you how easy it is to allow your team members to chat with your proprietary database for example:

  const datasource = new DataSource({
      type: 'postgres',
      url: config.database_url,
    });

    const db = await SqlDatabase.fromDataSourceParams({
      appDataSource: datasource,
    });

    const llmGPT3 = new OpenAI({
      temperature,
      modelName: 'gpt-3.5-turbo-16k',
      openAIApiKey: config.open_ai_api_key,
    });
    // Create the sql database chain
    const sqlChain = new SqlDatabaseChain({
      llm: llmGPT3,
      database: db,
    });
    // Question
    const question = 'How many customers do we have?';
    const result = await sqlChain.call({ query: question });

    // Output
    // e.g. There are 3005 customers in the database.
    return result;
This is the most basic example as it uses the entire database as a data source. You will likely need to choose the relevant tables or columns that you want to expose to your chatbot.

In just 26 lines, I've replaced most BI analysts and SQL query specialists. I can now speak English to my database and get the insights I need when I need it, and I get it back in plain English.

Example of the internal chatbot I built at BX that combines ChatGPT, our internal database and a search engine.

What Should You Do If You Have No Engineers?

Ideally, you need a plan to invest in technical talent so that you're able to fully leverage the most powerful AI APIs and frameworks in your company. If you can't, luckily there is also a vast catalogue of AI applications that have built, many of them are admittedly "Chat GPT wrappers" and aren't very sophisticated, but the few good one's out there will allow you and your team members to make company documents or data stores querable; in a safe way while ensuring you still control your data and abide by your data protection policies.

You can chat to a company PDF or report, have meeting/interview notes summarised or get the BI you need from various company datasources using natural language.

I've delivered a few "AI Enablement" workshops to companies, so I've put a collection of useful tools and starting points together in this slide deck which is publicy and freely available (link just below). In the slides, the tools and applications are categorised by different departments so you can find the right AI tool for each department including Sales, Customer Success, Engineering, Product, Design, Finance and Operations.

Naidoo Notes AI Enablement
AI Enablement NaidooNotes.com

I update it from time to time as I find new tools (if you'd like to submit a useful AI tool or resource to add to it, email it to hello@naidoonotes.com).

That brings me to the end of a very quick and high level crash course on what I believe every leader and company should be thinking about when it comes to leveraging AI right now.

What are your thoughts? Let me know in the comments.