langchain 0.0.196 → 0.0.197-rc.0
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/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/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/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/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/document.cjs +2 -2
- package/dist/document.d.ts +1 -1
- package/dist/document.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/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/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/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/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 +10 -10
- 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/storage.cjs +1 -1
- package/dist/schema/storage.d.ts +1 -1
- package/dist/schema/storage.js +1 -1
- 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/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 +9 -8
package/dist/prompts/base.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { type TypedPromptInputValues,
|
|
2
|
-
export {
|
|
3
|
-
export { BaseExampleSelector } from "langchain-core/
|
|
1
|
+
export { type TypedPromptInputValues, BaseStringPromptTemplate, type BasePromptTemplateInput, BasePromptTemplate, } from "langchain-core/prompts";
|
|
2
|
+
export { StringPromptValue } from "langchain-core/prompt_values";
|
|
3
|
+
export { BaseExampleSelector } from "langchain-core/example_selectors";
|
package/dist/prompts/base.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { BaseExampleSelector } from "langchain-core/
|
|
1
|
+
export { BaseStringPromptTemplate, BasePromptTemplate, } from "langchain-core/prompts";
|
|
2
|
+
export { StringPromptValue } from "langchain-core/prompt_values";
|
|
3
|
+
export { BaseExampleSelector } from "langchain-core/example_selectors";
|
package/dist/prompts/chat.cjs
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
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.ChatPromptValue = exports.ChatPromptTemplate = exports.SystemMessagePromptTemplate = exports.AIMessagePromptTemplate = exports.HumanMessagePromptTemplate = exports.ChatMessagePromptTemplate = exports.BaseChatPromptTemplate = exports.BaseMessageStringPromptTemplate = exports.MessagesPlaceholder = exports.BaseMessagePromptTemplate = void 0;
|
|
4
|
+
var prompts_1 = require("langchain-core/prompts");
|
|
5
|
+
Object.defineProperty(exports, "BaseMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.BaseMessagePromptTemplate; } });
|
|
6
|
+
Object.defineProperty(exports, "MessagesPlaceholder", { enumerable: true, get: function () { return prompts_1.MessagesPlaceholder; } });
|
|
7
|
+
Object.defineProperty(exports, "BaseMessageStringPromptTemplate", { enumerable: true, get: function () { return prompts_1.BaseMessageStringPromptTemplate; } });
|
|
8
|
+
Object.defineProperty(exports, "BaseChatPromptTemplate", { enumerable: true, get: function () { return prompts_1.BaseChatPromptTemplate; } });
|
|
9
|
+
Object.defineProperty(exports, "ChatMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.ChatMessagePromptTemplate; } });
|
|
10
|
+
Object.defineProperty(exports, "HumanMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.HumanMessagePromptTemplate; } });
|
|
11
|
+
Object.defineProperty(exports, "AIMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.AIMessagePromptTemplate; } });
|
|
12
|
+
Object.defineProperty(exports, "SystemMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.SystemMessagePromptTemplate; } });
|
|
13
|
+
Object.defineProperty(exports, "ChatPromptTemplate", { enumerable: true, get: function () { return prompts_1.ChatPromptTemplate; } });
|
|
14
|
+
var prompt_values_1 = require("langchain-core/prompt_values");
|
|
15
|
+
Object.defineProperty(exports, "ChatPromptValue", { enumerable: true, get: function () { return prompt_values_1.ChatPromptValue; } });
|
package/dist/prompts/chat.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { BaseMessagePromptTemplate, type MessagesPlaceholderFields as MessagePlaceholderFields, MessagesPlaceholder, type MessageStringPromptTemplateFields, BaseMessageStringPromptTemplate, BaseChatPromptTemplate, type ChatMessagePromptTemplateFields, ChatMessagePromptTemplate, HumanMessagePromptTemplate, AIMessagePromptTemplate, SystemMessagePromptTemplate, type ChatPromptTemplateInput, type BaseMessagePromptTemplateLike, ChatPromptTemplate, } from "langchain-core/prompts";
|
|
2
|
+
export { type ChatPromptValueFields, ChatPromptValue, } from "langchain-core/prompt_values";
|
package/dist/prompts/chat.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { BaseMessagePromptTemplate, MessagesPlaceholder, BaseMessageStringPromptTemplate, BaseChatPromptTemplate, ChatMessagePromptTemplate, HumanMessagePromptTemplate, AIMessagePromptTemplate, SystemMessagePromptTemplate, ChatPromptTemplate, } from "langchain-core/prompts";
|
|
2
|
+
export { ChatPromptValue, } from "langchain-core/prompt_values";
|
|
@@ -1,17 +1,6 @@
|
|
|
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.FewShotChatMessagePromptTemplate = exports.FewShotPromptTemplate = void 0;
|
|
4
|
+
var prompts_1 = require("langchain-core/prompts");
|
|
5
|
+
Object.defineProperty(exports, "FewShotPromptTemplate", { enumerable: true, get: function () { return prompts_1.FewShotPromptTemplate; } });
|
|
6
|
+
Object.defineProperty(exports, "FewShotChatMessagePromptTemplate", { enumerable: true, get: function () { return prompts_1.FewShotChatMessagePromptTemplate; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { type FewShotPromptTemplateInput, FewShotPromptTemplate, type FewShotChatMessagePromptTemplateInput, FewShotChatMessagePromptTemplate, } from "langchain-core/prompts";
|
package/dist/prompts/few_shot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { FewShotPromptTemplate, FewShotChatMessagePromptTemplate, } from "langchain-core/prompts";
|
package/dist/prompts/index.cjs
CHANGED
|
@@ -5,8 +5,8 @@ var base_js_1 = require("./base.cjs");
|
|
|
5
5
|
Object.defineProperty(exports, "BasePromptTemplate", { enumerable: true, get: function () { return base_js_1.BasePromptTemplate; } });
|
|
6
6
|
Object.defineProperty(exports, "StringPromptValue", { enumerable: true, get: function () { return base_js_1.StringPromptValue; } });
|
|
7
7
|
Object.defineProperty(exports, "BaseStringPromptTemplate", { enumerable: true, get: function () { return base_js_1.BaseStringPromptTemplate; } });
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "BaseExampleSelector", { enumerable: true, get: function () { return
|
|
8
|
+
var example_selectors_1 = require("langchain-core/example_selectors");
|
|
9
|
+
Object.defineProperty(exports, "BaseExampleSelector", { enumerable: true, get: function () { return example_selectors_1.BaseExampleSelector; } });
|
|
10
10
|
var prompt_js_1 = require("./prompt.cjs");
|
|
11
11
|
Object.defineProperty(exports, "PromptTemplate", { enumerable: true, get: function () { return prompt_js_1.PromptTemplate; } });
|
|
12
12
|
var conditional_js_1 = require("./selectors/conditional.cjs");
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { BasePromptTemplate, type BasePromptTemplateInput, StringPromptValue, BaseStringPromptTemplate, } from "./base.js";
|
|
2
|
-
export { BaseExampleSelector } from "langchain-core/
|
|
2
|
+
export { BaseExampleSelector } from "langchain-core/example_selectors";
|
|
3
3
|
export { PromptTemplate, type PromptTemplateInput } from "./prompt.js";
|
|
4
4
|
export { BasePromptSelector, ConditionalPromptSelector, isChatModel, isLLM, } from "./selectors/conditional.js";
|
|
5
5
|
export { LengthBasedExampleSelector, type LengthBasedExampleSelectorInput, } from "./selectors/LengthBasedExampleSelector.js";
|
package/dist/prompts/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { BasePromptTemplate, StringPromptValue, BaseStringPromptTemplate, } from "./base.js";
|
|
2
|
-
export { BaseExampleSelector } from "langchain-core/
|
|
2
|
+
export { BaseExampleSelector } from "langchain-core/example_selectors";
|
|
3
3
|
export { PromptTemplate } from "./prompt.js";
|
|
4
4
|
export { BasePromptSelector, ConditionalPromptSelector, isChatModel, isLLM, } from "./selectors/conditional.js";
|
|
5
5
|
export { LengthBasedExampleSelector, } from "./selectors/LengthBasedExampleSelector.js";
|
|
@@ -1,17 +1,5 @@
|
|
|
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.PipelinePromptTemplate = void 0;
|
|
4
|
+
var prompts_1 = require("langchain-core/prompts");
|
|
5
|
+
Object.defineProperty(exports, "PipelinePromptTemplate", { enumerable: true, get: function () { return prompts_1.PipelinePromptTemplate; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { type PipelinePromptParams, type PipelinePromptTemplateInput, PipelinePromptTemplate, } from "langchain-core/prompts";
|
package/dist/prompts/pipeline.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PipelinePromptTemplate, } from "langchain-core/prompts";
|
package/dist/prompts/prompt.cjs
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
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.PromptTemplate = void 0;
|
|
4
|
+
var prompts_1 = require("langchain-core/prompts");
|
|
5
|
+
Object.defineProperty(exports, "PromptTemplate", { enumerable: true, get: function () { return prompts_1.PromptTemplate; } });
|
package/dist/prompts/prompt.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { type PromptTemplateInput, type ParamsFromFString, PromptTemplate, } from "langchain-core/prompts";
|
package/dist/prompts/prompt.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PromptTemplate, } from "langchain-core/prompts";
|
|
@@ -1,17 +1,5 @@
|
|
|
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.LengthBasedExampleSelector = void 0;
|
|
4
|
+
var example_selectors_1 = require("langchain-core/example_selectors");
|
|
5
|
+
Object.defineProperty(exports, "LengthBasedExampleSelector", { enumerable: true, get: function () { return example_selectors_1.LengthBasedExampleSelector; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { type LengthBasedExampleSelectorInput, LengthBasedExampleSelector, } from "langchain-core/example_selectors";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { LengthBasedExampleSelector, } from "langchain-core/example_selectors";
|
|
@@ -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-core/
|
|
17
|
+
__exportStar(require("langchain-core/example_selectors"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain-core/
|
|
1
|
+
export * from "langchain-core/example_selectors";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain-core/
|
|
1
|
+
export * from "langchain-core/example_selectors";
|
|
@@ -1,17 +1,8 @@
|
|
|
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.isChatModel = exports.isLLM = exports.ConditionalPromptSelector = exports.BasePromptSelector = void 0;
|
|
4
|
+
var example_selectors_1 = require("langchain-core/example_selectors");
|
|
5
|
+
Object.defineProperty(exports, "BasePromptSelector", { enumerable: true, get: function () { return example_selectors_1.BasePromptSelector; } });
|
|
6
|
+
Object.defineProperty(exports, "ConditionalPromptSelector", { enumerable: true, get: function () { return example_selectors_1.ConditionalPromptSelector; } });
|
|
7
|
+
Object.defineProperty(exports, "isLLM", { enumerable: true, get: function () { return example_selectors_1.isLLM; } });
|
|
8
|
+
Object.defineProperty(exports, "isChatModel", { enumerable: true, get: function () { return example_selectors_1.isChatModel; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { type BaseGetPromptAsyncOptions, BasePromptSelector, ConditionalPromptSelector, isLLM, isChatModel, } from "langchain-core/example_selectors";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { BasePromptSelector, ConditionalPromptSelector, isLLM, isChatModel, } from "langchain-core/example_selectors";
|
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/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-core/
|
|
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-core/
|
|
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-core/
|
|
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
1
|
import type { OpenAI as OpenAIClient } from "openai";
|
|
2
|
-
import { BaseMessage, HumanMessage, AIMessage, SystemMessage } from "langchain-core/
|
|
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-core/
|
|
6
|
-
export { RUN_KEY } from "langchain-core/
|
|
7
|
-
export { type Example } from "langchain-core/prompts
|
|
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-core/
|
|
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-core/
|
|
34
|
-
export { BasePromptValue } from "langchain-core/
|
|
35
|
-
export { type InputValues, type PartialValues, type ChainValues, } from "langchain-core/
|
|
36
|
-
export { BaseChatMessageHistory, BaseListChatMessageHistory, } from "langchain-core/
|
|
37
|
-
export { BaseCache } from "langchain-core/
|
|
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-core/
|
|
1
|
+
import { BaseMessage, HumanMessage, AIMessage, SystemMessage, } from "langchain-core/messages";
|
|
2
2
|
import { Serializable } from "../load/serializable.js";
|
|
3
|
-
export { RUN_KEY } from "langchain-core/
|
|
4
|
-
export { BaseMessageChunk, HumanMessageChunk, AIMessageChunk, SystemMessageChunk, FunctionMessage, FunctionMessageChunk, ToolMessage, ToolMessageChunk, ChatMessage, mapStoredMessageToChatMessage, ChatMessageChunk, coerceMessageLikeToMessage, isBaseMessage, isBaseMessageChunk, } from "langchain-core/
|
|
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-core/
|
|
27
|
-
export { BasePromptValue } from "langchain-core/
|
|
28
|
-
export { BaseChatMessageHistory, BaseListChatMessageHistory, } from "langchain-core/
|
|
29
|
-
export { BaseCache } from "langchain-core/
|
|
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-core/
|
|
17
|
+
__exportStar(require("langchain-core/output_parsers"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain-core/
|
|
1
|
+
export * from "langchain-core/output_parsers";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain-core/
|
|
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-core/
|
|
17
|
+
__exportStar(require("langchain-core/retrievers"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain-core/
|
|
1
|
+
export * from "langchain-core/retrievers";
|
package/dist/schema/retriever.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain-core/
|
|
1
|
+
export * from "langchain-core/retrievers";
|
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-core/
|
|
17
|
+
__exportStar(require("langchain-core/stores"), exports);
|
package/dist/schema/storage.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain-core/
|
|
1
|
+
export * from "langchain-core/stores";
|
package/dist/schema/storage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain-core/
|
|
1
|
+
export * from "langchain-core/stores";
|
|
@@ -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-core/
|
|
17
|
+
__exportStar(require("langchain-core/utils/async_caller"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain-core/
|
|
1
|
+
export * from "langchain-core/utils/async_caller";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "langchain-core/
|
|
1
|
+
export * from "langchain-core/utils/async_caller";
|
|
@@ -30,6 +30,7 @@ const sdk_core_1 = require("@gomomento/sdk-core");
|
|
|
30
30
|
const uuid = __importStar(require("uuid"));
|
|
31
31
|
const document_js_1 = require("../document.cjs");
|
|
32
32
|
const base_js_1 = require("./base.cjs");
|
|
33
|
+
const math_js_1 = require("../util/math.cjs");
|
|
33
34
|
/**
|
|
34
35
|
* A vector store that uses the Momento Vector Index.
|
|
35
36
|
*
|
|
@@ -234,6 +235,44 @@ class MomentoVectorIndex extends base_js_1.VectorStore {
|
|
|
234
235
|
throw new Error(`Unknown response type: ${response.toString()}`);
|
|
235
236
|
}
|
|
236
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Return documents selected using the maximal marginal relevance.
|
|
240
|
+
* Maximal marginal relevance optimizes for similarity to the query AND diversity
|
|
241
|
+
* among selected documents.
|
|
242
|
+
*
|
|
243
|
+
* @param {string} query - Text to look up documents similar to.
|
|
244
|
+
* @param {number} options.k - Number of documents to return.
|
|
245
|
+
* @param {number} options.fetchK - Number of documents to fetch before passing to the MMR algorithm.
|
|
246
|
+
* @param {number} options.lambda - Number between 0 and 1 that determines the degree of diversity among the results,
|
|
247
|
+
* where 0 corresponds to maximum diversity and 1 to minimum diversity.
|
|
248
|
+
* @param {this["FilterType"]} options.filter - Optional filter
|
|
249
|
+
* @param _callbacks
|
|
250
|
+
*
|
|
251
|
+
* @returns {Promise<Document[]>} - List of documents selected by maximal marginal relevance.
|
|
252
|
+
*/
|
|
253
|
+
async maxMarginalRelevanceSearch(query, options) {
|
|
254
|
+
const queryEmbedding = await this.embeddings.embedQuery(query);
|
|
255
|
+
const response = await this.client.searchAndFetchVectors(this.indexName, queryEmbedding, { topK: options.fetchK ?? 20, metadataFields: sdk_core_1.ALL_VECTOR_METADATA });
|
|
256
|
+
if (response instanceof sdk_core_1.VectorSearchAndFetchVectors.Success) {
|
|
257
|
+
const hits = response.hits();
|
|
258
|
+
// Gather the embeddings of the search results
|
|
259
|
+
const embeddingList = hits.map((hit) => hit.vector);
|
|
260
|
+
// Gather the ids of the most relevant results when applying MMR
|
|
261
|
+
const mmrIndexes = (0, math_js_1.maximalMarginalRelevance)(queryEmbedding, embeddingList, options.lambda, options.k);
|
|
262
|
+
const finalResult = mmrIndexes.map((index) => {
|
|
263
|
+
const hit = hits[index];
|
|
264
|
+
const { [this.textField]: pageContent, ...metadata } = hit.metadata;
|
|
265
|
+
return new document_js_1.Document({ metadata, pageContent: pageContent });
|
|
266
|
+
});
|
|
267
|
+
return finalResult;
|
|
268
|
+
}
|
|
269
|
+
else if (response instanceof sdk_core_1.VectorSearchAndFetchVectors.Error) {
|
|
270
|
+
throw new Error(response.toString());
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
throw new Error(`Unknown response type: ${response.toString()}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
237
276
|
/**
|
|
238
277
|
* Stores the documents in the index.
|
|
239
278
|
*
|