langchain 0.0.195 → 0.0.196
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/toolkits/conversational_retrieval/token_buffer_memory.d.ts +1 -1
- package/dist/base_language/count_tokens.cjs +5 -70
- package/dist/base_language/count_tokens.d.ts +1 -10
- package/dist/base_language/count_tokens.js +1 -65
- package/dist/base_language/index.cjs +6 -196
- package/dist/base_language/index.d.ts +1 -111
- package/dist/base_language/index.js +1 -191
- package/dist/cache/base.cjs +15 -37
- package/dist/cache/base.d.ts +1 -20
- package/dist/cache/base.js +1 -33
- package/dist/cache/index.cjs +2 -46
- package/dist/cache/index.d.ts +1 -29
- package/dist/cache/index.js +1 -45
- package/dist/callbacks/base.cjs +3 -139
- package/dist/callbacks/base.d.ts +1 -266
- package/dist/callbacks/base.js +1 -126
- package/dist/callbacks/handlers/console.cjs +14 -221
- package/dist/callbacks/handlers/console.d.ts +1 -117
- package/dist/callbacks/handlers/console.js +1 -217
- package/dist/callbacks/handlers/initialize.cjs +15 -30
- package/dist/callbacks/handlers/initialize.d.ts +1 -16
- package/dist/callbacks/handlers/initialize.js +1 -27
- package/dist/callbacks/handlers/log_stream.cjs +15 -293
- package/dist/callbacks/handlers/log_stream.d.ts +1 -100
- package/dist/callbacks/handlers/log_stream.js +1 -289
- package/dist/callbacks/handlers/run_collector.cjs +15 -48
- package/dist/callbacks/handlers/run_collector.d.ts +1 -26
- package/dist/callbacks/handlers/run_collector.js +1 -46
- package/dist/callbacks/handlers/tracer.cjs +15 -375
- package/dist/callbacks/handlers/tracer.d.ts +1 -70
- package/dist/callbacks/handlers/tracer.js +1 -373
- package/dist/callbacks/handlers/tracer_langchain.cjs +15 -104
- package/dist/callbacks/handlers/tracer_langchain.d.ts +1 -41
- package/dist/callbacks/handlers/tracer_langchain.js +1 -102
- package/dist/callbacks/handlers/tracer_langchain_v1.cjs +15 -197
- package/dist/callbacks/handlers/tracer_langchain_v1.d.ts +1 -57
- package/dist/callbacks/handlers/tracer_langchain_v1.js +1 -195
- package/dist/callbacks/manager.cjs +15 -676
- package/dist/callbacks/manager.d.ts +1 -180
- package/dist/callbacks/manager.js +1 -666
- package/dist/callbacks/promises.cjs +14 -42
- package/dist/callbacks/promises.d.ts +1 -11
- package/dist/callbacks/promises.js +1 -37
- package/dist/chains/graph_qa/prompts.d.ts +1 -1
- package/dist/chains/openai_functions/structured_output.cjs +2 -2
- 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/baiduwenxin.d.ts +1 -1
- package/dist/chat_models/base.cjs +15 -296
- package/dist/chat_models/base.d.ts +1 -122
- package/dist/chat_models/base.js +1 -292
- package/dist/chat_models/bedrock/web.d.ts +1 -1
- package/dist/chat_models/fireworks.d.ts +1 -1
- package/dist/document.cjs +2 -24
- package/dist/document.d.ts +1 -12
- package/dist/document.js +1 -23
- package/dist/document_loaders/web/azure_blob_storage_file.d.ts +1 -1
- package/dist/document_loaders/web/s3.d.ts +1 -1
- package/dist/embeddings/base.cjs +15 -22
- package/dist/embeddings/base.d.ts +1 -33
- package/dist/embeddings/base.js +1 -20
- package/dist/embeddings/cache_backed.cjs +2 -2
- package/dist/embeddings/cache_backed.js +1 -1
- package/dist/evaluation/agents/trajectory.d.ts +1 -1
- package/dist/evaluation/criteria/prompt.d.ts +2 -2
- package/dist/evaluation/qa/prompt.d.ts +2 -2
- package/dist/experimental/hubs/makersuite/googlemakersuitehub.d.ts +1 -1
- package/dist/experimental/plan_and_execute/prompt.d.ts +1 -1
- package/dist/llms/base.cjs +15 -278
- package/dist/llms/base.d.ts +1 -115
- package/dist/llms/base.js +1 -275
- package/dist/llms/bedrock/web.d.ts +1 -1
- package/dist/llms/fireworks.d.ts +1 -1
- package/dist/load/import_map.cjs +2 -1
- package/dist/load/import_map.d.ts +1 -0
- package/dist/load/import_map.js +1 -0
- package/dist/load/index.cjs +7 -148
- package/dist/load/index.js +7 -148
- package/dist/load/map_keys.cjs +0 -24
- package/dist/load/map_keys.d.ts +0 -6
- package/dist/load/map_keys.js +1 -17
- package/dist/load/serializable.cjs +15 -178
- package/dist/load/serializable.d.ts +1 -66
- package/dist/load/serializable.js +1 -175
- package/dist/memory/base.cjs +17 -92
- package/dist/memory/base.d.ts +2 -68
- package/dist/memory/base.js +2 -87
- package/dist/output_parsers/openai_functions.cjs +2 -2
- package/dist/output_parsers/openai_functions.d.ts +1 -1
- package/dist/output_parsers/openai_functions.js +1 -1
- package/dist/output_parsers/regex.d.ts +1 -1
- package/dist/output_parsers/structured.d.ts +1 -1
- package/dist/prompts/base.cjs +8 -183
- package/dist/prompts/base.d.ts +3 -132
- package/dist/prompts/base.js +3 -178
- package/dist/prompts/chat.cjs +15 -477
- package/dist/prompts/chat.d.ts +1 -219
- package/dist/prompts/chat.js +1 -466
- package/dist/prompts/few_shot.cjs +15 -353
- package/dist/prompts/few_shot.d.ts +1 -192
- package/dist/prompts/few_shot.js +1 -350
- package/dist/prompts/index.cjs +3 -2
- package/dist/prompts/index.d.ts +2 -1
- package/dist/prompts/index.js +2 -1
- package/dist/prompts/pipeline.cjs +15 -142
- package/dist/prompts/pipeline.d.ts +1 -98
- package/dist/prompts/pipeline.js +1 -140
- package/dist/prompts/prompt.cjs +15 -146
- package/dist/prompts/prompt.d.ts +1 -92
- package/dist/prompts/prompt.js +1 -144
- package/dist/prompts/selectors/LengthBasedExampleSelector.cjs +15 -148
- package/dist/prompts/selectors/LengthBasedExampleSelector.d.ts +1 -89
- package/dist/prompts/selectors/LengthBasedExampleSelector.js +1 -146
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.cjs +15 -137
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.d.ts +1 -91
- package/dist/prompts/selectors/SemanticSimilarityExampleSelector.js +1 -135
- package/dist/prompts/selectors/conditional.cjs +15 -74
- package/dist/prompts/selectors/conditional.d.ts +1 -63
- package/dist/prompts/selectors/conditional.js +1 -69
- package/dist/prompts/serde.cjs +15 -0
- package/dist/prompts/serde.d.ts +1 -43
- package/dist/prompts/serde.js +1 -1
- package/dist/prompts/template.cjs +14 -88
- package/dist/prompts/template.d.ts +1 -36
- package/dist/prompts/template.js +1 -83
- package/dist/{util/@cfworker/json-schema → runnables}/index.cjs +1 -1
- package/dist/runnables/index.d.ts +1 -0
- package/dist/runnables/index.js +1 -0
- package/dist/schema/document.cjs +3 -34
- package/dist/schema/document.d.ts +2 -29
- package/dist/schema/document.js +2 -32
- package/dist/schema/index.cjs +37 -612
- package/dist/schema/index.d.ts +11 -311
- package/dist/schema/index.js +8 -583
- package/dist/schema/output_parser.cjs +15 -309
- package/dist/schema/output_parser.d.ts +1 -173
- package/dist/schema/output_parser.js +1 -301
- package/dist/schema/retriever.cjs +15 -77
- package/dist/schema/retriever.d.ts +1 -43
- package/dist/schema/retriever.js +1 -75
- package/dist/schema/runnable/base.cjs +10 -1072
- package/dist/schema/runnable/base.d.ts +1 -356
- package/dist/schema/runnable/base.js +1 -1060
- package/dist/schema/runnable/branch.cjs +2 -131
- package/dist/schema/runnable/branch.d.ts +1 -94
- package/dist/schema/runnable/branch.js +1 -130
- package/dist/schema/runnable/config.cjs +0 -6
- package/dist/schema/runnable/config.d.ts +1 -3
- package/dist/schema/runnable/config.js +1 -4
- package/dist/schema/runnable/index.cjs +15 -16
- package/dist/schema/runnable/index.d.ts +1 -5
- package/dist/schema/runnable/index.js +1 -4
- package/dist/schema/runnable/passthrough.cjs +3 -113
- package/dist/schema/runnable/passthrough.d.ts +1 -72
- package/dist/schema/runnable/passthrough.js +1 -111
- package/dist/schema/runnable/router.cjs +2 -71
- package/dist/schema/runnable/router.d.ts +1 -29
- package/dist/schema/runnable/router.js +1 -70
- package/dist/schema/storage.cjs +15 -8
- package/dist/schema/storage.d.ts +1 -57
- package/dist/schema/storage.js +1 -6
- package/dist/tools/bingserpapi.d.ts +1 -1
- 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/util/async_caller.cjs +14 -128
- package/dist/util/async_caller.d.ts +1 -45
- package/dist/util/async_caller.js +1 -124
- package/package.json +11 -5
- package/runnables.cjs +1 -0
- package/runnables.d.ts +1 -0
- package/runnables.js +1 -0
- package/dist/util/@cfworker/json-schema/index.d.ts +0 -1
- package/dist/util/@cfworker/json-schema/index.js +0 -1
- package/dist/util/@cfworker/json-schema/src/deep-compare-strict.cjs +0 -43
- package/dist/util/@cfworker/json-schema/src/deep-compare-strict.d.ts +0 -1
- package/dist/util/@cfworker/json-schema/src/deep-compare-strict.js +0 -39
- package/dist/util/@cfworker/json-schema/src/dereference.cjs +0 -169
- package/dist/util/@cfworker/json-schema/src/dereference.d.ts +0 -12
- package/dist/util/@cfworker/json-schema/src/dereference.js +0 -165
- package/dist/util/@cfworker/json-schema/src/format.cjs +0 -139
- package/dist/util/@cfworker/json-schema/src/format.d.ts +0 -2
- package/dist/util/@cfworker/json-schema/src/format.js +0 -136
- package/dist/util/@cfworker/json-schema/src/index.cjs +0 -24
- package/dist/util/@cfworker/json-schema/src/index.d.ts +0 -8
- package/dist/util/@cfworker/json-schema/src/index.js +0 -8
- package/dist/util/@cfworker/json-schema/src/pointer.cjs +0 -11
- package/dist/util/@cfworker/json-schema/src/pointer.d.ts +0 -2
- package/dist/util/@cfworker/json-schema/src/pointer.js +0 -6
- package/dist/util/@cfworker/json-schema/src/types.cjs +0 -2
- package/dist/util/@cfworker/json-schema/src/types.d.ts +0 -72
- package/dist/util/@cfworker/json-schema/src/types.js +0 -1
- package/dist/util/@cfworker/json-schema/src/ucs2-length.cjs +0 -28
- package/dist/util/@cfworker/json-schema/src/ucs2-length.d.ts +0 -6
- package/dist/util/@cfworker/json-schema/src/ucs2-length.js +0 -24
- package/dist/util/@cfworker/json-schema/src/validate.cjs +0 -808
- package/dist/util/@cfworker/json-schema/src/validate.d.ts +0 -3
- package/dist/util/@cfworker/json-schema/src/validate.js +0 -804
- package/dist/util/@cfworker/json-schema/src/validator.cjs +0 -44
- package/dist/util/@cfworker/json-schema/src/validator.d.ts +0 -10
- package/dist/util/@cfworker/json-schema/src/validator.js +0 -40
- package/dist/util/fast-json-patch/index.cjs +0 -49
- package/dist/util/fast-json-patch/index.d.ts +0 -22
- package/dist/util/fast-json-patch/index.js +0 -16
- package/dist/util/fast-json-patch/src/core.cjs +0 -469
- package/dist/util/fast-json-patch/src/core.d.ts +0 -111
- package/dist/util/fast-json-patch/src/core.js +0 -459
- package/dist/util/fast-json-patch/src/duplex.cjs +0 -237
- package/dist/util/fast-json-patch/src/duplex.d.ts +0 -23
- package/dist/util/fast-json-patch/src/duplex.js +0 -230
- package/dist/util/fast-json-patch/src/helpers.cjs +0 -194
- package/dist/util/fast-json-patch/src/helpers.d.ts +0 -36
- package/dist/util/fast-json-patch/src/helpers.js +0 -181
- package/dist/util/js-sha1/hash.cjs +0 -358
- package/dist/util/js-sha1/hash.d.ts +0 -1
- package/dist/util/js-sha1/hash.js +0 -355
|
@@ -1,45 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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);
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const p_queue_1 = __importDefault(require("p-queue"));
|
|
8
|
-
let queue;
|
|
9
|
-
/**
|
|
10
|
-
* Creates a queue using the p-queue library. The queue is configured to
|
|
11
|
-
* auto-start and has a concurrency of 1, meaning it will process tasks
|
|
12
|
-
* one at a time.
|
|
13
|
-
*/
|
|
14
|
-
function createQueue() {
|
|
15
|
-
const PQueue = "default" in p_queue_1.default ? p_queue_1.default.default : p_queue_1.default;
|
|
16
|
-
return new PQueue({
|
|
17
|
-
autoStart: true,
|
|
18
|
-
concurrency: 1,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Consume a promise, either adding it to the queue or waiting for it to resolve
|
|
23
|
-
* @param promise Promise to consume
|
|
24
|
-
* @param wait Whether to wait for the promise to resolve or resolve immediately
|
|
25
|
-
*/
|
|
26
|
-
async function consumeCallback(promiseFn, wait) {
|
|
27
|
-
if (wait === true) {
|
|
28
|
-
await promiseFn();
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
if (typeof queue === "undefined") {
|
|
32
|
-
queue = createQueue();
|
|
33
|
-
}
|
|
34
|
-
void queue.add(promiseFn);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.consumeCallback = consumeCallback;
|
|
38
|
-
/**
|
|
39
|
-
* Waits for all promises in the queue to resolve. If the queue is
|
|
40
|
-
* undefined, it immediately resolves a promise.
|
|
41
|
-
*/
|
|
42
|
-
function awaitAllCallbacks() {
|
|
43
|
-
return typeof queue !== "undefined" ? queue.onIdle() : Promise.resolve();
|
|
44
|
-
}
|
|
45
|
-
exports.awaitAllCallbacks = awaitAllCallbacks;
|
|
17
|
+
__exportStar(require("langchain-core/callbacks/promises"), exports);
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Consume a promise, either adding it to the queue or waiting for it to resolve
|
|
3
|
-
* @param promise Promise to consume
|
|
4
|
-
* @param wait Whether to wait for the promise to resolve or resolve immediately
|
|
5
|
-
*/
|
|
6
|
-
export declare function consumeCallback<T>(promiseFn: () => Promise<T> | T | void, wait: boolean): Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* Waits for all promises in the queue to resolve. If the queue is
|
|
9
|
-
* undefined, it immediately resolves a promise.
|
|
10
|
-
*/
|
|
11
|
-
export declare function awaitAllCallbacks(): Promise<void>;
|
|
1
|
+
export * from "langchain-core/callbacks/promises";
|
|
@@ -1,37 +1 @@
|
|
|
1
|
-
|
|
2
|
-
let queue;
|
|
3
|
-
/**
|
|
4
|
-
* Creates a queue using the p-queue library. The queue is configured to
|
|
5
|
-
* auto-start and has a concurrency of 1, meaning it will process tasks
|
|
6
|
-
* one at a time.
|
|
7
|
-
*/
|
|
8
|
-
function createQueue() {
|
|
9
|
-
const PQueue = "default" in PQueueMod ? PQueueMod.default : PQueueMod;
|
|
10
|
-
return new PQueue({
|
|
11
|
-
autoStart: true,
|
|
12
|
-
concurrency: 1,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Consume a promise, either adding it to the queue or waiting for it to resolve
|
|
17
|
-
* @param promise Promise to consume
|
|
18
|
-
* @param wait Whether to wait for the promise to resolve or resolve immediately
|
|
19
|
-
*/
|
|
20
|
-
export async function consumeCallback(promiseFn, wait) {
|
|
21
|
-
if (wait === true) {
|
|
22
|
-
await promiseFn();
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
if (typeof queue === "undefined") {
|
|
26
|
-
queue = createQueue();
|
|
27
|
-
}
|
|
28
|
-
void queue.add(promiseFn);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Waits for all promises in the queue to resolve. If the queue is
|
|
33
|
-
* undefined, it immediately resolves a promise.
|
|
34
|
-
*/
|
|
35
|
-
export function awaitAllCallbacks() {
|
|
36
|
-
return typeof queue !== "undefined" ? queue.onIdle() : Promise.resolve();
|
|
37
|
-
}
|
|
1
|
+
export * from "langchain-core/callbacks/promises";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createStructuredOutputChainFromZod = exports.createStructuredOutputChain = exports.FunctionCallStructuredOutputParser = void 0;
|
|
4
4
|
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
5
|
-
const
|
|
5
|
+
const json_schema_1 = require("langchain-core/util/json_schema");
|
|
6
6
|
const llm_chain_js_1 = require("../llm_chain.cjs");
|
|
7
7
|
const openai_js_1 = require("../../chat_models/openai.cjs");
|
|
8
8
|
const output_parser_js_1 = require("../../schema/output_parser.cjs");
|
|
@@ -38,7 +38,7 @@ class FunctionCallStructuredOutputParser extends output_parser_js_1.BaseLLMOutpu
|
|
|
38
38
|
writable: true,
|
|
39
39
|
value: void 0
|
|
40
40
|
});
|
|
41
|
-
this.jsonSchemaValidator = new
|
|
41
|
+
this.jsonSchemaValidator = new json_schema_1.Validator(schema, "7");
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Method to parse the result of chat generations. It first parses the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { JsonSchema7Type } from "zod-to-json-schema/src/parseDef.js";
|
|
3
|
-
import { Validator } from "
|
|
3
|
+
import { Validator } from "langchain-core/util/json_schema";
|
|
4
4
|
import { LLMChain, LLMChainInput } from "../llm_chain.js";
|
|
5
5
|
import { ChatOpenAI } from "../../chat_models/openai.js";
|
|
6
6
|
import { BasePromptTemplate } from "../../prompts/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
2
|
-
import { Validator } from "
|
|
2
|
+
import { Validator } from "langchain-core/util/json_schema";
|
|
3
3
|
import { LLMChain } from "../llm_chain.js";
|
|
4
4
|
import { ChatOpenAI } from "../../chat_models/openai.js";
|
|
5
5
|
import { BaseLLMOutputParser, OutputParserException, } from "../../schema/output_parser.js";
|
|
@@ -131,8 +131,8 @@ export declare class ChatBaiduWenxin extends BaseChatModel implements BaiduWenxi
|
|
|
131
131
|
* Get the identifying parameters for the model
|
|
132
132
|
*/
|
|
133
133
|
identifyingParams(): {
|
|
134
|
-
system?: string | undefined;
|
|
135
134
|
stream?: boolean | undefined;
|
|
135
|
+
system?: string | undefined;
|
|
136
136
|
temperature?: number | undefined;
|
|
137
137
|
top_p?: number | undefined;
|
|
138
138
|
user_id?: string | undefined;
|
|
@@ -1,298 +1,17 @@
|
|
|
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
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const index_js_1 = require("../schema/index.cjs");
|
|
5
|
-
const index_js_2 = require("../base_language/index.cjs");
|
|
6
|
-
const manager_js_1 = require("../callbacks/manager.cjs");
|
|
7
|
-
/**
|
|
8
|
-
* Creates a transform stream for encoding chat message chunks.
|
|
9
|
-
* @deprecated Use {@link BytesOutputParser} instead
|
|
10
|
-
* @returns A TransformStream instance that encodes chat message chunks.
|
|
11
|
-
*/
|
|
12
|
-
function createChatMessageChunkEncoderStream() {
|
|
13
|
-
const textEncoder = new TextEncoder();
|
|
14
|
-
return new TransformStream({
|
|
15
|
-
transform(chunk, controller) {
|
|
16
|
-
controller.enqueue(textEncoder.encode(typeof chunk.content === "string"
|
|
17
|
-
? chunk.content
|
|
18
|
-
: JSON.stringify(chunk.content)));
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
exports.createChatMessageChunkEncoderStream = createChatMessageChunkEncoderStream;
|
|
23
|
-
/**
|
|
24
|
-
* Base class for chat models. It extends the BaseLanguageModel class and
|
|
25
|
-
* provides methods for generating chat based on input messages.
|
|
26
|
-
*/
|
|
27
|
-
class BaseChatModel extends index_js_2.BaseLanguageModel {
|
|
28
|
-
constructor(fields) {
|
|
29
|
-
super(fields);
|
|
30
|
-
Object.defineProperty(this, "lc_namespace", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true,
|
|
34
|
-
value: ["langchain", "chat_models", this._llmType()]
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
_separateRunnableConfigFromCallOptions(options) {
|
|
38
|
-
const [runnableConfig, callOptions] = super._separateRunnableConfigFromCallOptions(options);
|
|
39
|
-
if (callOptions?.timeout && !callOptions.signal) {
|
|
40
|
-
callOptions.signal = AbortSignal.timeout(callOptions.timeout);
|
|
41
|
-
}
|
|
42
|
-
return [runnableConfig, callOptions];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Invokes the chat model with a single input.
|
|
46
|
-
* @param input The input for the language model.
|
|
47
|
-
* @param options The call options.
|
|
48
|
-
* @returns A Promise that resolves to a BaseMessageChunk.
|
|
49
|
-
*/
|
|
50
|
-
async invoke(input, options) {
|
|
51
|
-
const promptValue = BaseChatModel._convertInputToPromptValue(input);
|
|
52
|
-
const result = await this.generatePrompt([promptValue], options, options?.callbacks);
|
|
53
|
-
const chatGeneration = result.generations[0][0];
|
|
54
|
-
// TODO: Remove cast after figuring out inheritance
|
|
55
|
-
return chatGeneration.message;
|
|
56
|
-
}
|
|
57
|
-
// eslint-disable-next-line require-yield
|
|
58
|
-
async *_streamResponseChunks(_messages, _options, _runManager) {
|
|
59
|
-
throw new Error("Not implemented.");
|
|
60
|
-
}
|
|
61
|
-
async *_streamIterator(input, options) {
|
|
62
|
-
// Subclass check required to avoid double callbacks with default implementation
|
|
63
|
-
if (this._streamResponseChunks ===
|
|
64
|
-
BaseChatModel.prototype._streamResponseChunks) {
|
|
65
|
-
yield this.invoke(input, options);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
const prompt = BaseChatModel._convertInputToPromptValue(input);
|
|
69
|
-
const messages = prompt.toChatMessages();
|
|
70
|
-
const [runnableConfig, callOptions] = this._separateRunnableConfigFromCallOptions(options);
|
|
71
|
-
const callbackManager_ = await manager_js_1.CallbackManager.configure(runnableConfig.callbacks, this.callbacks, runnableConfig.tags, this.tags, runnableConfig.metadata, this.metadata, { verbose: this.verbose });
|
|
72
|
-
const extra = {
|
|
73
|
-
options: callOptions,
|
|
74
|
-
invocation_params: this?.invocationParams(callOptions),
|
|
75
|
-
batch_size: 1,
|
|
76
|
-
};
|
|
77
|
-
const runManagers = await callbackManager_?.handleChatModelStart(this.toJSON(), [messages], undefined, undefined, extra, undefined, undefined, runnableConfig.runName);
|
|
78
|
-
let generationChunk;
|
|
79
|
-
try {
|
|
80
|
-
for await (const chunk of this._streamResponseChunks(messages, callOptions, runManagers?.[0])) {
|
|
81
|
-
yield chunk.message;
|
|
82
|
-
if (!generationChunk) {
|
|
83
|
-
generationChunk = chunk;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
generationChunk = generationChunk.concat(chunk);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
await Promise.all((runManagers ?? []).map((runManager) => runManager?.handleLLMError(err)));
|
|
92
|
-
throw err;
|
|
93
|
-
}
|
|
94
|
-
await Promise.all((runManagers ?? []).map((runManager) => runManager?.handleLLMEnd({
|
|
95
|
-
// TODO: Remove cast after figuring out inheritance
|
|
96
|
-
generations: [[generationChunk]],
|
|
97
|
-
})));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/** @ignore */
|
|
101
|
-
async _generateUncached(messages, parsedOptions, handledOptions) {
|
|
102
|
-
const baseMessages = messages.map((messageList) => messageList.map(index_js_1.coerceMessageLikeToMessage));
|
|
103
|
-
// create callback manager and start run
|
|
104
|
-
const callbackManager_ = await manager_js_1.CallbackManager.configure(handledOptions.callbacks, this.callbacks, handledOptions.tags, this.tags, handledOptions.metadata, this.metadata, { verbose: this.verbose });
|
|
105
|
-
const extra = {
|
|
106
|
-
options: parsedOptions,
|
|
107
|
-
invocation_params: this?.invocationParams(parsedOptions),
|
|
108
|
-
batch_size: 1,
|
|
109
|
-
};
|
|
110
|
-
const runManagers = await callbackManager_?.handleChatModelStart(this.toJSON(), baseMessages, undefined, undefined, extra, undefined, undefined, handledOptions.runName);
|
|
111
|
-
// generate results
|
|
112
|
-
const results = await Promise.allSettled(baseMessages.map((messageList, i) => this._generate(messageList, { ...parsedOptions, promptIndex: i }, runManagers?.[i])));
|
|
113
|
-
// handle results
|
|
114
|
-
const generations = [];
|
|
115
|
-
const llmOutputs = [];
|
|
116
|
-
await Promise.all(results.map(async (pResult, i) => {
|
|
117
|
-
if (pResult.status === "fulfilled") {
|
|
118
|
-
const result = pResult.value;
|
|
119
|
-
generations[i] = result.generations;
|
|
120
|
-
llmOutputs[i] = result.llmOutput;
|
|
121
|
-
return runManagers?.[i]?.handleLLMEnd({
|
|
122
|
-
generations: [result.generations],
|
|
123
|
-
llmOutput: result.llmOutput,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
// status === "rejected"
|
|
128
|
-
await runManagers?.[i]?.handleLLMError(pResult.reason);
|
|
129
|
-
return Promise.reject(pResult.reason);
|
|
130
|
-
}
|
|
131
|
-
}));
|
|
132
|
-
// create combined output
|
|
133
|
-
const output = {
|
|
134
|
-
generations,
|
|
135
|
-
llmOutput: llmOutputs.length
|
|
136
|
-
? this._combineLLMOutput?.(...llmOutputs)
|
|
137
|
-
: undefined,
|
|
138
|
-
};
|
|
139
|
-
Object.defineProperty(output, index_js_1.RUN_KEY, {
|
|
140
|
-
value: runManagers
|
|
141
|
-
? { runIds: runManagers?.map((manager) => manager.runId) }
|
|
142
|
-
: undefined,
|
|
143
|
-
configurable: true,
|
|
144
|
-
});
|
|
145
|
-
return output;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Generates chat based on the input messages.
|
|
149
|
-
* @param messages An array of arrays of BaseMessage instances.
|
|
150
|
-
* @param options The call options or an array of stop sequences.
|
|
151
|
-
* @param callbacks The callbacks for the language model.
|
|
152
|
-
* @returns A Promise that resolves to an LLMResult.
|
|
153
|
-
*/
|
|
154
|
-
async generate(messages, options, callbacks) {
|
|
155
|
-
// parse call options
|
|
156
|
-
let parsedOptions;
|
|
157
|
-
if (Array.isArray(options)) {
|
|
158
|
-
parsedOptions = { stop: options };
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
parsedOptions = options;
|
|
162
|
-
}
|
|
163
|
-
const baseMessages = messages.map((messageList) => messageList.map(index_js_1.coerceMessageLikeToMessage));
|
|
164
|
-
const [runnableConfig, callOptions] = this._separateRunnableConfigFromCallOptions(parsedOptions);
|
|
165
|
-
runnableConfig.callbacks = runnableConfig.callbacks ?? callbacks;
|
|
166
|
-
if (!this.cache) {
|
|
167
|
-
return this._generateUncached(baseMessages, callOptions, runnableConfig);
|
|
168
|
-
}
|
|
169
|
-
const { cache } = this;
|
|
170
|
-
const llmStringKey = this._getSerializedCacheKeyParametersForCall(callOptions);
|
|
171
|
-
const missingPromptIndices = [];
|
|
172
|
-
const generations = await Promise.all(baseMessages.map(async (baseMessage, index) => {
|
|
173
|
-
// Join all content into one string for the prompt index
|
|
174
|
-
const prompt = BaseChatModel._convertInputToPromptValue(baseMessage).toString();
|
|
175
|
-
const result = await cache.lookup(prompt, llmStringKey);
|
|
176
|
-
if (!result) {
|
|
177
|
-
missingPromptIndices.push(index);
|
|
178
|
-
}
|
|
179
|
-
return result;
|
|
180
|
-
}));
|
|
181
|
-
let llmOutput = {};
|
|
182
|
-
if (missingPromptIndices.length > 0) {
|
|
183
|
-
const results = await this._generateUncached(missingPromptIndices.map((i) => baseMessages[i]), callOptions, runnableConfig);
|
|
184
|
-
await Promise.all(results.generations.map(async (generation, index) => {
|
|
185
|
-
const promptIndex = missingPromptIndices[index];
|
|
186
|
-
generations[promptIndex] = generation;
|
|
187
|
-
// Join all content into one string for the prompt index
|
|
188
|
-
const prompt = BaseChatModel._convertInputToPromptValue(baseMessages[promptIndex]).toString();
|
|
189
|
-
return cache.update(prompt, llmStringKey, generation);
|
|
190
|
-
}));
|
|
191
|
-
llmOutput = results.llmOutput ?? {};
|
|
192
|
-
}
|
|
193
|
-
return { generations, llmOutput };
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Get the parameters used to invoke the model
|
|
197
|
-
*/
|
|
198
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
199
|
-
invocationParams(_options) {
|
|
200
|
-
return {};
|
|
201
|
-
}
|
|
202
|
-
_modelType() {
|
|
203
|
-
return "base_chat_model";
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* @deprecated
|
|
207
|
-
* Return a json-like object representing this LLM.
|
|
208
|
-
*/
|
|
209
|
-
serialize() {
|
|
210
|
-
return {
|
|
211
|
-
...this.invocationParams(),
|
|
212
|
-
_type: this._llmType(),
|
|
213
|
-
_model: this._modelType(),
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Generates a prompt based on the input prompt values.
|
|
218
|
-
* @param promptValues An array of BasePromptValue instances.
|
|
219
|
-
* @param options The call options or an array of stop sequences.
|
|
220
|
-
* @param callbacks The callbacks for the language model.
|
|
221
|
-
* @returns A Promise that resolves to an LLMResult.
|
|
222
|
-
*/
|
|
223
|
-
async generatePrompt(promptValues, options, callbacks) {
|
|
224
|
-
const promptMessages = promptValues.map((promptValue) => promptValue.toChatMessages());
|
|
225
|
-
return this.generate(promptMessages, options, callbacks);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Makes a single call to the chat model.
|
|
229
|
-
* @param messages An array of BaseMessage instances.
|
|
230
|
-
* @param options The call options or an array of stop sequences.
|
|
231
|
-
* @param callbacks The callbacks for the language model.
|
|
232
|
-
* @returns A Promise that resolves to a BaseMessage.
|
|
233
|
-
*/
|
|
234
|
-
async call(messages, options, callbacks) {
|
|
235
|
-
const result = await this.generate([messages.map(index_js_1.coerceMessageLikeToMessage)], options, callbacks);
|
|
236
|
-
const generations = result.generations;
|
|
237
|
-
return generations[0][0].message;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Makes a single call to the chat model with a prompt value.
|
|
241
|
-
* @param promptValue The value of the prompt.
|
|
242
|
-
* @param options The call options or an array of stop sequences.
|
|
243
|
-
* @param callbacks The callbacks for the language model.
|
|
244
|
-
* @returns A Promise that resolves to a BaseMessage.
|
|
245
|
-
*/
|
|
246
|
-
async callPrompt(promptValue, options, callbacks) {
|
|
247
|
-
const promptMessages = promptValue.toChatMessages();
|
|
248
|
-
return this.call(promptMessages, options, callbacks);
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Predicts the next message based on the input messages.
|
|
252
|
-
* @param messages An array of BaseMessage instances.
|
|
253
|
-
* @param options The call options or an array of stop sequences.
|
|
254
|
-
* @param callbacks The callbacks for the language model.
|
|
255
|
-
* @returns A Promise that resolves to a BaseMessage.
|
|
256
|
-
*/
|
|
257
|
-
async predictMessages(messages, options, callbacks) {
|
|
258
|
-
return this.call(messages, options, callbacks);
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Predicts the next message based on a text input.
|
|
262
|
-
* @param text The text input.
|
|
263
|
-
* @param options The call options or an array of stop sequences.
|
|
264
|
-
* @param callbacks The callbacks for the language model.
|
|
265
|
-
* @returns A Promise that resolves to a string.
|
|
266
|
-
*/
|
|
267
|
-
async predict(text, options, callbacks) {
|
|
268
|
-
const message = new index_js_1.HumanMessage(text);
|
|
269
|
-
const result = await this.call([message], options, callbacks);
|
|
270
|
-
if (typeof result.content !== "string") {
|
|
271
|
-
throw new Error("Cannot use predict when output is not a string.");
|
|
272
|
-
}
|
|
273
|
-
return result.content;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
exports.BaseChatModel = BaseChatModel;
|
|
277
|
-
/**
|
|
278
|
-
* An abstract class that extends BaseChatModel and provides a simple
|
|
279
|
-
* implementation of _generate.
|
|
280
|
-
*/
|
|
281
|
-
class SimpleChatModel extends BaseChatModel {
|
|
282
|
-
async _generate(messages, options, runManager) {
|
|
283
|
-
const text = await this._call(messages, options, runManager);
|
|
284
|
-
const message = new index_js_1.AIMessage(text);
|
|
285
|
-
if (typeof message.content !== "string") {
|
|
286
|
-
throw new Error("Cannot generate with a simple chat model when output is not a string.");
|
|
287
|
-
}
|
|
288
|
-
return {
|
|
289
|
-
generations: [
|
|
290
|
-
{
|
|
291
|
-
text: message.content,
|
|
292
|
-
message,
|
|
293
|
-
},
|
|
294
|
-
],
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
exports.SimpleChatModel = SimpleChatModel;
|
|
17
|
+
__exportStar(require("langchain-core/chat_model"), exports);
|
|
@@ -1,122 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { BaseLanguageModel, BaseLanguageModelCallOptions, BaseLanguageModelInput, BaseLanguageModelParams } from "../base_language/index.js";
|
|
3
|
-
import { CallbackManagerForLLMRun, Callbacks } from "../callbacks/manager.js";
|
|
4
|
-
import { RunnableConfig } from "../schema/runnable/config.js";
|
|
5
|
-
/**
|
|
6
|
-
* Represents a serialized chat model.
|
|
7
|
-
*/
|
|
8
|
-
export type SerializedChatModel = {
|
|
9
|
-
_model: string;
|
|
10
|
-
_type: string;
|
|
11
|
-
} & Record<string, any>;
|
|
12
|
-
/**
|
|
13
|
-
* Represents a serialized large language model.
|
|
14
|
-
*/
|
|
15
|
-
export type SerializedLLM = {
|
|
16
|
-
_model: string;
|
|
17
|
-
_type: string;
|
|
18
|
-
} & Record<string, any>;
|
|
19
|
-
/**
|
|
20
|
-
* Represents the parameters for a base chat model.
|
|
21
|
-
*/
|
|
22
|
-
export type BaseChatModelParams = BaseLanguageModelParams;
|
|
23
|
-
/**
|
|
24
|
-
* Represents the call options for a base chat model.
|
|
25
|
-
*/
|
|
26
|
-
export type BaseChatModelCallOptions = BaseLanguageModelCallOptions;
|
|
27
|
-
/**
|
|
28
|
-
* Creates a transform stream for encoding chat message chunks.
|
|
29
|
-
* @deprecated Use {@link BytesOutputParser} instead
|
|
30
|
-
* @returns A TransformStream instance that encodes chat message chunks.
|
|
31
|
-
*/
|
|
32
|
-
export declare function createChatMessageChunkEncoderStream(): TransformStream<BaseMessageChunk, any>;
|
|
33
|
-
/**
|
|
34
|
-
* Base class for chat models. It extends the BaseLanguageModel class and
|
|
35
|
-
* provides methods for generating chat based on input messages.
|
|
36
|
-
*/
|
|
37
|
-
export declare abstract class BaseChatModel<CallOptions extends BaseChatModelCallOptions = BaseChatModelCallOptions> extends BaseLanguageModel<BaseMessageChunk, CallOptions> {
|
|
38
|
-
ParsedCallOptions: Omit<CallOptions, keyof RunnableConfig & "timeout">;
|
|
39
|
-
lc_namespace: string[];
|
|
40
|
-
constructor(fields: BaseChatModelParams);
|
|
41
|
-
abstract _combineLLMOutput?(...llmOutputs: LLMResult["llmOutput"][]): LLMResult["llmOutput"];
|
|
42
|
-
protected _separateRunnableConfigFromCallOptions(options?: Partial<CallOptions>): [RunnableConfig, this["ParsedCallOptions"]];
|
|
43
|
-
/**
|
|
44
|
-
* Invokes the chat model with a single input.
|
|
45
|
-
* @param input The input for the language model.
|
|
46
|
-
* @param options The call options.
|
|
47
|
-
* @returns A Promise that resolves to a BaseMessageChunk.
|
|
48
|
-
*/
|
|
49
|
-
invoke(input: BaseLanguageModelInput, options?: CallOptions): Promise<BaseMessageChunk>;
|
|
50
|
-
_streamResponseChunks(_messages: BaseMessage[], _options: this["ParsedCallOptions"], _runManager?: CallbackManagerForLLMRun): AsyncGenerator<ChatGenerationChunk>;
|
|
51
|
-
_streamIterator(input: BaseLanguageModelInput, options?: CallOptions): AsyncGenerator<BaseMessageChunk>;
|
|
52
|
-
/** @ignore */
|
|
53
|
-
_generateUncached(messages: BaseMessageLike[][], parsedOptions: this["ParsedCallOptions"], handledOptions: RunnableConfig): Promise<LLMResult>;
|
|
54
|
-
/**
|
|
55
|
-
* Generates chat based on the input messages.
|
|
56
|
-
* @param messages An array of arrays of BaseMessage instances.
|
|
57
|
-
* @param options The call options or an array of stop sequences.
|
|
58
|
-
* @param callbacks The callbacks for the language model.
|
|
59
|
-
* @returns A Promise that resolves to an LLMResult.
|
|
60
|
-
*/
|
|
61
|
-
generate(messages: BaseMessageLike[][], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<LLMResult>;
|
|
62
|
-
/**
|
|
63
|
-
* Get the parameters used to invoke the model
|
|
64
|
-
*/
|
|
65
|
-
invocationParams(_options?: this["ParsedCallOptions"]): any;
|
|
66
|
-
_modelType(): string;
|
|
67
|
-
abstract _llmType(): string;
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated
|
|
70
|
-
* Return a json-like object representing this LLM.
|
|
71
|
-
*/
|
|
72
|
-
serialize(): SerializedLLM;
|
|
73
|
-
/**
|
|
74
|
-
* Generates a prompt based on the input prompt values.
|
|
75
|
-
* @param promptValues An array of BasePromptValue instances.
|
|
76
|
-
* @param options The call options or an array of stop sequences.
|
|
77
|
-
* @param callbacks The callbacks for the language model.
|
|
78
|
-
* @returns A Promise that resolves to an LLMResult.
|
|
79
|
-
*/
|
|
80
|
-
generatePrompt(promptValues: BasePromptValue[], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<LLMResult>;
|
|
81
|
-
abstract _generate(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
|
82
|
-
/**
|
|
83
|
-
* Makes a single call to the chat model.
|
|
84
|
-
* @param messages An array of BaseMessage instances.
|
|
85
|
-
* @param options The call options or an array of stop sequences.
|
|
86
|
-
* @param callbacks The callbacks for the language model.
|
|
87
|
-
* @returns A Promise that resolves to a BaseMessage.
|
|
88
|
-
*/
|
|
89
|
-
call(messages: BaseMessageLike[], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<BaseMessage>;
|
|
90
|
-
/**
|
|
91
|
-
* Makes a single call to the chat model with a prompt value.
|
|
92
|
-
* @param promptValue The value of the prompt.
|
|
93
|
-
* @param options The call options or an array of stop sequences.
|
|
94
|
-
* @param callbacks The callbacks for the language model.
|
|
95
|
-
* @returns A Promise that resolves to a BaseMessage.
|
|
96
|
-
*/
|
|
97
|
-
callPrompt(promptValue: BasePromptValue, options?: string[] | CallOptions, callbacks?: Callbacks): Promise<BaseMessage>;
|
|
98
|
-
/**
|
|
99
|
-
* Predicts the next message based on the input messages.
|
|
100
|
-
* @param messages An array of BaseMessage instances.
|
|
101
|
-
* @param options The call options or an array of stop sequences.
|
|
102
|
-
* @param callbacks The callbacks for the language model.
|
|
103
|
-
* @returns A Promise that resolves to a BaseMessage.
|
|
104
|
-
*/
|
|
105
|
-
predictMessages(messages: BaseMessage[], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<BaseMessage>;
|
|
106
|
-
/**
|
|
107
|
-
* Predicts the next message based on a text input.
|
|
108
|
-
* @param text The text input.
|
|
109
|
-
* @param options The call options or an array of stop sequences.
|
|
110
|
-
* @param callbacks The callbacks for the language model.
|
|
111
|
-
* @returns A Promise that resolves to a string.
|
|
112
|
-
*/
|
|
113
|
-
predict(text: string, options?: string[] | CallOptions, callbacks?: Callbacks): Promise<string>;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* An abstract class that extends BaseChatModel and provides a simple
|
|
117
|
-
* implementation of _generate.
|
|
118
|
-
*/
|
|
119
|
-
export declare abstract class SimpleChatModel<CallOptions extends BaseChatModelCallOptions = BaseChatModelCallOptions> extends BaseChatModel<CallOptions> {
|
|
120
|
-
abstract _call(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<string>;
|
|
121
|
-
_generate(messages: BaseMessage[], options: this["ParsedCallOptions"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;
|
|
122
|
-
}
|
|
1
|
+
export * from "langchain-core/chat_model";
|