DEV Community

Jonathan White
Jonathan White

Posted on

Langchain: The hell is it, anyway?

Langchain is a framework for constructing language-powered apps that is available in both Python and JS. We will utilize an API to link these apps to external data sources that can interact with their surroundings.

Frameworks

A framework is comparable to the convenience of sliced bread. Instead of going out and buying flour, yeast, and baking powder and combining those ingredients yourself, you can go to your local grocery store and acquire bread that has already been prepared and sliced for you.

In the same vein, you can go out and find components, libraries, and tools that assist in the development process, preventing a developer from having to start building their application from scratch.

Types Of Frameworks

Frameworks are specialized and come in different flavors (just like bread).

Some are used for automation, building web applications, mobile apps, or machine learning models.

Each framework offers a set of tools and features that are specific to that sort of application.

This helps developers to concentrate more on developing their application's unique features and logic, making software development a simpler process.

Machine Learning Models

A model in machine learning is a file that has been trained to recognize certain types of patterns. You train a model over a set of data, giving it an algorithm that it can use to reason over and learn from those data. - Microsoft

Language Models

A Language model is a type of model that is designed to understand and generate human language.

They seek to capture a language's core structure, syntax, and meanings for the purpose to produce logical and useful text.

They can be used for text production, machine translation, sentiment analysis, question answering, and other natural language processing (NLP) activities.

To learn the patterns and relationships inside a given language, these models require a large amount of textual data from many sources.

Data from books, papers, websites, and social media posts are included.

Using such big and diverse datasets allows the language model to be exposed to a wide range of linguistic patterns, vocabulary, sentence structures, and contextual cues.

The language model may learn the relationship between the words of the language and acquire a grasp of how words and phrases relate to one another by utilizing all of that material.

Understanding APIs

APIs act as messengers, allowing different software applications to communicate and share information.

They specify a set of rules and procedures for requesting, sending, and receiving data across applications.

Again, simplifying the developer process saves them from having to construct integrations with other third-party programs from start.

As a result, when you use websites like Bardeen, Make, and N8N, they communicate with the messengers supplied by other apps like Twitter or Notion.

As a result, we can communicate amongst apps.

External Data Source

This entails gathering data outside of the software under development. This data might come from a multitude of sources.

APIs are an excellent example of an external data source that, as previously stated, requests data from another program.

The application can read data from files (such as PDFs, Docs, and CSVs).

Or even data as soon as it happens (real-time data) from social media feeds like Twitter, Instagram, or Reddit.

Environment Interaction

How does Langchain interact with its surroundings? It is accomplished by the employment of Agents.

An agent is a Langchain component with access to a set of tools and the ability to select what to do based on user input.

Agents are classified into two types: action agents and plan-and-execute agents (which will not be mentioned).

The tools you offer an Agent determine how they interact with their surroundings.

Assume you want an Agent to determine the current value of Apple's stock. It would determine which habitat it would thrive in based on the tool you provide.

Normally, you would grant it access to the Serpapi so that the agent could conduct a Google search for pertinent information.

Conclusion

So there we have it. A true breakdown of what Langchain is

Let me know in the comments if you have any questions about Langchain.

Top comments (0)