Socket
Socket
Sign inDemoInstall

langchain

Package Overview
Dependencies
21
Maintainers
3
Versions
284
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

langchain


Version published
Maintainers
3
Created

Package description

What is langchain?

The langchain npm package is designed to facilitate the development of applications that leverage language models. It provides tools for chaining together different language model operations, managing prompts, and integrating with various data sources.

What are langchain's main functionalities?

Prompt Management

This feature allows you to create and manage prompts easily. You can define templates and format them with dynamic data.

const { PromptTemplate } = require('langchain');

const template = new PromptTemplate('Translate the following text to French: {text}');
const prompt = template.format({ text: 'Hello, how are you?' });
console.log(prompt); // Output: Translate the following text to French: Hello, how are you?

Chaining Operations

This feature allows you to chain together multiple operations, where the output of one step becomes the input to the next.

const { Chain } = require('langchain');

const chain = new Chain();
chain.addStep(async (input) => `Step 1: ${input}`);
chain.addStep(async (input) => `Step 2: ${input}`);

chain.run('Initial Input').then(console.log); // Output: Step 2: Step 1: Initial Input

Integration with Data Sources

This feature allows you to integrate with various data sources, making it easy to fetch and use data within your language model operations.

const { DataSource } = require('langchain');

const dataSource = new DataSource('https://api.example.com/data');
dataSource.fetch().then(data => console.log(data));

Other packages similar to langchain

Readme

Source

šŸ¦œļøšŸ”— LangChain.js

āš” Building applications with LLMs through composability āš”

CI npm License: MIT Twitter Open in Dev Containers

Looking for the Python version? Check out LangChain.

To help you ship LangChain apps to production faster, check out LangSmith. LangSmith is a unified developer platform for building, testing, and monitoring LLM applications. Fill out this form to get off the waitlist or speak with our sales team

Quick Install

yarn add langchain

import { OpenAI } from "langchain/llms/openai";

Supported Environments

LangChain is written in TypeScript and can be used in:

  • Node.js (ESM and CommonJS) - 18.x, 19.x, 20.x
  • Cloudflare Workers
  • Vercel / Next.js (Browser, Serverless and Edge functions)
  • Supabase Edge Functions
  • Browser
  • Deno

šŸ¤” What is this?

Large language models (LLMs) are emerging as a transformative technology, enabling developers to build applications that they previously could not. But using these LLMs in isolation is often not enough to create a truly powerful app - the real power comes when you can combine them with other sources of computation or knowledge.

This library is aimed at assisting in the development of those types of applications.

šŸ“– Full Documentation

For full documentation of prompts, chains, agents and more, please see here.

Relationship with Python LangChain

This is built to integrate as seamlessly as possible with the LangChain Python package. Specifically, this means all objects (prompts, LLMs, chains, etc) are designed in a way where they can be serialized and shared between languages.

The LangChainHub is a central place for the serialized versions of these prompts, chains, and agents.

šŸ’ Contributing

As an open source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infra, or better documentation.

Check out our contributing guidelines for instructions on how to contribute.

Keywords

FAQs

Last updated on 08 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc