langchain 0.0.196 → 0.0.197-rc.1
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/LICENSE +21 -0
- package/dist/agents/executor.cjs +351 -1
- package/dist/agents/executor.d.ts +61 -3
- package/dist/agents/executor.js +350 -1
- package/dist/agents/openai/index.cjs +6 -2
- package/dist/agents/openai/index.js +6 -2
- package/dist/agents/toolkits/conversational_retrieval/token_buffer_memory.d.ts +1 -1
- package/dist/base_language/count_tokens.cjs +4 -4
- package/dist/base_language/count_tokens.d.ts +1 -1
- package/dist/base_language/count_tokens.js +1 -1
- package/dist/base_language/index.cjs +3 -3
- package/dist/base_language/index.d.ts +1 -1
- package/dist/base_language/index.js +1 -1
- package/dist/cache/base.cjs +1 -1
- package/dist/cache/base.d.ts +1 -1
- package/dist/cache/base.js +1 -1
- package/dist/cache/index.cjs +2 -2
- package/dist/cache/index.d.ts +1 -1
- package/dist/cache/index.js +1 -1
- package/dist/callbacks/base.cjs +1 -1
- package/dist/callbacks/base.d.ts +1 -1
- package/dist/callbacks/base.js +1 -1
- package/dist/callbacks/handlers/console.cjs +1 -1
- package/dist/callbacks/handlers/console.d.ts +1 -1
- package/dist/callbacks/handlers/console.js +1 -1
- package/dist/callbacks/handlers/initialize.cjs +1 -1
- package/dist/callbacks/handlers/initialize.d.ts +1 -1
- package/dist/callbacks/handlers/initialize.js +1 -1
- package/dist/callbacks/handlers/log_stream.cjs +1 -1
- package/dist/callbacks/handlers/log_stream.d.ts +1 -1
- package/dist/callbacks/handlers/log_stream.js +1 -1
- package/dist/callbacks/handlers/run_collector.cjs +1 -1
- package/dist/callbacks/handlers/run_collector.d.ts +1 -1
- package/dist/callbacks/handlers/run_collector.js +1 -1
- package/dist/callbacks/handlers/tracer.cjs +1 -1
- package/dist/callbacks/handlers/tracer.d.ts +1 -1
- package/dist/callbacks/handlers/tracer.js +1 -1
- package/dist/callbacks/handlers/tracer_langchain.cjs +1 -1
- package/dist/callbacks/handlers/tracer_langchain.d.ts +1 -1
- package/dist/callbacks/handlers/tracer_langchain.js +1 -1
- package/dist/callbacks/handlers/tracer_langchain_v1.cjs +1 -1
- package/dist/callbacks/handlers/tracer_langchain_v1.d.ts +1 -1
- package/dist/callbacks/handlers/tracer_langchain_v1.js +1 -1
- package/dist/callbacks/manager.cjs +1 -1
- package/dist/callbacks/manager.d.ts +1 -1
- package/dist/callbacks/manager.js +1 -1
- package/dist/callbacks/promises.cjs +1 -1
- package/dist/callbacks/promises.d.ts +1 -1
- package/dist/callbacks/promises.js +1 -1
- package/dist/chains/base.cjs +16 -0
- package/dist/chains/base.d.ts +2 -0
- package/dist/chains/base.js +16 -0
- package/dist/chains/openai_functions/structured_output.cjs +1 -1
- package/dist/chains/openai_functions/structured_output.d.ts +1 -1
- package/dist/chains/openai_functions/structured_output.js +1 -1
- package/dist/chains/openai_moderation.cjs +2 -2
- package/dist/chains/openai_moderation.d.ts +1 -1
- package/dist/chains/openai_moderation.js +1 -1
- package/dist/chat_models/anthropic.cjs +15 -348
- package/dist/chat_models/anthropic.d.ts +1 -156
- package/dist/chat_models/anthropic.js +1 -346
- package/dist/chat_models/base.cjs +1 -1
- package/dist/chat_models/base.d.ts +1 -1
- package/dist/chat_models/base.js +1 -1
- package/dist/chat_models/bedrock/web.cjs +21 -1
- package/dist/chat_models/bedrock/web.d.ts +1 -1
- package/dist/chat_models/bedrock/web.js +21 -1
- package/dist/chat_models/fireworks.d.ts +2 -2
- package/dist/chat_models/iflytek_xinghuo/common.d.ts +1 -1
- package/dist/chat_models/minimax.d.ts +2 -2
- package/dist/chat_models/openai.cjs +4 -698
- package/dist/chat_models/openai.d.ts +4 -137
- package/dist/chat_models/openai.js +2 -695
- package/dist/document.cjs +2 -2
- package/dist/document.d.ts +1 -1
- package/dist/document.js +1 -1
- package/dist/document_loaders/fs/openai_whisper_audio.cjs +2 -2
- package/dist/document_loaders/fs/openai_whisper_audio.d.ts +1 -1
- package/dist/document_loaders/fs/openai_whisper_audio.js +1 -1
- package/dist/document_loaders/web/azure_blob_storage_file.d.ts +1 -1
- package/dist/document_loaders/web/github.cjs +105 -0
- package/dist/document_loaders/web/github.d.ts +26 -0
- package/dist/document_loaders/web/github.js +105 -0
- package/dist/document_loaders/web/s3.d.ts +1 -1
- package/dist/embeddings/base.cjs +1 -1
- package/dist/embeddings/base.d.ts +1 -1
- package/dist/embeddings/base.js +1 -1
- package/dist/embeddings/cache_backed.cjs +1 -1
- package/dist/embeddings/cache_backed.js +1 -1
- package/dist/embeddings/openai.cjs +2 -240
- package/dist/embeddings/openai.d.ts +1 -82
- package/dist/embeddings/openai.js +1 -239
- package/dist/experimental/openai_assistant/index.cjs +3 -3
- package/dist/experimental/openai_assistant/index.d.ts +1 -1
- package/dist/experimental/openai_assistant/index.js +1 -1
- package/dist/experimental/openai_assistant/schema.d.ts +1 -1
- package/dist/experimental/openai_files/index.cjs +2 -2
- package/dist/experimental/openai_files/index.d.ts +1 -1
- package/dist/experimental/openai_files/index.js +1 -1
- package/dist/experimental/plan_and_execute/prompt.d.ts +1 -1
- package/dist/llms/base.cjs +1 -1
- package/dist/llms/base.d.ts +1 -1
- package/dist/llms/base.js +1 -1
- package/dist/llms/bedrock/web.cjs +21 -1
- package/dist/llms/bedrock/web.d.ts +1 -1
- package/dist/llms/bedrock/web.js +21 -1
- package/dist/llms/fireworks.d.ts +2 -2
- package/dist/llms/openai-chat.cjs +3 -445
- package/dist/llms/openai-chat.d.ts +4 -123
- package/dist/llms/openai-chat.js +2 -443
- package/dist/llms/openai.cjs +6 -530
- package/dist/llms/openai.d.ts +4 -123
- package/dist/llms/openai.js +2 -525
- package/dist/load/index.cjs +4 -2
- package/dist/load/index.d.ts +2 -2
- package/dist/load/index.js +4 -2
- package/dist/load/serializable.cjs +1 -1
- package/dist/load/serializable.d.ts +1 -1
- package/dist/load/serializable.js +1 -1
- package/dist/memory/base.cjs +2 -2
- package/dist/memory/base.d.ts +2 -2
- package/dist/memory/base.js +2 -2
- package/dist/output_parsers/list.cjs +4 -122
- package/dist/output_parsers/list.d.ts +1 -57
- package/dist/output_parsers/list.js +1 -119
- package/dist/output_parsers/openai_functions.cjs +1 -1
- package/dist/output_parsers/openai_functions.d.ts +1 -1
- package/dist/output_parsers/openai_functions.js +1 -1
- package/dist/output_parsers/structured.d.ts +1 -1
- package/dist/prompts/base.cjs +8 -8
- package/dist/prompts/base.d.ts +3 -3
- package/dist/prompts/base.js +3 -3
- package/dist/prompts/chat.cjs +13 -15
- package/dist/prompts/chat.d.ts +2 -1
- package/dist/prompts/chat.js +2 -1
- package/dist/prompts/few_shot.cjs +4 -15
- package/dist/prompts/few_shot.d.ts +1 -1
- package/dist/prompts/few_shot.js +1 -1
- package/dist/prompts/index.cjs +2 -2
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.js +1 -1
- package/dist/prompts/pipeline.cjs +3 -15
- package/dist/prompts/pipeline.d.ts +1 -1
- package/dist/prompts/pipeline.js +1 -1
- package/dist/prompts/prompt.cjs +3 -15
- package/dist/prompts/prompt.d.ts +1 -1
- package/dist/prompts/prompt.js +1 -1
- package/dist/prompts/selectors/LengthBasedExampleSelector.cjs +3 -15
- package/dist/prompts/selectors/LengthBasedExampleSelector.d.ts +1 -1
- package/dist/prompts/selectors/LengthBasedExampleSelector.js +1 -1
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.cjs +1 -1
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.d.ts +1 -1
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.js +1 -1
- package/dist/prompts/selectors/conditional.cjs +6 -15
- package/dist/prompts/selectors/conditional.d.ts +1 -1
- package/dist/prompts/selectors/conditional.js +1 -1
- package/dist/prompts/serde.cjs +0 -15
- package/dist/prompts/serde.d.ts +1 -1
- package/dist/prompts/serde.js +1 -1
- package/dist/prompts/template.cjs +9 -15
- package/dist/prompts/template.d.ts +1 -1
- package/dist/prompts/template.js +1 -1
- package/dist/runnables/index.cjs +1 -1
- package/dist/runnables/index.d.ts +1 -1
- package/dist/runnables/index.js +1 -1
- package/dist/schema/document.cjs +3 -3
- package/dist/schema/document.d.ts +1 -1
- package/dist/schema/document.js +1 -1
- package/dist/schema/index.cjs +12 -12
- package/dist/schema/index.d.ts +11 -11
- package/dist/schema/index.js +7 -7
- package/dist/schema/output_parser.cjs +1 -1
- package/dist/schema/output_parser.d.ts +1 -1
- package/dist/schema/output_parser.js +1 -1
- package/dist/schema/retriever.cjs +1 -1
- package/dist/schema/retriever.d.ts +1 -1
- package/dist/schema/retriever.js +1 -1
- package/dist/schema/runnable/base.cjs +1 -1
- package/dist/schema/runnable/base.d.ts +1 -1
- package/dist/schema/runnable/base.js +1 -1
- package/dist/schema/runnable/branch.cjs +1 -1
- package/dist/schema/runnable/branch.d.ts +1 -1
- package/dist/schema/runnable/branch.js +1 -1
- package/dist/schema/runnable/config.d.ts +1 -1
- package/dist/schema/runnable/index.cjs +1 -1
- package/dist/schema/runnable/index.d.ts +1 -1
- package/dist/schema/runnable/index.js +1 -1
- package/dist/schema/runnable/passthrough.cjs +1 -1
- package/dist/schema/runnable/passthrough.d.ts +1 -1
- package/dist/schema/runnable/passthrough.js +1 -1
- package/dist/schema/runnable/router.cjs +1 -1
- package/dist/schema/runnable/router.d.ts +1 -1
- package/dist/schema/runnable/router.js +1 -1
- package/dist/schema/storage.cjs +1 -1
- package/dist/schema/storage.d.ts +1 -1
- package/dist/schema/storage.js +1 -1
- package/dist/tools/base.cjs +4 -108
- package/dist/tools/base.d.ts +1 -72
- package/dist/tools/base.js +1 -105
- package/dist/tools/bingserpapi.d.ts +1 -1
- package/dist/tools/convert_to_openai.cjs +4 -38
- package/dist/tools/convert_to_openai.d.ts +1 -11
- package/dist/tools/convert_to_openai.js +1 -35
- package/dist/tools/searchapi.d.ts +1 -1
- package/dist/tools/serpapi.d.ts +1 -1
- package/dist/tools/serper.d.ts +1 -1
- package/dist/types/openai-types.d.ts +1 -133
- package/dist/util/async_caller.cjs +1 -1
- package/dist/util/async_caller.d.ts +1 -1
- package/dist/util/async_caller.js +1 -1
- package/dist/util/openai.cjs +2 -18
- package/dist/util/openai.d.ts +1 -1
- package/dist/util/openai.js +1 -17
- package/dist/util/openapi.d.ts +2 -2
- package/dist/util/prompt-layer.d.ts +1 -1
- package/dist/vectorstores/momento_vector_index.cjs +39 -0
- package/dist/vectorstores/momento_vector_index.d.ts +17 -1
- package/dist/vectorstores/momento_vector_index.js +40 -1
- package/dist/vectorstores/mongodb_atlas.cjs +22 -2
- package/dist/vectorstores/mongodb_atlas.d.ts +13 -0
- package/dist/vectorstores/mongodb_atlas.js +22 -2
- package/package.json +12 -10
- package/dist/util/openai-format-fndef.cjs +0 -81
- package/dist/util/openai-format-fndef.d.ts +0 -44
- package/dist/util/openai-format-fndef.js +0 -77
package/dist/prompts/serde.cjs
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("langchain-core/prompts/serde"), exports);
|
package/dist/prompts/serde.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { type SerializedPromptTemplate, type SerializedFewShotTemplate, type SerializedBasePromptTemplate, } from "@langchain/core/prompts";
|
package/dist/prompts/serde.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
@@ -1,17 +1,11 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
3
|
+
exports.checkValidTemplate = exports.parseTemplate = exports.renderTemplate = exports.DEFAULT_PARSER_MAPPING = exports.DEFAULT_FORMATTER_MAPPING = exports.interpolateFString = exports.parseFString = void 0;
|
|
4
|
+
var prompts_1 = require("@langchain/core/prompts");
|
|
5
|
+
Object.defineProperty(exports, "parseFString", { enumerable: true, get: function () { return prompts_1.parseFString; } });
|
|
6
|
+
Object.defineProperty(exports, "interpolateFString", { enumerable: true, get: function () { return prompts_1.interpolateFString; } });
|
|
7
|
+
Object.defineProperty(exports, "DEFAULT_FORMATTER_MAPPING", { enumerable: true, get: function () { return prompts_1.DEFAULT_FORMATTER_MAPPING; } });
|
|
8
|
+
Object.defineProperty(exports, "DEFAULT_PARSER_MAPPING", { enumerable: true, get: function () { return prompts_1.DEFAULT_PARSER_MAPPING; } });
|
|
9
|
+
Object.defineProperty(exports, "renderTemplate", { enumerable: true, get: function () { return prompts_1.renderTemplate; } });
|
|
10
|
+
Object.defineProperty(exports, "parseTemplate", { enumerable: true, get: function () { return prompts_1.parseTemplate; } });
|
|
11
|
+
Object.defineProperty(exports, "checkValidTemplate", { enumerable: true, get: function () { return prompts_1.checkValidTemplate; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { type TemplateFormat, parseFString, interpolateFString, DEFAULT_FORMATTER_MAPPING, DEFAULT_PARSER_MAPPING, renderTemplate, parseTemplate, checkValidTemplate, } from "@langchain/core/prompts";
|
package/dist/prompts/template.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { parseFString, interpolateFString, DEFAULT_FORMATTER_MAPPING, DEFAULT_PARSER_MAPPING, renderTemplate, parseTemplate, checkValidTemplate, } from "@langchain/core/prompts";
|
package/dist/runnables/index.cjs
CHANGED
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("langchain
|
|
17
|
+
__exportStar(require("@langchain/core/runnables"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain
|
|
1
|
+
export * from "@langchain/core/runnables";
|
package/dist/runnables/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain
|
|
1
|
+
export * from "@langchain/core/runnables";
|
package/dist/schema/document.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MappingDocumentTransformer = exports.BaseDocumentTransformer = void 0;
|
|
4
|
-
const
|
|
5
|
-
Object.defineProperty(exports, "BaseDocumentTransformer", { enumerable: true, get: function () { return
|
|
4
|
+
const documents_1 = require("@langchain/core/documents");
|
|
5
|
+
Object.defineProperty(exports, "BaseDocumentTransformer", { enumerable: true, get: function () { return documents_1.BaseDocumentTransformer; } });
|
|
6
6
|
/**
|
|
7
7
|
* Class for document transformers that return exactly one transformed document
|
|
8
8
|
* for each input document.
|
|
9
9
|
*/
|
|
10
|
-
class MappingDocumentTransformer extends
|
|
10
|
+
class MappingDocumentTransformer extends documents_1.BaseDocumentTransformer {
|
|
11
11
|
async transformDocuments(documents) {
|
|
12
12
|
const newDocuments = [];
|
|
13
13
|
for (const document of documents) {
|
package/dist/schema/document.js
CHANGED
package/dist/schema/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Docstore = exports.BaseEntityStore = exports.BaseFileStore = exports.BaseCache = exports.BaseListChatMessageHistory = exports.BaseChatMessageHistory = exports.BasePromptValue = exports.ChatGenerationChunk = exports.GenerationChunk = exports.SystemChatMessage = exports.AIChatMessage = exports.HumanChatMessage = exports.BaseChatMessage = exports.SystemMessage = exports.AIMessage = exports.HumanMessage = exports.BaseMessage = exports.isBaseMessageChunk = exports.isBaseMessage = exports.coerceMessageLikeToMessage = exports.ChatMessageChunk = exports.mapStoredMessageToChatMessage = exports.ChatMessage = exports.ToolMessageChunk = exports.ToolMessage = exports.FunctionMessageChunk = exports.FunctionMessage = exports.SystemMessageChunk = exports.AIMessageChunk = exports.HumanMessageChunk = exports.BaseMessageChunk = exports.RUN_KEY = void 0;
|
|
4
|
-
const messages_1 = require("langchain
|
|
4
|
+
const messages_1 = require("@langchain/core/messages");
|
|
5
5
|
Object.defineProperty(exports, "BaseMessage", { enumerable: true, get: function () { return messages_1.BaseMessage; } });
|
|
6
6
|
Object.defineProperty(exports, "HumanMessage", { enumerable: true, get: function () { return messages_1.HumanMessage; } });
|
|
7
7
|
Object.defineProperty(exports, "AIMessage", { enumerable: true, get: function () { return messages_1.AIMessage; } });
|
|
8
8
|
Object.defineProperty(exports, "SystemMessage", { enumerable: true, get: function () { return messages_1.SystemMessage; } });
|
|
9
9
|
const serializable_js_1 = require("../load/serializable.cjs");
|
|
10
|
-
var
|
|
11
|
-
Object.defineProperty(exports, "RUN_KEY", { enumerable: true, get: function () { return
|
|
12
|
-
var messages_2 = require("langchain
|
|
10
|
+
var outputs_1 = require("@langchain/core/outputs");
|
|
11
|
+
Object.defineProperty(exports, "RUN_KEY", { enumerable: true, get: function () { return outputs_1.RUN_KEY; } });
|
|
12
|
+
var messages_2 = require("@langchain/core/messages");
|
|
13
13
|
Object.defineProperty(exports, "BaseMessageChunk", { enumerable: true, get: function () { return messages_2.BaseMessageChunk; } });
|
|
14
14
|
Object.defineProperty(exports, "HumanMessageChunk", { enumerable: true, get: function () { return messages_2.HumanMessageChunk; } });
|
|
15
15
|
Object.defineProperty(exports, "AIMessageChunk", { enumerable: true, get: function () { return messages_2.AIMessageChunk; } });
|
|
@@ -44,16 +44,16 @@ exports.AIChatMessage = messages_1.AIMessage;
|
|
|
44
44
|
* Use {@link SystemMessage} instead.
|
|
45
45
|
*/
|
|
46
46
|
exports.SystemChatMessage = messages_1.SystemMessage;
|
|
47
|
-
var
|
|
48
|
-
Object.defineProperty(exports, "GenerationChunk", { enumerable: true, get: function () { return
|
|
49
|
-
Object.defineProperty(exports, "ChatGenerationChunk", { enumerable: true, get: function () { return
|
|
50
|
-
var
|
|
51
|
-
Object.defineProperty(exports, "BasePromptValue", { enumerable: true, get: function () { return
|
|
52
|
-
var chat_history_1 = require("langchain
|
|
47
|
+
var outputs_2 = require("@langchain/core/outputs");
|
|
48
|
+
Object.defineProperty(exports, "GenerationChunk", { enumerable: true, get: function () { return outputs_2.GenerationChunk; } });
|
|
49
|
+
Object.defineProperty(exports, "ChatGenerationChunk", { enumerable: true, get: function () { return outputs_2.ChatGenerationChunk; } });
|
|
50
|
+
var prompt_values_1 = require("@langchain/core/prompt_values");
|
|
51
|
+
Object.defineProperty(exports, "BasePromptValue", { enumerable: true, get: function () { return prompt_values_1.BasePromptValue; } });
|
|
52
|
+
var chat_history_1 = require("@langchain/core/chat_history");
|
|
53
53
|
Object.defineProperty(exports, "BaseChatMessageHistory", { enumerable: true, get: function () { return chat_history_1.BaseChatMessageHistory; } });
|
|
54
54
|
Object.defineProperty(exports, "BaseListChatMessageHistory", { enumerable: true, get: function () { return chat_history_1.BaseListChatMessageHistory; } });
|
|
55
|
-
var
|
|
56
|
-
Object.defineProperty(exports, "BaseCache", { enumerable: true, get: function () { return
|
|
55
|
+
var caches_1 = require("@langchain/core/caches");
|
|
56
|
+
Object.defineProperty(exports, "BaseCache", { enumerable: true, get: function () { return caches_1.BaseCache; } });
|
|
57
57
|
/**
|
|
58
58
|
* Base class for all file stores. All file stores should extend this
|
|
59
59
|
* class.
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { BaseMessage, HumanMessage, AIMessage, SystemMessage } from "langchain
|
|
1
|
+
import type { OpenAIClient } from "@langchain/openai";
|
|
2
|
+
import { BaseMessage, HumanMessage, AIMessage, SystemMessage } from "@langchain/core/messages";
|
|
3
3
|
import { Document } from "../document.js";
|
|
4
4
|
import { Serializable } from "../load/serializable.js";
|
|
5
|
-
export { type AgentAction, type AgentFinish, type AgentStep, } from "langchain
|
|
6
|
-
export { RUN_KEY } from "langchain
|
|
7
|
-
export { type Example } from "langchain
|
|
5
|
+
export { type AgentAction, type AgentFinish, type AgentStep, } from "@langchain/core/agents";
|
|
6
|
+
export { RUN_KEY } from "@langchain/core/outputs";
|
|
7
|
+
export { type Example } from "@langchain/core/prompts";
|
|
8
8
|
export type OpenAIToolCall = OpenAIClient.ChatCompletionMessageToolCall & {
|
|
9
9
|
index: number;
|
|
10
10
|
};
|
|
11
|
-
export { type StoredMessageData, type StoredMessage, type StoredGeneration, type MessageType, type MessageContent, type BaseMessageFields, type ChatMessageFieldsWithRole, type FunctionMessageFieldsWithName, type ToolMessageFieldsWithToolCallId, BaseMessageChunk, HumanMessageChunk, AIMessageChunk, SystemMessageChunk, FunctionMessage, FunctionMessageChunk, ToolMessage, ToolMessageChunk, ChatMessage, type BaseMessageLike, mapStoredMessageToChatMessage, ChatMessageChunk, coerceMessageLikeToMessage, isBaseMessage, isBaseMessageChunk, } from "langchain
|
|
11
|
+
export { type StoredMessageData, type StoredMessage, type StoredGeneration, type MessageType, type MessageContent, type BaseMessageFields, type ChatMessageFieldsWithRole, type FunctionMessageFieldsWithName, type ToolMessageFieldsWithToolCallId, BaseMessageChunk, HumanMessageChunk, AIMessageChunk, SystemMessageChunk, FunctionMessage, FunctionMessageChunk, ToolMessage, ToolMessageChunk, ChatMessage, type BaseMessageLike, mapStoredMessageToChatMessage, ChatMessageChunk, coerceMessageLikeToMessage, isBaseMessage, isBaseMessageChunk, } from "@langchain/core/messages";
|
|
12
12
|
export { BaseMessage, HumanMessage, AIMessage, SystemMessage };
|
|
13
13
|
/**
|
|
14
14
|
* @deprecated
|
|
@@ -30,11 +30,11 @@ export declare const AIChatMessage: typeof AIMessage;
|
|
|
30
30
|
* Use {@link SystemMessage} instead.
|
|
31
31
|
*/
|
|
32
32
|
export declare const SystemChatMessage: typeof SystemMessage;
|
|
33
|
-
export { type Generation, type GenerationChunkFields, GenerationChunk, type ChatResult, type ChatGeneration, ChatGenerationChunk, type LLMResult, } from "langchain
|
|
34
|
-
export { BasePromptValue } from "langchain
|
|
35
|
-
export { type InputValues, type PartialValues, type ChainValues, } from "langchain
|
|
36
|
-
export { BaseChatMessageHistory, BaseListChatMessageHistory, } from "langchain
|
|
37
|
-
export { BaseCache } from "langchain
|
|
33
|
+
export { type Generation, type GenerationChunkFields, GenerationChunk, type ChatResult, type ChatGeneration, ChatGenerationChunk, type LLMResult, } from "@langchain/core/outputs";
|
|
34
|
+
export { BasePromptValue } from "@langchain/core/prompt_values";
|
|
35
|
+
export { type InputValues, type PartialValues, type ChainValues, } from "@langchain/core/utils/types";
|
|
36
|
+
export { BaseChatMessageHistory, BaseListChatMessageHistory, } from "@langchain/core/chat_history";
|
|
37
|
+
export { BaseCache } from "@langchain/core/caches";
|
|
38
38
|
/**
|
|
39
39
|
* Base class for all file stores. All file stores should extend this
|
|
40
40
|
* class.
|
package/dist/schema/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BaseMessage, HumanMessage, AIMessage, SystemMessage, } from "langchain
|
|
1
|
+
import { BaseMessage, HumanMessage, AIMessage, SystemMessage, } from "@langchain/core/messages";
|
|
2
2
|
import { Serializable } from "../load/serializable.js";
|
|
3
|
-
export { RUN_KEY } from "langchain
|
|
4
|
-
export { BaseMessageChunk, HumanMessageChunk, AIMessageChunk, SystemMessageChunk, FunctionMessage, FunctionMessageChunk, ToolMessage, ToolMessageChunk, ChatMessage, mapStoredMessageToChatMessage, ChatMessageChunk, coerceMessageLikeToMessage, isBaseMessage, isBaseMessageChunk, } from "langchain
|
|
3
|
+
export { RUN_KEY } from "@langchain/core/outputs";
|
|
4
|
+
export { BaseMessageChunk, HumanMessageChunk, AIMessageChunk, SystemMessageChunk, FunctionMessage, FunctionMessageChunk, ToolMessage, ToolMessageChunk, ChatMessage, mapStoredMessageToChatMessage, ChatMessageChunk, coerceMessageLikeToMessage, isBaseMessage, isBaseMessageChunk, } from "@langchain/core/messages";
|
|
5
5
|
export { BaseMessage, HumanMessage, AIMessage, SystemMessage };
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated
|
|
@@ -23,10 +23,10 @@ export const AIChatMessage = AIMessage;
|
|
|
23
23
|
* Use {@link SystemMessage} instead.
|
|
24
24
|
*/
|
|
25
25
|
export const SystemChatMessage = SystemMessage;
|
|
26
|
-
export { GenerationChunk, ChatGenerationChunk, } from "langchain
|
|
27
|
-
export { BasePromptValue } from "langchain
|
|
28
|
-
export { BaseChatMessageHistory, BaseListChatMessageHistory, } from "langchain
|
|
29
|
-
export { BaseCache } from "langchain
|
|
26
|
+
export { GenerationChunk, ChatGenerationChunk, } from "@langchain/core/outputs";
|
|
27
|
+
export { BasePromptValue } from "@langchain/core/prompt_values";
|
|
28
|
+
export { BaseChatMessageHistory, BaseListChatMessageHistory, } from "@langchain/core/chat_history";
|
|
29
|
+
export { BaseCache } from "@langchain/core/caches";
|
|
30
30
|
/**
|
|
31
31
|
* Base class for all file stores. All file stores should extend this
|
|
32
32
|
* class.
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("langchain
|
|
17
|
+
__exportStar(require("@langchain/core/output_parsers"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain
|
|
1
|
+
export * from "@langchain/core/output_parsers";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain
|
|
1
|
+
export * from "@langchain/core/output_parsers";
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("langchain
|
|
17
|
+
__exportStar(require("@langchain/core/retrievers"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain
|
|
1
|
+
export * from "@langchain/core/retrievers";
|
package/dist/schema/retriever.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain
|
|
1
|
+
export * from "@langchain/core/retrievers";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports._coerceToRunnable = exports.RunnableWithFallbacks = exports.RunnableLambda = exports.RunnableMap = exports.RunnableSequence = exports.RunnableRetry = exports.RunnableEach = exports.RunnableBinding = exports.Runnable = void 0;
|
|
4
|
-
var runnables_1 = require("langchain
|
|
4
|
+
var runnables_1 = require("@langchain/core/runnables");
|
|
5
5
|
Object.defineProperty(exports, "Runnable", { enumerable: true, get: function () { return runnables_1.Runnable; } });
|
|
6
6
|
Object.defineProperty(exports, "RunnableBinding", { enumerable: true, get: function () { return runnables_1.RunnableBinding; } });
|
|
7
7
|
Object.defineProperty(exports, "RunnableEach", { enumerable: true, get: function () { return runnables_1.RunnableEach; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type RunnableFunc, type RunnableLike, type RunnableBatchOptions, type RunnableRetryFailedAttemptHandler, Runnable, type RunnableBindingArgs, RunnableBinding, RunnableEach, RunnableRetry, RunnableSequence, RunnableMap, RunnableLambda, RunnableWithFallbacks, _coerceToRunnable, } from "langchain
|
|
1
|
+
export { type RunnableFunc, type RunnableLike, type RunnableBatchOptions, type RunnableRetryFailedAttemptHandler, Runnable, type RunnableBindingArgs, RunnableBinding, RunnableEach, RunnableRetry, RunnableSequence, RunnableMap, RunnableLambda, RunnableWithFallbacks, _coerceToRunnable, } from "@langchain/core/runnables";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Runnable, RunnableBinding, RunnableEach, RunnableRetry, RunnableSequence, RunnableMap, RunnableLambda, RunnableWithFallbacks, _coerceToRunnable, } from "langchain
|
|
1
|
+
export { Runnable, RunnableBinding, RunnableEach, RunnableRetry, RunnableSequence, RunnableMap, RunnableLambda, RunnableWithFallbacks, _coerceToRunnable, } from "@langchain/core/runnables";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RunnableBranch = void 0;
|
|
4
|
-
var runnables_1 = require("langchain
|
|
4
|
+
var runnables_1 = require("@langchain/core/runnables");
|
|
5
5
|
Object.defineProperty(exports, "RunnableBranch", { enumerable: true, get: function () { return runnables_1.RunnableBranch; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type Branch, type BranchLike, RunnableBranch, } from "langchain
|
|
1
|
+
export { type Branch, type BranchLike, RunnableBranch, } from "@langchain/core/runnables";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RunnableBranch, } from "langchain
|
|
1
|
+
export { RunnableBranch, } from "@langchain/core/runnables";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getCallbackMangerForConfig, RunnableConfig, } from "langchain
|
|
1
|
+
export { getCallbackMangerForConfig, RunnableConfig, } from "@langchain/core/runnables";
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("langchain
|
|
17
|
+
__exportStar(require("@langchain/core/runnables"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain
|
|
1
|
+
export * from "@langchain/core/runnables";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain
|
|
1
|
+
export * from "@langchain/core/runnables";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RunnablePassthrough = exports.RunnableAssign = void 0;
|
|
4
|
-
var runnables_1 = require("langchain
|
|
4
|
+
var runnables_1 = require("@langchain/core/runnables");
|
|
5
5
|
Object.defineProperty(exports, "RunnableAssign", { enumerable: true, get: function () { return runnables_1.RunnableAssign; } });
|
|
6
6
|
Object.defineProperty(exports, "RunnablePassthrough", { enumerable: true, get: function () { return runnables_1.RunnablePassthrough; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RunnableAssign, RunnablePassthrough } from "langchain
|
|
1
|
+
export { RunnableAssign, RunnablePassthrough } from "@langchain/core/runnables";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RunnableAssign, RunnablePassthrough } from "langchain
|
|
1
|
+
export { RunnableAssign, RunnablePassthrough } from "@langchain/core/runnables";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RouterRunnable = void 0;
|
|
4
|
-
var runnables_1 = require("langchain
|
|
4
|
+
var runnables_1 = require("@langchain/core/runnables");
|
|
5
5
|
Object.defineProperty(exports, "RouterRunnable", { enumerable: true, get: function () { return runnables_1.RouterRunnable; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type RouterInput, RouterRunnable } from "langchain
|
|
1
|
+
export { type RouterInput, RouterRunnable } from "@langchain/core/runnables";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RouterRunnable } from "langchain
|
|
1
|
+
export { RouterRunnable } from "@langchain/core/runnables";
|
package/dist/schema/storage.cjs
CHANGED
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("langchain
|
|
17
|
+
__exportStar(require("@langchain/core/stores"), exports);
|
package/dist/schema/storage.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain
|
|
1
|
+
export * from "@langchain/core/stores";
|
package/dist/schema/storage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain
|
|
1
|
+
export * from "@langchain/core/stores";
|
package/dist/tools/base.cjs
CHANGED
|
@@ -1,111 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Tool = exports.StructuredTool = exports.ToolInputParsingException = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* Custom error class used to handle exceptions related to tool input parsing.
|
|
9
|
-
* It extends the built-in `Error` class and adds an optional `output`
|
|
10
|
-
* property that can hold the output that caused the exception.
|
|
11
|
-
*/
|
|
12
|
-
class ToolInputParsingException extends Error {
|
|
13
|
-
constructor(message, output) {
|
|
14
|
-
super(message);
|
|
15
|
-
Object.defineProperty(this, "output", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true,
|
|
19
|
-
value: void 0
|
|
20
|
-
});
|
|
21
|
-
this.output = output;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.ToolInputParsingException = ToolInputParsingException;
|
|
25
|
-
/**
|
|
26
|
-
* Base class for Tools that accept input of any shape defined by a Zod schema.
|
|
27
|
-
*/
|
|
28
|
-
class StructuredTool extends index_js_1.BaseLangChain {
|
|
29
|
-
get lc_namespace() {
|
|
30
|
-
return ["langchain", "tools"];
|
|
31
|
-
}
|
|
32
|
-
constructor(fields) {
|
|
33
|
-
super(fields ?? {});
|
|
34
|
-
Object.defineProperty(this, "returnDirect", {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
writable: true,
|
|
38
|
-
value: false
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Invokes the tool with the provided input and configuration.
|
|
43
|
-
* @param input The input for the tool.
|
|
44
|
-
* @param config Optional configuration for the tool.
|
|
45
|
-
* @returns A Promise that resolves with a string.
|
|
46
|
-
*/
|
|
47
|
-
async invoke(input, config) {
|
|
48
|
-
return this.call(input, config);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Calls the tool with the provided argument, configuration, and tags. It
|
|
52
|
-
* parses the input according to the schema, handles any errors, and
|
|
53
|
-
* manages callbacks.
|
|
54
|
-
* @param arg The input argument for the tool.
|
|
55
|
-
* @param configArg Optional configuration or callbacks for the tool.
|
|
56
|
-
* @param tags Optional tags for the tool.
|
|
57
|
-
* @returns A Promise that resolves with a string.
|
|
58
|
-
*/
|
|
59
|
-
async call(arg, configArg,
|
|
60
|
-
/** @deprecated */
|
|
61
|
-
tags) {
|
|
62
|
-
let parsed;
|
|
63
|
-
try {
|
|
64
|
-
parsed = await this.schema.parseAsync(arg);
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
throw new ToolInputParsingException(`Received tool input did not match expected schema`, JSON.stringify(arg));
|
|
68
|
-
}
|
|
69
|
-
const config = (0, manager_js_1.parseCallbackConfigArg)(configArg);
|
|
70
|
-
const callbackManager_ = await manager_js_1.CallbackManager.configure(config.callbacks, this.callbacks, config.tags || tags, this.tags, config.metadata, this.metadata, { verbose: this.verbose });
|
|
71
|
-
const runManager = await callbackManager_?.handleToolStart(this.toJSON(), typeof parsed === "string" ? parsed : JSON.stringify(parsed), undefined, undefined, undefined, undefined, config.runName);
|
|
72
|
-
let result;
|
|
73
|
-
try {
|
|
74
|
-
result = await this._call(parsed, runManager);
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
await runManager?.handleToolError(e);
|
|
78
|
-
throw e;
|
|
79
|
-
}
|
|
80
|
-
await runManager?.handleToolEnd(result);
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.StructuredTool = StructuredTool;
|
|
85
|
-
/**
|
|
86
|
-
* Base class for Tools that accept input as a string.
|
|
87
|
-
*/
|
|
88
|
-
class Tool extends StructuredTool {
|
|
89
|
-
constructor(fields) {
|
|
90
|
-
super(fields);
|
|
91
|
-
Object.defineProperty(this, "schema", {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
configurable: true,
|
|
94
|
-
writable: true,
|
|
95
|
-
value: zod_1.z
|
|
96
|
-
.object({ input: zod_1.z.string().optional() })
|
|
97
|
-
.transform((obj) => obj.input)
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Calls the tool with the provided argument and callbacks. It handles
|
|
102
|
-
* string inputs specifically.
|
|
103
|
-
* @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.
|
|
104
|
-
* @param callbacks Optional callbacks for the tool.
|
|
105
|
-
* @returns A Promise that resolves with a string.
|
|
106
|
-
*/
|
|
107
|
-
call(arg, callbacks) {
|
|
108
|
-
return super.call(typeof arg === "string" || !arg ? { input: arg } : arg, callbacks);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.Tool = Tool;
|
|
4
|
+
var tools_1 = require("@langchain/core/tools");
|
|
5
|
+
Object.defineProperty(exports, "ToolInputParsingException", { enumerable: true, get: function () { return tools_1.ToolInputParsingException; } });
|
|
6
|
+
Object.defineProperty(exports, "StructuredTool", { enumerable: true, get: function () { return tools_1.StructuredTool; } });
|
|
7
|
+
Object.defineProperty(exports, "Tool", { enumerable: true, get: function () { return tools_1.Tool; } });
|
package/dist/tools/base.d.ts
CHANGED
|
@@ -1,72 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { CallbackManagerForToolRun, Callbacks } from "../callbacks/manager.js";
|
|
3
|
-
import { BaseLangChain, BaseLangChainParams } from "../base_language/index.js";
|
|
4
|
-
import { RunnableConfig } from "../schema/runnable/config.js";
|
|
5
|
-
/**
|
|
6
|
-
* Parameters for the Tool classes.
|
|
7
|
-
*/
|
|
8
|
-
export interface ToolParams extends BaseLangChainParams {
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Custom error class used to handle exceptions related to tool input parsing.
|
|
12
|
-
* It extends the built-in `Error` class and adds an optional `output`
|
|
13
|
-
* property that can hold the output that caused the exception.
|
|
14
|
-
*/
|
|
15
|
-
export declare class ToolInputParsingException extends Error {
|
|
16
|
-
output?: string;
|
|
17
|
-
constructor(message: string, output?: string);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Base class for Tools that accept input of any shape defined by a Zod schema.
|
|
21
|
-
*/
|
|
22
|
-
export declare abstract class StructuredTool<T extends z.ZodObject<any, any, any, any> = z.ZodObject<any, any, any, any>> extends BaseLangChain<(z.output<T> extends string ? string : never) | z.input<T>, string> {
|
|
23
|
-
abstract schema: T | z.ZodEffects<T>;
|
|
24
|
-
get lc_namespace(): string[];
|
|
25
|
-
constructor(fields?: ToolParams);
|
|
26
|
-
protected abstract _call(arg: z.output<T>, runManager?: CallbackManagerForToolRun): Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Invokes the tool with the provided input and configuration.
|
|
29
|
-
* @param input The input for the tool.
|
|
30
|
-
* @param config Optional configuration for the tool.
|
|
31
|
-
* @returns A Promise that resolves with a string.
|
|
32
|
-
*/
|
|
33
|
-
invoke(input: (z.output<T> extends string ? string : never) | z.input<T>, config?: RunnableConfig): Promise<string>;
|
|
34
|
-
/**
|
|
35
|
-
* Calls the tool with the provided argument, configuration, and tags. It
|
|
36
|
-
* parses the input according to the schema, handles any errors, and
|
|
37
|
-
* manages callbacks.
|
|
38
|
-
* @param arg The input argument for the tool.
|
|
39
|
-
* @param configArg Optional configuration or callbacks for the tool.
|
|
40
|
-
* @param tags Optional tags for the tool.
|
|
41
|
-
* @returns A Promise that resolves with a string.
|
|
42
|
-
*/
|
|
43
|
-
call(arg: (z.output<T> extends string ? string : never) | z.input<T>, configArg?: Callbacks | RunnableConfig,
|
|
44
|
-
/** @deprecated */
|
|
45
|
-
tags?: string[]): Promise<string>;
|
|
46
|
-
abstract name: string;
|
|
47
|
-
abstract description: string;
|
|
48
|
-
returnDirect: boolean;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Base class for Tools that accept input as a string.
|
|
52
|
-
*/
|
|
53
|
-
export declare abstract class Tool extends StructuredTool {
|
|
54
|
-
schema: z.ZodEffects<z.ZodObject<{
|
|
55
|
-
input: z.ZodOptional<z.ZodString>;
|
|
56
|
-
}, "strip", z.ZodTypeAny, {
|
|
57
|
-
input?: string | undefined;
|
|
58
|
-
}, {
|
|
59
|
-
input?: string | undefined;
|
|
60
|
-
}>, string | undefined, {
|
|
61
|
-
input?: string | undefined;
|
|
62
|
-
}>;
|
|
63
|
-
constructor(fields?: ToolParams);
|
|
64
|
-
/**
|
|
65
|
-
* Calls the tool with the provided argument and callbacks. It handles
|
|
66
|
-
* string inputs specifically.
|
|
67
|
-
* @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.
|
|
68
|
-
* @param callbacks Optional callbacks for the tool.
|
|
69
|
-
* @returns A Promise that resolves with a string.
|
|
70
|
-
*/
|
|
71
|
-
call(arg: string | undefined | z.input<this["schema"]>, callbacks?: Callbacks): Promise<string>;
|
|
72
|
-
}
|
|
1
|
+
export { type ToolParams, ToolInputParsingException, StructuredTool, Tool, } from "@langchain/core/tools";
|