Introduction to Langchain

Posted By :Sumit Kumar |26th February 2024

Langchain is a framework for developing applications backed by language models (Llama 2, ChatGPT, Mistral etc.)

It gives the ability to connect the models to any source of context (shot examples, PDF files with content etc) and how to answer based on provided context, what action to take etc.

Its libraries mainly come in two languages i.e Python and JavaScript.

Pro Tip: LangChain also provides a chatGPT 3.5 powered chatBot which answers anything about LangChain's Python documentation! https://chat.langchain.com/

LangChain provides several products which simplifies the entire lifecycle of an application :

  1. LangChain Libraries
  2. LangChain Templates
  3. LangServe.
  4. LangSmith

  • Development: One can write the applications in Langchain and Langchain.js. LangChain also provides templates for reference.
  • Production: with langSmith, you can keep an eye on your chain and deploy you application with ease.
  • Deploy: With LangServe, you can turn any chain into an API.

Installation:

LangChain installation is a piece of cake, run the following command according to your environment.

  • Pip
pip install langchain
  • Conda
conda install langchain -c conda-forge

 

Note:- This will install the bare minimum requirements of LangChain. You will need to install the prerequisites for individual integrations separately

 

From Source:

  1. Clone the langChain Repo.
  2. Navigate to the cloned directory.
  3. Run in terminal: 
pip install -e .

 

LangChain community:

This package contains various 3rd party integrations. It's automatically installed by the Langchain and can be separately installed by using:

pip install langchain-community

LangChain core:

It contains the base abstraction that the rest of the langchain ecosystem uses.

pip install langchain-core

LangServe:

Deploy LangChain runnables as REST API.

pip install "langserve[all]"

For client code: 

pip install "langserve[client]"

For Server code:

pip install "langserve[server]"

 

LangChain CLI:

LangChain CLI is useful for working with LangChain templates and other LangServe projects.

pip install langchain-cli

 

LangSmith SDK:

pip install langsmith

About Author

Sumit Kumar

Sumit's expertise shines as a Backend Developer, showcasing remarkable skill in Python and Django. Beyond this, he boasts a strong command of supplementary technologies such as HTML, CSS, MySQL, and JavaScript. His work ethic is truly impressive, and his resolute commitment empowers him to operate with great efficiency. Possessing a discerning ability to spot and rectify application issues, he guarantees peak performance.

Request For Proposal

[contact-form-7 404 "Not Found"]

Ready to innovate ? Let's get in touch

Chat With Us