Skip to content

When to import from "langchain" and when to import from "@langchain/core" #4647

Answered by dosubot bot
nnduc1994 asked this question in Q&A
Discussion options

You must be logged in to vote

The distinction between using imports from langchain versus @langchain/core and the necessity of installing @langchain/core separately, despite it being automatically installed with langchain, is rooted in the modular architecture of the LangChain ecosystem.

  1. When to use imports from langchain versus @langchain/core:

    • You should use langchain for general functionalities provided by the LangChain library. This package is designed to offer a broad set of features and utilities for working with language models and integrations.
    • You should use @langchain/core when you need access to the base abstractions that the rest of the LangChain ecosystem uses. This includes the LangChain Expression L…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nnduc1994
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant