agsamantha/node_modules/@langchain/core
2024-10-02 15:15:21 -05:00
..
callbacks update readme+reqs 2024-10-02 15:15:21 -05:00
dist update readme+reqs 2024-10-02 15:15:21 -05:00
document_loaders update readme+reqs 2024-10-02 15:15:21 -05:00
language_models update readme+reqs 2024-10-02 15:15:21 -05:00
load update readme+reqs 2024-10-02 15:15:21 -05:00
messages update readme+reqs 2024-10-02 15:15:21 -05:00
output_parsers update readme+reqs 2024-10-02 15:15:21 -05:00
retrievers update readme+reqs 2024-10-02 15:15:21 -05:00
runnables update readme+reqs 2024-10-02 15:15:21 -05:00
tracers update readme+reqs 2024-10-02 15:15:21 -05:00
utils update readme+reqs 2024-10-02 15:15:21 -05:00
agents.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
agents.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
agents.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
agents.js update readme+reqs 2024-10-02 15:15:21 -05:00
caches.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
caches.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
caches.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
caches.js update readme+reqs 2024-10-02 15:15:21 -05:00
chat_history.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
chat_history.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
chat_history.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
chat_history.js update readme+reqs 2024-10-02 15:15:21 -05:00
documents.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
documents.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
documents.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
documents.js update readme+reqs 2024-10-02 15:15:21 -05:00
embeddings.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
embeddings.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
embeddings.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
embeddings.js update readme+reqs 2024-10-02 15:15:21 -05:00
example_selectors.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
example_selectors.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
example_selectors.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
example_selectors.js update readme+reqs 2024-10-02 15:15:21 -05:00
indexing.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
indexing.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
indexing.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
indexing.js update readme+reqs 2024-10-02 15:15:21 -05:00
LICENSE update readme+reqs 2024-10-02 15:15:21 -05:00
load.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
load.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
load.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
load.js update readme+reqs 2024-10-02 15:15:21 -05:00
memory.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
memory.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
memory.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
memory.js update readme+reqs 2024-10-02 15:15:21 -05:00
messages.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
messages.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
messages.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
messages.js update readme+reqs 2024-10-02 15:15:21 -05:00
output_parsers.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
output_parsers.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
output_parsers.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
output_parsers.js update readme+reqs 2024-10-02 15:15:21 -05:00
outputs.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
outputs.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
outputs.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
outputs.js update readme+reqs 2024-10-02 15:15:21 -05:00
package.json update readme+reqs 2024-10-02 15:15:21 -05:00
prompt_values.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
prompt_values.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
prompt_values.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
prompt_values.js update readme+reqs 2024-10-02 15:15:21 -05:00
prompts.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
prompts.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
prompts.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
prompts.js update readme+reqs 2024-10-02 15:15:21 -05:00
README.md update readme+reqs 2024-10-02 15:15:21 -05:00
retrievers.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
retrievers.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
retrievers.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
retrievers.js update readme+reqs 2024-10-02 15:15:21 -05:00
runnables.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
runnables.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
runnables.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
runnables.js update readme+reqs 2024-10-02 15:15:21 -05:00
singletons.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
singletons.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
singletons.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
singletons.js update readme+reqs 2024-10-02 15:15:21 -05:00
stores.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
stores.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
stores.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
stores.js update readme+reqs 2024-10-02 15:15:21 -05:00
structured_query.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
structured_query.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
structured_query.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
structured_query.js update readme+reqs 2024-10-02 15:15:21 -05:00
tools.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
tools.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
tools.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
tools.js update readme+reqs 2024-10-02 15:15:21 -05:00
vectorstores.cjs update readme+reqs 2024-10-02 15:15:21 -05:00
vectorstores.d.cts update readme+reqs 2024-10-02 15:15:21 -05:00
vectorstores.d.ts update readme+reqs 2024-10-02 15:15:21 -05:00
vectorstores.js update readme+reqs 2024-10-02 15:15:21 -05:00

🦜🍎 @langchain/core

CI npm License: MIT Twitter

@langchain/core contains the core abstractions and schemas of LangChain.js, including base classes for language models, chat models, vectorstores, retrievers, and runnables.

💾 Quick Install

$ yarn add @langchain/core

🤔 What is this?

@langchain/core contains the base abstractions that power the rest of the LangChain ecosystem. These abstractions are designed to be as modular and simple as possible. Examples of these abstractions include those for language models, document loaders, embedding models, vectorstores, retrievers, and more. The benefit of having these abstractions is that any provider can implement the required interface and then easily be used in the rest of the LangChain ecosystem.

For example, you can install other provider-specific packages like this:

$ yarn add @langchain/openai

And use them as follows:

import { StringOutputParser } from "@langchain/core/output_parsers";
import { ChatPromptTemplate } from "@langchain/core/prompts";
import { ChatOpenAI } from "@langchain/openai";

const prompt = ChatPromptTemplate.fromTemplate(
  `Answer the following question to the best of your ability:\n{question}`
);

const model = new ChatOpenAI({
  temperature: 0.8,
});

const outputParser = new StringOutputParser();

const chain = prompt.pipe(model).pipe(outputParser);

const stream = await chain.stream({
  question: "Why is the sky blue?",
});

for await (const chunk of stream) {
  console.log(chunk);
}

/*
The
 sky
 appears
 blue
 because
 of
 a
 phenomenon
 known
 as
 Ray
leigh
 scattering
*/

Note that for compatibility, all used LangChain packages (including the base LangChain package, which itself depends on core!) must share the same version of @langchain/core. This means that you may need to install/resolve a specific version of @langchain/core that matches the dependencies of your used packages.

🔗 What is LangChain Expression Language?

LangChain Core also contains LangChain Expression Language, or LCEL, a runtime that allows users to compose arbitrary sequences together and get several benefits that are important when building LLM applications. We call these sequences “runnables”.

All runnables expose the same interface with single-invocation, batch, streaming and async methods. This design is useful because it is not enough to have a single sync interface when building an LLM application. Batch is needed for efficient processing of many inputs. Streaming (and streaming of intermediate steps) is needed to show the user that progress is being made. Async interfaces are nice when moving into production. Rather than having to write multiple implementations for all of those, LCEL allows you to write a runnable once and invoke it in many different ways.

For more check out the LCEL docs.

LangChain Stack

📕 Releases & Versioning

@langchain/core is currently on version 0.1.x.

As @langchain/core contains the base abstractions and runtime for the whole LangChain ecosystem, we will communicate any breaking changes with advance notice and version bumps. The exception for this is anything in @langchain/core/beta. The reason for @langchain/core/beta is that given the rate of change of the field, being able to move quickly is still a priority, and this module is our attempt to do so.

Minor version increases will occur for:

  • Breaking changes for any public interfaces NOT in @langchain/core/beta

Patch version increases will occur for:

  • Bug fixes
  • New features
  • Any changes to private interfaces
  • Any changes to @langchain/core/beta

📦 Creating your own package

Other LangChain packages should add this package as a dependency and extend the classes within. For an example, see the @langchain/anthropic in this repo.

Because all used packages must share the same version of core, we suggest using a tilde dependency to allow for different (backwards-compatible) patch versions:

{
  "name": "@langchain/anthropic",
  "version": "0.0.3",
  "description": "Anthropic integrations for LangChain.js",
  "type": "module",
  "author": "LangChain",
  "license": "MIT",
  "dependencies": {
    "@anthropic-ai/sdk": "^0.10.0",
    "@langchain/core": "~0.1.5"
  }
}

This recommendation will change to a caret once a major version (1.x.x) release has occurred.

We suggest making all packages cross-compatible with ESM and CJS using a build step like the one in @langchain/anthropic, then running yarn build before running npm publish.

We will be exploring how to make this process easier in the future.

💁 Contributing

Because @langchain/core is a low-level package whose abstractions will change infrequently, most contributions should be made in the higher-level LangChain package.

Bugfixes or suggestions should be made using the same guidelines as the main package. See here for detailed information.

Please report any security issues or concerns following our security guidelines.