Skip to content

Commit

Permalink
Update migration guide
Browse files Browse the repository at this point in the history
  • Loading branch information
nfcampos committed Apr 10, 2023
1 parent 2a6d4be commit b48a043
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
13 changes: 13 additions & 0 deletions docs/docs/getting-started/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,19 @@ This applies to all imports from the following 6 modules, which have been split

Other modules are not affected by this change, and you can continue to import them from the same path.

Additionally, there are some breaking changes that were needed to support new environments:

- `import { Calculator } from "langchain/tools";` now moved to
- `import { Calculator } from "langchain/tools/calculator";`
- `import { loadLLM } from "langchain/llms";` now moved to
- `import { loadLLM } from "langchain/llms/load";`
- `import { loadAgent } from "langchain/agents";` now moved to
- `import { loadAgent } from "langchain/agents/load";`
- `import { loadPrompt } from "langchain/prompts";` now moved to
- `import { loadPrompt } from "langchain/prompts/load";`
- `import { loadChain } from "langchain/chains";` now moved to
- `import { loadChain } from "langchain/chains/load";`

## Unsupported: Node.js 16

We do not support Node.js 16, but if you still want to run LangChain on Node.js 16, you will need to follow the instructions in this section. We do not guarantee that these instructions will continue to work in the future.
Expand Down
4 changes: 2 additions & 2 deletions langchain/src/chains/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ const loadChainFromFile: FileLoader<BaseChain> = async (
* @example
* Loading from LangchainHub:
* ```ts
* import { loadChain } from "langchain/chains";
* import { loadChain } from "langchain/chains/load";
* const chain = await loadChain("lc://chains/hello-world/chain.json");
* const res = await chain.call({ topic: "my favorite color" });
* ```
*
* @example
* Loading from local filesystem:
* ```ts
* import { loadChain } from "langchain/chains";
* import { loadChain } from "langchain/chains/load";
* const chain = await loadChain("/path/to/chain.json");
* ```
*/
Expand Down
2 changes: 1 addition & 1 deletion langchain/src/llms/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { parseFileConfig } from "../util/parse.js";
*
* @example
* ```ts
* import { loadLLM } from "langchain/llms/openai";
* import { loadLLM } from "langchain/llms/load";
* const model = await loadLLM("/path/to/llm.json");
* ```
*/
Expand Down
4 changes: 2 additions & 2 deletions langchain/src/prompts/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const loadPromptFromFile: FileLoader<BasePromptTemplate> = (text, path) =>
* @example
* Loading from LangchainHub:
* ```ts
* import { loadPrompt } from "langchain/prompts";
* import { loadPrompt } from "langchain/prompts/load";
* const prompt = await loadPrompt("lc://prompts/hello-world/prompt.yaml");
* ```
*
* @example
* Loading from local filesystem:
* ```ts
* import { loadPrompt } from "langchain/prompts";
* import { loadPrompt } from "langchain/prompts/load";
* const prompt = await loadPrompt("/path/to/prompt.json");
* ```
*/
Expand Down

0 comments on commit b48a043

Please sign in to comment.