File tree 11 files changed +47
-10
lines changed
11 files changed +47
-10
lines changed Original file line number Diff line number Diff line change
1
+ const package = require ( "langchain/package.json" ) ;
2
+
3
+ Object . keys ( package . exports ) . forEach ( ( key ) => {
4
+ if ( key === "./package.json" ) return ;
5
+
6
+ if ( key === "." ) {
7
+ require ( "langchain" ) ;
8
+ } else {
9
+ require ( `langchain/${ key . slice ( 2 ) } ` ) ;
10
+ // If this fails probably means that a ESM-only dependency is being imported
11
+ }
12
+ } ) ;
Original file line number Diff line number Diff line change 1
1
async function test ( ) {
2
2
const { default : assert } = await import ( "assert" ) ;
3
3
const { OpenAI } = await import ( "langchain" ) ;
4
- const { loadPrompt } = await import ( "langchain/prompts" ) ;
4
+ const { LLMChain } = await import ( "langchain/chains" ) ;
5
+ const { loadPrompt, ChatPromptTemplate } = await import ( "langchain/prompts" ) ;
5
6
const { HNSWLib } = await import ( "langchain/vectorstores" ) ;
6
7
const { OpenAIEmbeddings } = await import ( "langchain/embeddings" ) ;
7
8
const { InMemoryDocstore, Document } = await import ( "langchain/docstore" ) ;
8
9
const { CSVLoader } = await import ( "langchain/document_loaders" ) ;
9
10
10
11
// Test exports
11
12
assert ( typeof OpenAI === "function" ) ;
13
+ assert ( typeof LLMChain === "function" ) ;
12
14
assert ( typeof loadPrompt === "function" ) ;
15
+ assert ( typeof ChatPromptTemplate === "function" ) ;
13
16
assert ( typeof HNSWLib === "function" ) ;
14
17
15
18
// Test dynamic imports of peer dependencies
Original file line number Diff line number Diff line change 1
1
import assert from "assert" ;
2
2
import { OpenAI } from "langchain" ;
3
- import { loadPrompt } from "langchain/prompts" ;
3
+ import { LLMChain } from "langchain/chains" ;
4
+ import { loadPrompt , ChatPromptTemplate } from "langchain/prompts" ;
4
5
import { HNSWLib } from "langchain/vectorstores" ;
5
6
import { OpenAIEmbeddings } from "langchain/embeddings" ;
6
7
import { InMemoryDocstore , Document } from "langchain/docstore" ;
7
8
import { CSVLoader } from "langchain/document_loaders" ;
8
9
9
10
// Test exports
10
11
assert ( typeof OpenAI === "function" ) ;
12
+ assert ( typeof LLMChain === "function" ) ;
11
13
assert ( typeof loadPrompt === "function" ) ;
14
+ assert ( typeof ChatPromptTemplate === "function" ) ;
12
15
assert ( typeof HNSWLib === "function" ) ;
13
16
14
17
// Test dynamic imports of peer dependencies
Original file line number Diff line number Diff line change 1
1
import assert from "assert" ;
2
2
import { OpenAI } from "langchain" ;
3
- import { loadPrompt } from "langchain/prompts" ;
3
+ import { LLMChain } from "langchain/chains" ;
4
+ import { loadPrompt , ChatPromptTemplate } from "langchain/prompts" ;
4
5
import { HNSWLib } from "langchain/vectorstores" ;
5
6
import { OpenAIEmbeddings } from "langchain/embeddings" ;
6
7
import { InMemoryDocstore , Document } from "langchain/docstore" ;
@@ -9,7 +10,9 @@ import { CSVLoader } from "langchain/document_loaders";
9
10
async function test ( ) {
10
11
// Test exports
11
12
assert ( typeof OpenAI === "function" ) ;
13
+ assert ( typeof LLMChain === "function" ) ;
12
14
assert ( typeof loadPrompt === "function" ) ;
15
+ assert ( typeof ChatPromptTemplate === "function" ) ;
13
16
assert ( typeof HNSWLib === "function" ) ;
14
17
15
18
// Test dynamic imports of peer dependencies
Original file line number Diff line number Diff line change 5
5
"description" : " CJS Tests for the things exported by the langchain package" ,
6
6
"main" : " ./index.mjs" ,
7
7
"scripts" : {
8
- "test" : " npm run test:esm && npm run test:cjs && npm run test:cjs:import && npm run test:ts" ,
8
+ "test" : " npm run test:esm && npm run test:cjs && npm run test:cjs:import && npm run test:cjs:entrypoints && npm run test: ts" ,
9
9
"test:esm" : " node ./index.mjs" ,
10
10
"test:cjs" : " node ./require.js" ,
11
11
"test:cjs:import" : " node ./import.js" ,
12
+ "test:cjs:entrypoints" : " node ./entrypoints.js" ,
12
13
"test:ts" : " tsc && node dist/index.js" ,
13
14
"format" : " prettier --write \" **/*.ts\" " ,
14
15
"format:check" : " prettier --list-different \" **/*.ts\" "
Original file line number Diff line number Diff line change 1
1
const assert = require ( "assert" ) ;
2
2
const { OpenAI } = require ( "langchain" ) ;
3
- const { loadPrompt } = require ( "langchain/prompts" ) ;
3
+ const { LLMChain } = require ( "langchain/chains" ) ;
4
+ const { loadPrompt, ChatPromptTemplate } = require ( "langchain/prompts" ) ;
4
5
const { HNSWLib } = require ( "langchain/vectorstores" ) ;
5
6
const { OpenAIEmbeddings } = require ( "langchain/embeddings" ) ;
6
7
const { InMemoryDocstore, Document } = require ( "langchain/docstore" ) ;
@@ -9,7 +10,9 @@ const { CSVLoader } = require("langchain/document_loaders");
9
10
async function test ( ) {
10
11
// Test exports
11
12
assert ( typeof OpenAI === "function" ) ;
13
+ assert ( typeof LLMChain === "function" ) ;
12
14
assert ( typeof loadPrompt === "function" ) ;
15
+ assert ( typeof ChatPromptTemplate === "function" ) ;
13
16
assert ( typeof HNSWLib === "function" ) ;
14
17
15
18
// Test dynamic imports of peer dependencies
Original file line number Diff line number Diff line change 1
1
async function test ( ) {
2
2
const { default : assert } = await import ( "assert" ) ;
3
3
const { OpenAI } = await import ( "langchain" ) ;
4
- const { loadPrompt } = await import ( "langchain/prompts" ) ;
4
+ const { LLMChain } = await import ( "langchain/chains" ) ;
5
+ const { loadPrompt, ChatPromptTemplate } = await import ( "langchain/prompts" ) ;
5
6
const { HNSWLib } = await import ( "langchain/vectorstores" ) ;
6
7
const { OpenAIEmbeddings } = await import ( "langchain/embeddings" ) ;
7
8
const { InMemoryDocstore, Document } = await import ( "langchain/docstore" ) ;
8
9
const { CSVLoader } = await import ( "langchain/document_loaders" ) ;
9
10
10
11
// Test exports
11
12
assert ( typeof OpenAI === "function" ) ;
13
+ assert ( typeof LLMChain === "function" ) ;
12
14
assert ( typeof loadPrompt === "function" ) ;
15
+ assert ( typeof ChatPromptTemplate === "function" ) ;
13
16
assert ( typeof HNSWLib === "function" ) ;
14
17
15
18
// Test dynamic imports of peer dependencies
Original file line number Diff line number Diff line change 1
1
import assert from "assert" ;
2
2
import { OpenAI } from "langchain" ;
3
- import { loadPrompt } from "langchain/prompts" ;
3
+ import { LLMChain } from "langchain/chains" ;
4
+ import { loadPrompt , ChatPromptTemplate } from "langchain/prompts" ;
4
5
import { HNSWLib } from "langchain/vectorstores" ;
5
6
import { OpenAIEmbeddings } from "langchain/embeddings" ;
6
7
import { InMemoryDocstore , Document } from "langchain/docstore" ;
7
8
import { CSVLoader } from "langchain/document_loaders" ;
8
9
9
10
// Test exports
10
11
assert ( typeof OpenAI === "function" ) ;
12
+ assert ( typeof LLMChain === "function" ) ;
11
13
assert ( typeof loadPrompt === "function" ) ;
14
+ assert ( typeof ChatPromptTemplate === "function" ) ;
12
15
assert ( typeof HNSWLib === "function" ) ;
13
16
14
17
// Test dynamic imports of peer dependencies
Original file line number Diff line number Diff line change 1
1
import assert from "assert" ;
2
2
import { OpenAI } from "langchain" ;
3
- import { loadPrompt } from "langchain/prompts" ;
3
+ import { LLMChain } from "langchain/chains" ;
4
+ import { loadPrompt , ChatPromptTemplate } from "langchain/prompts" ;
4
5
import { HNSWLib } from "langchain/vectorstores" ;
5
6
import { OpenAIEmbeddings } from "langchain/embeddings" ;
6
7
import { InMemoryDocstore , Document } from "langchain/docstore" ;
@@ -9,7 +10,9 @@ import { CSVLoader } from "langchain/document_loaders";
9
10
async function test ( ) {
10
11
// Test exports
11
12
assert ( typeof OpenAI === "function" ) ;
13
+ assert ( typeof LLMChain === "function" ) ;
12
14
assert ( typeof loadPrompt === "function" ) ;
15
+ assert ( typeof ChatPromptTemplate === "function" ) ;
13
16
assert ( typeof HNSWLib === "function" ) ;
14
17
15
18
// Test dynamic imports of peer dependencies
Original file line number Diff line number Diff line change 7
7
"type" : " module" ,
8
8
"scripts" : {
9
9
"test" : " npm run test:esm && npm run test:cjs && npm run test:cjs:import && npm run test:ts" ,
10
- "test:esm" : " node ./index.mjs " ,
10
+ "test:esm" : " node ./index.js " ,
11
11
"test:cjs" : " node ./require.cjs" ,
12
12
"test:cjs:import" : " node ./import.cjs" ,
13
13
"test:ts" : " tsc && node dist/index.js" ,
Original file line number Diff line number Diff line change 1
1
const assert = require ( "assert" ) ;
2
2
const { OpenAI } = require ( "langchain" ) ;
3
- const { loadPrompt } = require ( "langchain/prompts" ) ;
3
+ const { LLMChain } = require ( "langchain/chains" ) ;
4
+ const { loadPrompt, ChatPromptTemplate } = require ( "langchain/prompts" ) ;
4
5
const { HNSWLib } = require ( "langchain/vectorstores" ) ;
5
6
const { OpenAIEmbeddings } = require ( "langchain/embeddings" ) ;
6
7
const { InMemoryDocstore, Document } = require ( "langchain/docstore" ) ;
@@ -9,7 +10,9 @@ const { CSVLoader } = require("langchain/document_loaders");
9
10
async function test ( ) {
10
11
// Test exports
11
12
assert ( typeof OpenAI === "function" ) ;
13
+ assert ( typeof LLMChain === "function" ) ;
12
14
assert ( typeof loadPrompt === "function" ) ;
15
+ assert ( typeof ChatPromptTemplate === "function" ) ;
13
16
assert ( typeof HNSWLib === "function" ) ;
14
17
15
18
// Test dynamic imports of peer dependencies
You can’t perform that action at this time.
0 commit comments