langchain 0.3.27 → 0.3.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/agent.cjs +36 -3
- package/dist/agents/format_scratchpad/log.cjs +1 -2
- package/dist/agents/format_scratchpad/log_to_message.cjs +1 -2
- package/dist/agents/format_scratchpad/openai_functions.cjs +2 -3
- package/dist/agents/format_scratchpad/tool_calling.cjs +2 -3
- package/dist/agents/format_scratchpad/xml.cjs +1 -2
- package/dist/agents/initialize.cjs +2 -2
- package/dist/agents/openai_functions/index.cjs +3 -3
- package/dist/agents/openai_tools/index.cjs +2 -2
- package/dist/agents/react/index.cjs +1 -2
- package/dist/agents/structured_chat/index.cjs +6 -4
- package/dist/agents/structured_chat/index.js +5 -3
- package/dist/agents/structured_chat/prompt.d.ts +1 -1
- package/dist/agents/tool_calling/index.cjs +1 -2
- package/dist/agents/tool_calling/output_parser.cjs +2 -2
- package/dist/agents/toolkits/conversational_retrieval/openai_functions.cjs +1 -2
- package/dist/agents/toolkits/conversational_retrieval/tool.cjs +1 -2
- package/dist/agents/toolkits/json/json.cjs +2 -2
- package/dist/agents/toolkits/openapi/openapi.cjs +2 -2
- package/dist/agents/toolkits/sql/sql.cjs +2 -2
- package/dist/agents/toolkits/vectorstore/vectorstore.cjs +3 -3
- package/dist/agents/xml/index.cjs +2 -2
- package/dist/chains/api/prompts.d.ts +1 -1
- package/dist/chains/base.cjs +42 -9
- package/dist/chains/base.d.ts +2 -2
- package/dist/chains/base.js +1 -1
- package/dist/chains/combine_documents/base.cjs +2 -2
- package/dist/chains/combine_documents/reduce.cjs +2 -3
- package/dist/chains/combine_documents/stuff.cjs +1 -2
- package/dist/chains/history_aware_retriever.cjs +1 -2
- package/dist/chains/openai_functions/base.cjs +5 -6
- package/dist/chains/openai_functions/base.d.ts +3 -4
- package/dist/chains/openai_functions/base.js +4 -4
- package/dist/chains/openai_functions/extraction.cjs +6 -7
- package/dist/chains/openai_functions/extraction.d.ts +4 -4
- package/dist/chains/openai_functions/extraction.js +4 -4
- package/dist/chains/openai_functions/openapi.cjs +4 -5
- package/dist/chains/openai_functions/openapi.d.ts +1 -1
- package/dist/chains/openai_functions/openapi.js +1 -1
- package/dist/chains/openai_functions/structured_output.cjs +7 -7
- package/dist/chains/openai_functions/structured_output.d.ts +7 -8
- package/dist/chains/openai_functions/structured_output.js +5 -5
- package/dist/chains/openai_functions/tagging.cjs +4 -5
- package/dist/chains/openai_functions/tagging.d.ts +2 -2
- package/dist/chains/openai_functions/tagging.js +2 -2
- package/dist/chains/query_constructor/index.cjs +3 -3
- package/dist/chains/query_constructor/index.d.ts +2 -2
- package/dist/chains/question_answering/load.cjs +4 -4
- package/dist/chains/retrieval.cjs +1 -2
- package/dist/chains/router/utils.cjs +1 -2
- package/dist/chains/sequential_chain.cjs +2 -1
- package/dist/chains/sequential_chain.js +2 -1
- package/dist/chains/sql_db/sql_db_chain.cjs +2 -2
- package/dist/chat_models/universal.cjs +54 -21
- package/dist/document_loaders/fs/buffer.cjs +34 -1
- package/dist/document_loaders/fs/buffer.d.ts +0 -3
- package/dist/document_loaders/fs/directory.cjs +35 -2
- package/dist/document_loaders/fs/directory.d.ts +0 -2
- package/dist/document_loaders/fs/text.cjs +34 -1
- package/dist/document_loaders/fs/text.d.ts +0 -1
- package/dist/document_transformers/openai_functions.cjs +5 -5
- package/dist/document_transformers/openai_functions.d.ts +3 -3
- package/dist/document_transformers/openai_functions.js +2 -2
- package/dist/evaluation/embedding_distance/base.cjs +3 -3
- package/dist/evaluation/loader.cjs +1 -2
- package/dist/experimental/autogpt/output_parser.cjs +2 -2
- package/dist/experimental/autogpt/prompt_generator.cjs +4 -4
- package/dist/experimental/autogpt/prompt_generator.js +3 -3
- package/dist/experimental/generative_agents/generative_agent.cjs +1 -1
- package/dist/experimental/generative_agents/generative_agent.js +1 -1
- package/dist/experimental/openai_assistant/index.cjs +8 -4
- package/dist/experimental/openai_assistant/index.d.ts +6 -6
- package/dist/experimental/openai_assistant/index.js +9 -5
- package/dist/experimental/openai_files/index.cjs +2 -2
- package/dist/experimental/openai_files/index.d.ts +6 -4
- package/dist/experimental/openai_files/index.js +2 -2
- package/dist/experimental/plan_and_execute/agent_executor.cjs +2 -2
- package/dist/hub/base.cjs +4 -5
- package/dist/hub/index.cjs +2 -2
- package/dist/hub/node.cjs +43 -10
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -1
- package/dist/load/import_map.cjs +17 -7
- package/dist/load/index.cjs +18 -9
- package/dist/output_parsers/expression_type_handlers/base.cjs +34 -1
- package/dist/output_parsers/openai_functions.d.ts +1 -1
- package/dist/output_parsers/router.d.ts +3 -3
- package/dist/output_parsers/structured.cjs +6 -5
- package/dist/output_parsers/structured.d.ts +9 -8
- package/dist/output_parsers/structured.js +6 -5
- package/dist/prompts/index.cjs +0 -1
- package/dist/prompts/index.d.ts +0 -1
- package/dist/prompts/index.js +1 -1
- package/dist/retrievers/hyde.cjs +2 -2
- package/dist/retrievers/parent_document.cjs +17 -7
- package/dist/smith/config.cjs +5 -6
- package/dist/smith/name_generation.cjs +1 -2
- package/dist/smith/runner_utils.cjs +1 -2
- package/dist/sql_db.cjs +35 -2
- package/dist/storage/encoder_backed.cjs +2 -2
- package/dist/storage/encoder_backed.d.ts +1 -1
- package/dist/storage/file_system.cjs +17 -7
- package/dist/storage/file_system.d.ts +1 -1
- package/dist/stores/file/node.cjs +17 -7
- package/dist/tools/convert_to_openai.cjs +5 -5
- package/dist/tools/convert_to_openai.js +4 -4
- package/dist/tools/fs.d.ts +3 -2
- package/dist/tools/render.cjs +6 -5
- package/dist/tools/render.js +5 -3
- package/dist/tools/retriever.cjs +1 -2
- package/dist/tools/webbrowser.cjs +17 -7
- package/dist/util/axios-fetch-adapter.cjs +1 -1
- package/dist/util/azure.cjs +1 -2
- package/dist/util/entrypoint_deprecation.cjs +2 -3
- package/dist/util/load.cjs +34 -1
- package/dist/util/ml-distance/distances.cjs +3 -4
- package/dist/util/ml-distance/similarities.cjs +1 -2
- package/dist/util/ml-distance-euclidean/euclidean.cjs +2 -3
- package/dist/util/openapi.cjs +17 -7
- package/dist/util/openapi.d.ts +32 -32
- package/dist/util/parse.cjs +17 -7
- package/dist/util/prompt-layer.d.ts +1 -1
- package/dist/util/set.cjs +3 -4
- package/dist/util/time.cjs +1 -2
- package/package.json +8 -9
|
@@ -44,7 +44,7 @@ class OpenAIFiles extends serializable_1.Serializable {
|
|
|
44
44
|
* @returns {Promise<OpenAIClient.Files.FileDeleted>}
|
|
45
45
|
*/
|
|
46
46
|
async deleteFile({ fileId, options, }) {
|
|
47
|
-
return this.oaiClient.files.
|
|
47
|
+
return this.oaiClient.files.delete(fileId, options);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* List files
|
|
@@ -82,7 +82,7 @@ class OpenAIFiles extends serializable_1.Serializable {
|
|
|
82
82
|
* @returns {Promise<string>}
|
|
83
83
|
*/
|
|
84
84
|
async retrieveFileContent({ fileId, options, }) {
|
|
85
|
-
return this.oaiClient.files.
|
|
85
|
+
return this.oaiClient.files.retrieve(fileId, options);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
exports.OpenAIFiles = OpenAIFiles;
|
|
@@ -23,7 +23,7 @@ export declare class OpenAIFiles extends Serializable {
|
|
|
23
23
|
createFile({ file, purpose, options, }: OpenAIClient.FileCreateParams & {
|
|
24
24
|
options?: OpenAIClient.RequestOptions;
|
|
25
25
|
}): Promise<OpenAIClient.Files.FileObject & {
|
|
26
|
-
_request_id?: string | null
|
|
26
|
+
_request_id?: string | null;
|
|
27
27
|
}>;
|
|
28
28
|
/**
|
|
29
29
|
* Delete a file.
|
|
@@ -37,7 +37,7 @@ export declare class OpenAIFiles extends Serializable {
|
|
|
37
37
|
fileId: string;
|
|
38
38
|
options?: OpenAIClient.RequestOptions;
|
|
39
39
|
}): Promise<OpenAIClient.Files.FileDeleted & {
|
|
40
|
-
_request_id?: string | null
|
|
40
|
+
_request_id?: string | null;
|
|
41
41
|
}>;
|
|
42
42
|
/**
|
|
43
43
|
* List files
|
|
@@ -65,7 +65,7 @@ export declare class OpenAIFiles extends Serializable {
|
|
|
65
65
|
fileId: string;
|
|
66
66
|
options?: OpenAIClient.RequestOptions;
|
|
67
67
|
}): Promise<OpenAIClient.Files.FileObject & {
|
|
68
|
-
_request_id?: string | null
|
|
68
|
+
_request_id?: string | null;
|
|
69
69
|
}>;
|
|
70
70
|
/**
|
|
71
71
|
* Retrieve file content
|
|
@@ -81,5 +81,7 @@ export declare class OpenAIFiles extends Serializable {
|
|
|
81
81
|
retrieveFileContent({ fileId, options, }: {
|
|
82
82
|
fileId: string;
|
|
83
83
|
options?: OpenAIClient.RequestOptions;
|
|
84
|
-
}): Promise<
|
|
84
|
+
}): Promise<OpenAIClient.Files.FileObject & {
|
|
85
|
+
_request_id?: string | null;
|
|
86
|
+
}>;
|
|
85
87
|
}
|
|
@@ -41,7 +41,7 @@ export class OpenAIFiles extends Serializable {
|
|
|
41
41
|
* @returns {Promise<OpenAIClient.Files.FileDeleted>}
|
|
42
42
|
*/
|
|
43
43
|
async deleteFile({ fileId, options, }) {
|
|
44
|
-
return this.oaiClient.files.
|
|
44
|
+
return this.oaiClient.files.delete(fileId, options);
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* List files
|
|
@@ -79,6 +79,6 @@ export class OpenAIFiles extends Serializable {
|
|
|
79
79
|
* @returns {Promise<string>}
|
|
80
80
|
*/
|
|
81
81
|
async retrieveFileContent({ fileId, options, }) {
|
|
82
|
-
return this.oaiClient.files.
|
|
82
|
+
return this.oaiClient.files.retrieve(fileId, options);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlanAndExecuteAgentExecutor =
|
|
3
|
+
exports.PlanAndExecuteAgentExecutor = void 0;
|
|
4
|
+
exports.isDynamicStructuredTool = isDynamicStructuredTool;
|
|
4
5
|
const base_js_1 = require("../../chains/base.cjs");
|
|
5
6
|
const base_js_2 = require("./base.cjs");
|
|
6
7
|
const executor_js_1 = require("../../agents/executor.cjs");
|
|
@@ -22,7 +23,6 @@ function isDynamicStructuredTool(tool) {
|
|
|
22
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
24
|
tool.constructor.lc_name() === "DynamicStructuredTool");
|
|
24
25
|
}
|
|
25
|
-
exports.isDynamicStructuredTool = isDynamicStructuredTool;
|
|
26
26
|
/**
|
|
27
27
|
* Class representing a plan-and-execute agent executor. This agent
|
|
28
28
|
* decides on the full sequence of actions upfront, then executes them all
|
package/dist/hub/base.cjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.basePush = basePush;
|
|
4
|
+
exports.basePull = basePull;
|
|
5
|
+
exports.generateModelImportMap = generateModelImportMap;
|
|
6
|
+
exports.generateOptionalImportMap = generateOptionalImportMap;
|
|
4
7
|
const langsmith_1 = require("langsmith");
|
|
5
8
|
/**
|
|
6
9
|
* Push a prompt to the hub.
|
|
@@ -22,7 +25,6 @@ async function basePush(repoFullName, runnable, options) {
|
|
|
22
25
|
};
|
|
23
26
|
return client.pushPrompt(repoFullName, payloadOptions);
|
|
24
27
|
}
|
|
25
|
-
exports.basePush = basePush;
|
|
26
28
|
async function basePull(ownerRepoCommit, options) {
|
|
27
29
|
const client = new langsmith_1.Client(options);
|
|
28
30
|
const promptObject = await client.pullPromptCommit(ownerRepoCommit, {
|
|
@@ -64,7 +66,6 @@ async function basePull(ownerRepoCommit, options) {
|
|
|
64
66
|
}
|
|
65
67
|
return promptObject;
|
|
66
68
|
}
|
|
67
|
-
exports.basePull = basePull;
|
|
68
69
|
function generateModelImportMap(
|
|
69
70
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
71
|
modelClass) {
|
|
@@ -111,7 +112,6 @@ modelClass) {
|
|
|
111
112
|
}
|
|
112
113
|
return modelImportMap;
|
|
113
114
|
}
|
|
114
|
-
exports.generateModelImportMap = generateModelImportMap;
|
|
115
115
|
function generateOptionalImportMap(
|
|
116
116
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
117
|
modelClass) {
|
|
@@ -138,4 +138,3 @@ modelClass) {
|
|
|
138
138
|
}
|
|
139
139
|
return optionalImportMap;
|
|
140
140
|
}
|
|
141
|
-
exports.generateOptionalImportMap = generateOptionalImportMap;
|
package/dist/hub/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.push = void 0;
|
|
4
|
+
exports.pull = pull;
|
|
4
5
|
const index_js_1 = require("../load/index.cjs");
|
|
5
6
|
const base_js_1 = require("./base.cjs");
|
|
6
7
|
Object.defineProperty(exports, "push", { enumerable: true, get: function () { return base_js_1.basePush; } });
|
|
@@ -50,4 +51,3 @@ async function pull(ownerRepoCommit, options) {
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
|
-
exports.pull = pull;
|
package/dist/hub/node.cjs
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
36
|
+
exports.push = void 0;
|
|
37
|
+
exports.pull = pull;
|
|
4
38
|
const base_js_1 = require("./base.cjs");
|
|
5
39
|
Object.defineProperty(exports, "push", { enumerable: true, get: function () { return base_js_1.basePush; } });
|
|
6
40
|
const index_js_1 = require("../load/index.cjs");
|
|
@@ -21,29 +55,29 @@ async function pull(ownerRepoCommit, options) {
|
|
|
21
55
|
if (Array.isArray(promptObject.manifest.kwargs?.last?.kwargs?.bound?.id)) {
|
|
22
56
|
const modelName = promptObject.manifest.kwargs?.last?.kwargs?.bound?.id.at(-1);
|
|
23
57
|
if (modelName === "ChatOpenAI") {
|
|
24
|
-
modelClass = (await
|
|
58
|
+
modelClass = (await Promise.resolve().then(() => __importStar(require("@langchain/openai")))).ChatOpenAI;
|
|
25
59
|
}
|
|
26
60
|
else if (modelName === "ChatAnthropic") {
|
|
27
|
-
modelClass = (await
|
|
61
|
+
modelClass = (await Promise.resolve().then(() => __importStar(require("@langchain/anthropic")))).ChatAnthropic;
|
|
28
62
|
}
|
|
29
63
|
else if (modelName === "ChatAzureOpenAI") {
|
|
30
|
-
modelClass = (await
|
|
64
|
+
modelClass = (await Promise.resolve().then(() => __importStar(require("@langchain/openai")))).AzureChatOpenAI;
|
|
31
65
|
}
|
|
32
66
|
else if (modelName === "ChatVertexAI") {
|
|
33
|
-
modelClass = (await
|
|
67
|
+
modelClass = (await Promise.resolve().then(() => __importStar(require("@langchain/google-vertexai")))).ChatVertexAI;
|
|
34
68
|
}
|
|
35
69
|
else if (modelName === "ChatGoogleGenerativeAI") {
|
|
36
|
-
modelClass = (await
|
|
70
|
+
modelClass = (await Promise.resolve().then(() => __importStar(require("@langchain/google-genai"))))
|
|
37
71
|
.ChatGoogleGenerativeAI;
|
|
38
72
|
}
|
|
39
73
|
else if (modelName === "ChatBedrockConverse") {
|
|
40
|
-
modelClass = (await
|
|
74
|
+
modelClass = (await Promise.resolve().then(() => __importStar(require("@langchain/aws")))).ChatBedrockConverse;
|
|
41
75
|
}
|
|
42
76
|
else if (modelName === "ChatMistral") {
|
|
43
|
-
modelClass = (await
|
|
77
|
+
modelClass = (await Promise.resolve().then(() => __importStar(require("@langchain/mistralai")))).ChatMistralAI;
|
|
44
78
|
}
|
|
45
79
|
else if (modelName === "ChatGroq") {
|
|
46
|
-
modelClass = (await
|
|
80
|
+
modelClass = (await Promise.resolve().then(() => __importStar(require("@langchain/groq")))).ChatGroq;
|
|
47
81
|
}
|
|
48
82
|
else if (modelName !== undefined) {
|
|
49
83
|
console.warn(`Received unknown model name from prompt hub: "${modelName}"`);
|
|
@@ -53,4 +87,3 @@ async function pull(ownerRepoCommit, options) {
|
|
|
53
87
|
const loadedPrompt = await (0, index_js_1.load)(JSON.stringify(promptObject.manifest), undefined, (0, base_js_1.generateOptionalImportMap)(modelClass), (0, base_js_1.generateModelImportMap)(modelClass));
|
|
54
88
|
return loadedPrompt;
|
|
55
89
|
}
|
|
56
|
-
exports.pull = pull;
|
package/dist/index.cjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/index.js
CHANGED
package/dist/load/import_map.cjs
CHANGED
|
@@ -16,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
16
16
|
}) : function(o, v) {
|
|
17
17
|
o["default"] = v;
|
|
18
18
|
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
26
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
37
|
exports.util__math = exports.util__document = exports.storage__in_memory = exports.storage__encoder_backed = exports.stores__message__in_memory = exports.stores__file__in_memory = exports.stores__doc__in_memory = exports.stores__doc__base = exports.retrievers__matryoshka_retriever = exports.retrievers__score_threshold = exports.retrievers__hyde = exports.retrievers__document_compressors__embeddings_filter = exports.retrievers__document_compressors__chain_extract = exports.retrievers__time_weighted = exports.retrievers__parent_document = exports.retrievers__multi_vector = exports.retrievers__multi_query = exports.retrievers__ensemble = exports.retrievers__document_compressors = exports.retrievers__contextual_compression = exports.output_parsers = exports.callbacks = exports.document_transformers__openai_functions = exports.document_loaders__base = exports.memory__chat_memory = exports.memory = exports.text_splitter = exports.vectorstores__memory = exports.embeddings__fake = exports.embeddings__cache_backed = exports.chains__retrieval = exports.chains__openai_functions = exports.chains__history_aware_retriever = exports.chains__combine_documents__reduce = exports.chains__combine_documents = exports.chains = exports.tools__retriever = exports.tools__render = exports.tools__chain = exports.tools = exports.agents__openai__output_parser = exports.agents__xml__output_parser = exports.agents__react__output_parser = exports.agents__format_scratchpad__log_to_message = exports.agents__format_scratchpad__xml = exports.agents__format_scratchpad__log = exports.agents__format_scratchpad__openai_tools = exports.agents__format_scratchpad = exports.agents__toolkits = exports.agents = void 0;
|
|
28
38
|
exports.schema__output = exports.schema__output_parser = exports.schema__runnable = exports.prompts__base = exports.prompts__pipeline = exports.prompts__image = exports.prompts__chat = exports.schema = exports.schema__messages = exports.prompts__prompt = exports.embeddings__azure_openai = exports.embeddings__openai = exports.llms__azure_openai = exports.llms__openai = exports.chat_models__azure_openai = exports.chat_models__openai = exports.schema__prompt_template = exports.schema__query_constructor = exports.indexes = exports.runnables__remote = exports.smith = exports.evaluation = exports.experimental__prompts__custom_format = exports.experimental__masking = exports.experimental__chains__violation_of_expectations = exports.experimental__plan_and_execute = exports.experimental__generative_agents = exports.experimental__babyagi = exports.experimental__openai_files = exports.experimental__openai_assistant = exports.experimental__autogpt = exports.util__time = void 0;
|
package/dist/load/index.cjs
CHANGED
|
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.load =
|
|
36
|
+
exports.load = load;
|
|
27
37
|
const load_1 = require("@langchain/core/load");
|
|
28
38
|
const import_constants_js_1 = require("./import_constants.cjs");
|
|
29
39
|
const importMap = __importStar(require("./import_map.cjs"));
|
|
@@ -50,4 +60,3 @@ additionalImportsMap = {}) {
|
|
|
50
60
|
importMap: { ...importMap, ...additionalImportsMap },
|
|
51
61
|
});
|
|
52
62
|
}
|
|
53
|
-
exports.load = load;
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.ASTParser = exports.NodeHandler = void 0;
|
|
4
37
|
const parser_grammar_js_1 = require("./grammar/parser_grammar.cjs");
|
|
@@ -30,7 +63,7 @@ class ASTParser {
|
|
|
30
63
|
static async importASTParser() {
|
|
31
64
|
try {
|
|
32
65
|
if (!ASTParser.astParseInstance) {
|
|
33
|
-
const { default: peggy } = await
|
|
66
|
+
const { default: peggy } = await Promise.resolve().then(() => __importStar(require("peggy")));
|
|
34
67
|
const parser = peggy.generate(parser_grammar_js_1.GRAMMAR);
|
|
35
68
|
const { parse } = parser;
|
|
36
69
|
ASTParser.astParseInstance = parse;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonSchema7ObjectType } from "
|
|
1
|
+
import { type JsonSchema7ObjectType } from "@langchain/core/utils/json_schema";
|
|
2
2
|
import { type Operation as JSONPatchOperation } from "@langchain/core/utils/json_patch";
|
|
3
3
|
import { ChatGeneration, Generation } from "@langchain/core/outputs";
|
|
4
4
|
import { BaseCumulativeTransformOutputParser, type BaseCumulativeTransformOutputParserInput, BaseLLMOutputParser } from "@langchain/core/output_parsers";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type InferInteropZodOutput, type InteropZodType } from "@langchain/core/utils/types";
|
|
2
2
|
import { JsonMarkdownStructuredOutputParser } from "./structured.js";
|
|
3
3
|
/**
|
|
4
4
|
* Defines the input parameters for the RouterOutputParser class. It can
|
|
@@ -14,7 +14,7 @@ export type RouterOutputParserInput = {
|
|
|
14
14
|
* router in LangChain. The class takes a schema and an optional
|
|
15
15
|
* RouterOutputParserInput object as parameters.
|
|
16
16
|
*/
|
|
17
|
-
export declare class RouterOutputParser<Y extends
|
|
17
|
+
export declare class RouterOutputParser<Y extends InteropZodType> extends JsonMarkdownStructuredOutputParser<Y> {
|
|
18
18
|
defaultDestination: string;
|
|
19
19
|
constructor(schema: Y, options?: RouterOutputParserInput);
|
|
20
20
|
/**
|
|
@@ -26,5 +26,5 @@ export declare class RouterOutputParser<Y extends z.ZodTypeAny> extends JsonMark
|
|
|
26
26
|
* @param text The text to be parsed.
|
|
27
27
|
* @returns The parsed text as a Promise.
|
|
28
28
|
*/
|
|
29
|
-
parse(text: string): Promise<
|
|
29
|
+
parse(text: string): Promise<InferInteropZodOutput<Y>>;
|
|
30
30
|
}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AsymmetricStructuredOutputParser = exports.JsonMarkdownStructuredOutputParser = exports.StructuredOutputParser = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
5
|
+
const json_schema_1 = require("@langchain/core/utils/json_schema");
|
|
6
6
|
const output_parsers_1 = require("@langchain/core/output_parsers");
|
|
7
|
+
const types_1 = require("@langchain/core/utils/types");
|
|
7
8
|
class StructuredOutputParser extends output_parsers_1.BaseOutputParser {
|
|
8
9
|
static lc_name() {
|
|
9
10
|
return "StructuredOutputParser";
|
|
@@ -63,7 +64,7 @@ Your output will be parsed and type-checked according to the provided schema ins
|
|
|
63
64
|
|
|
64
65
|
Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock:
|
|
65
66
|
\`\`\`json
|
|
66
|
-
${JSON.stringify((0,
|
|
67
|
+
${JSON.stringify((0, json_schema_1.toJsonSchema)(this.schema))}
|
|
67
68
|
\`\`\`
|
|
68
69
|
`;
|
|
69
70
|
}
|
|
@@ -77,11 +78,11 @@ ${JSON.stringify((0, zod_to_json_schema_1.zodToJsonSchema)(this.schema))}
|
|
|
77
78
|
const json = text.includes("```")
|
|
78
79
|
? text.trim().split(/```(?:json)?/)[1]
|
|
79
80
|
: text.trim();
|
|
80
|
-
return await this.schema
|
|
81
|
+
return await (0, types_1.interopParseAsync)(this.schema, JSON.parse(json));
|
|
81
82
|
}
|
|
82
83
|
catch (e) {
|
|
83
84
|
try {
|
|
84
|
-
return await this.schema
|
|
85
|
+
return await (0, types_1.interopParseAsync)(this.schema, JSON.parse(text.trim()));
|
|
85
86
|
}
|
|
86
87
|
catch (e2) {
|
|
87
88
|
throw new output_parsers_1.OutputParserException(`Failed to parse. Text: "${text}". Error: ${e2}`, text);
|
|
@@ -103,7 +104,7 @@ class JsonMarkdownStructuredOutputParser extends StructuredOutputParser {
|
|
|
103
104
|
if (interpolationDepth < 1) {
|
|
104
105
|
throw new Error("f string interpolation depth must be at least 1");
|
|
105
106
|
}
|
|
106
|
-
return `Return a markdown code snippet with a JSON object formatted to look like:\n\`\`\`json\n${this._schemaToInstruction((0,
|
|
107
|
+
return `Return a markdown code snippet with a JSON object formatted to look like:\n\`\`\`json\n${this._schemaToInstruction((0, json_schema_1.toJsonSchema)(this.schema))
|
|
107
108
|
.replaceAll("{", "{".repeat(interpolationDepth))
|
|
108
109
|
.replaceAll("}", "}".repeat(interpolationDepth))}\n\`\`\``;
|
|
109
110
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { BaseOutputParser, FormatInstructionsOptions } from "@langchain/core/output_parsers";
|
|
3
|
+
import { type InferInteropZodOutput, type InteropZodType } from "@langchain/core/utils/types";
|
|
3
4
|
export type JsonMarkdownStructuredOutputParserInput = {
|
|
4
5
|
interpolationDepth?: number;
|
|
5
6
|
};
|
|
6
7
|
export interface JsonMarkdownFormatInstructionsOptions extends FormatInstructionsOptions {
|
|
7
8
|
interpolationDepth?: number;
|
|
8
9
|
}
|
|
9
|
-
export declare class StructuredOutputParser<T extends
|
|
10
|
+
export declare class StructuredOutputParser<T extends InteropZodType> extends BaseOutputParser<InferInteropZodOutput<T>> {
|
|
10
11
|
schema: T;
|
|
11
12
|
static lc_name(): string;
|
|
12
13
|
lc_namespace: string[];
|
|
@@ -17,7 +18,7 @@ export declare class StructuredOutputParser<T extends z.ZodTypeAny> extends Base
|
|
|
17
18
|
* @param schema The Zod schema which the output should match
|
|
18
19
|
* @returns A new instance of StructuredOutputParser.
|
|
19
20
|
*/
|
|
20
|
-
static fromZodSchema<T extends
|
|
21
|
+
static fromZodSchema<T extends InteropZodType>(schema: T): StructuredOutputParser<T>;
|
|
21
22
|
/**
|
|
22
23
|
* Creates a new StructuredOutputParser from a set of names and
|
|
23
24
|
* descriptions.
|
|
@@ -45,17 +46,17 @@ export declare class StructuredOutputParser<T extends z.ZodTypeAny> extends Base
|
|
|
45
46
|
* @param text The text to parse
|
|
46
47
|
* @returns The parsed output.
|
|
47
48
|
*/
|
|
48
|
-
parse(text: string): Promise<
|
|
49
|
+
parse(text: string): Promise<InferInteropZodOutput<T>>;
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
51
52
|
* A specific type of `StructuredOutputParser` that parses JSON data
|
|
52
53
|
* formatted as a markdown code snippet.
|
|
53
54
|
*/
|
|
54
|
-
export declare class JsonMarkdownStructuredOutputParser<T extends
|
|
55
|
+
export declare class JsonMarkdownStructuredOutputParser<T extends InteropZodType> extends StructuredOutputParser<T> {
|
|
55
56
|
static lc_name(): string;
|
|
56
57
|
getFormatInstructions(options?: JsonMarkdownFormatInstructionsOptions): string;
|
|
57
58
|
private _schemaToInstruction;
|
|
58
|
-
static fromZodSchema<T extends
|
|
59
|
+
static fromZodSchema<T extends InteropZodType>(schema: T): JsonMarkdownStructuredOutputParser<T>;
|
|
59
60
|
static fromNamesAndDescriptions<S extends {
|
|
60
61
|
[key: string]: string;
|
|
61
62
|
}>(schemas: S): JsonMarkdownStructuredOutputParser<z.ZodObject<{
|
|
@@ -66,14 +67,14 @@ export declare class JsonMarkdownStructuredOutputParser<T extends z.ZodTypeAny>
|
|
|
66
67
|
[x: string]: string;
|
|
67
68
|
}>>;
|
|
68
69
|
}
|
|
69
|
-
export interface AsymmetricStructuredOutputParserFields<T extends
|
|
70
|
+
export interface AsymmetricStructuredOutputParserFields<T extends InteropZodType> {
|
|
70
71
|
inputSchema: T;
|
|
71
72
|
}
|
|
72
73
|
/**
|
|
73
74
|
* A type of `StructuredOutputParser` that handles asymmetric input and
|
|
74
75
|
* output schemas.
|
|
75
76
|
*/
|
|
76
|
-
export declare abstract class AsymmetricStructuredOutputParser<T extends
|
|
77
|
+
export declare abstract class AsymmetricStructuredOutputParser<T extends InteropZodType, Y = unknown> extends BaseOutputParser<Y> {
|
|
77
78
|
private structuredInputParser;
|
|
78
79
|
constructor({ inputSchema }: AsymmetricStructuredOutputParserFields<T>);
|
|
79
80
|
/**
|
|
@@ -82,7 +83,7 @@ export declare abstract class AsymmetricStructuredOutputParser<T extends z.ZodTy
|
|
|
82
83
|
* @param input The parsed input
|
|
83
84
|
* @returns The processed output.
|
|
84
85
|
*/
|
|
85
|
-
abstract outputProcessor(input:
|
|
86
|
+
abstract outputProcessor(input: InferInteropZodOutput<T>): Promise<Y>;
|
|
86
87
|
parse(text: string): Promise<Y>;
|
|
87
88
|
getFormatInstructions(): string;
|
|
88
89
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { toJsonSchema, } from "@langchain/core/utils/json_schema";
|
|
3
3
|
import { BaseOutputParser, OutputParserException, } from "@langchain/core/output_parsers";
|
|
4
|
+
import { interopParseAsync, } from "@langchain/core/utils/types";
|
|
4
5
|
export class StructuredOutputParser extends BaseOutputParser {
|
|
5
6
|
static lc_name() {
|
|
6
7
|
return "StructuredOutputParser";
|
|
@@ -60,7 +61,7 @@ Your output will be parsed and type-checked according to the provided schema ins
|
|
|
60
61
|
|
|
61
62
|
Here is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock:
|
|
62
63
|
\`\`\`json
|
|
63
|
-
${JSON.stringify(
|
|
64
|
+
${JSON.stringify(toJsonSchema(this.schema))}
|
|
64
65
|
\`\`\`
|
|
65
66
|
`;
|
|
66
67
|
}
|
|
@@ -74,11 +75,11 @@ ${JSON.stringify(zodToJsonSchema(this.schema))}
|
|
|
74
75
|
const json = text.includes("```")
|
|
75
76
|
? text.trim().split(/```(?:json)?/)[1]
|
|
76
77
|
: text.trim();
|
|
77
|
-
return await this.schema
|
|
78
|
+
return await interopParseAsync(this.schema, JSON.parse(json));
|
|
78
79
|
}
|
|
79
80
|
catch (e) {
|
|
80
81
|
try {
|
|
81
|
-
return await this.schema
|
|
82
|
+
return await interopParseAsync(this.schema, JSON.parse(text.trim()));
|
|
82
83
|
}
|
|
83
84
|
catch (e2) {
|
|
84
85
|
throw new OutputParserException(`Failed to parse. Text: "${text}". Error: ${e2}`, text);
|
|
@@ -99,7 +100,7 @@ export class JsonMarkdownStructuredOutputParser extends StructuredOutputParser {
|
|
|
99
100
|
if (interpolationDepth < 1) {
|
|
100
101
|
throw new Error("f string interpolation depth must be at least 1");
|
|
101
102
|
}
|
|
102
|
-
return `Return a markdown code snippet with a JSON object formatted to look like:\n\`\`\`json\n${this._schemaToInstruction(
|
|
103
|
+
return `Return a markdown code snippet with a JSON object formatted to look like:\n\`\`\`json\n${this._schemaToInstruction(toJsonSchema(this.schema))
|
|
103
104
|
.replaceAll("{", "{".repeat(interpolationDepth))
|
|
104
105
|
.replaceAll("}", "}".repeat(interpolationDepth))}\n\`\`\``;
|
|
105
106
|
}
|
package/dist/prompts/index.cjs
CHANGED
package/dist/prompts/index.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/prompts/index.js
CHANGED
package/dist/retrievers/hyde.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.HydeRetriever = void 0;
|
|
4
|
+
exports.getPromptTemplateFromKey = getPromptTemplateFromKey;
|
|
4
5
|
const prompts_1 = require("@langchain/core/prompts");
|
|
5
6
|
const prompt_values_1 = require("@langchain/core/prompt_values");
|
|
6
7
|
const vectorstores_1 = require("@langchain/core/vectorstores");
|
|
@@ -128,4 +129,3 @@ Passage:`;
|
|
|
128
129
|
}
|
|
129
130
|
return prompts_1.PromptTemplate.fromTemplate(template);
|
|
130
131
|
}
|
|
131
|
-
exports.getPromptTemplateFromKey = getPromptTemplateFromKey;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.ParentDocumentRetriever = void 0;
|
|
27
37
|
const uuid = __importStar(require("uuid"));
|