langchain 0.3.13 → 0.3.15
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/chat_models/universal.cjs +7 -0
- package/dist/chat_models/universal.d.ts +1 -1
- package/dist/chat_models/universal.js +7 -0
- package/dist/hub/base.cjs +28 -5
- package/dist/hub/base.d.ts +1 -0
- package/dist/hub/base.js +26 -4
- package/dist/hub/index.cjs +1 -1
- package/dist/hub/index.js +2 -2
- package/dist/hub/node.cjs +1 -1
- package/dist/hub/node.js +2 -2
- package/package.json +6 -1
|
@@ -19,6 +19,8 @@ const _SUPPORTED_PROVIDERS = [
|
|
|
19
19
|
"mistralai",
|
|
20
20
|
"groq",
|
|
21
21
|
"bedrock",
|
|
22
|
+
"cerebras",
|
|
23
|
+
"deepseek",
|
|
22
24
|
];
|
|
23
25
|
async function _initChatModelHelper(model, modelProvider,
|
|
24
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -79,6 +81,10 @@ params = {}) {
|
|
|
79
81
|
const { ChatBedrockConverse } = await import("@langchain/aws");
|
|
80
82
|
return new ChatBedrockConverse({ model, ...passedParams });
|
|
81
83
|
}
|
|
84
|
+
case "deepseek": {
|
|
85
|
+
const { ChatDeepSeek } = await import("@langchain/deepseek");
|
|
86
|
+
return new ChatDeepSeek({ model, ...passedParams });
|
|
87
|
+
}
|
|
82
88
|
case "fireworks": {
|
|
83
89
|
const { ChatFireworks } = await import(
|
|
84
90
|
// We can not 'expect-error' because if you explicitly build `@langchain/community`
|
|
@@ -395,6 +401,7 @@ class _ConfigurableModel extends chat_models_1.BaseChatModel {
|
|
|
395
401
|
* - groq (@langchain/groq)
|
|
396
402
|
* - ollama (@langchain/ollama)
|
|
397
403
|
* - cerebras (@langchain/cerebras)
|
|
404
|
+
* - deepseek (@langchain/deepseek)
|
|
398
405
|
* @param {string[] | "any"} [fields.configurableFields] - Which model parameters are configurable:
|
|
399
406
|
* - undefined: No configurable fields.
|
|
400
407
|
* - "any": All fields are configurable. (See Security Note in description)
|
|
@@ -9,7 +9,7 @@ import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
|
|
|
9
9
|
import { ChatResult } from "@langchain/core/outputs";
|
|
10
10
|
interface EventStreamCallbackHandlerInput extends Omit<LogStreamCallbackHandlerInput, "_schemaFormat"> {
|
|
11
11
|
}
|
|
12
|
-
declare const _SUPPORTED_PROVIDERS: readonly ["openai", "anthropic", "azure_openai", "cohere", "google-vertexai", "google-vertexai-web", "google-genai", "google-genai", "ollama", "together", "fireworks", "mistralai", "groq", "bedrock"];
|
|
12
|
+
declare const _SUPPORTED_PROVIDERS: readonly ["openai", "anthropic", "azure_openai", "cohere", "google-vertexai", "google-vertexai-web", "google-genai", "google-genai", "ollama", "together", "fireworks", "mistralai", "groq", "bedrock", "cerebras", "deepseek"];
|
|
13
13
|
export type ChatModelProvider = (typeof _SUPPORTED_PROVIDERS)[number];
|
|
14
14
|
export interface ConfigurableChatModelCallOptions extends BaseChatModelCallOptions {
|
|
15
15
|
tools?: (StructuredToolInterface | Record<string, unknown> | ToolDefinition | RunnableToolLike)[];
|
|
@@ -16,6 +16,8 @@ const _SUPPORTED_PROVIDERS = [
|
|
|
16
16
|
"mistralai",
|
|
17
17
|
"groq",
|
|
18
18
|
"bedrock",
|
|
19
|
+
"cerebras",
|
|
20
|
+
"deepseek",
|
|
19
21
|
];
|
|
20
22
|
async function _initChatModelHelper(model, modelProvider,
|
|
21
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -76,6 +78,10 @@ params = {}) {
|
|
|
76
78
|
const { ChatBedrockConverse } = await import("@langchain/aws");
|
|
77
79
|
return new ChatBedrockConverse({ model, ...passedParams });
|
|
78
80
|
}
|
|
81
|
+
case "deepseek": {
|
|
82
|
+
const { ChatDeepSeek } = await import("@langchain/deepseek");
|
|
83
|
+
return new ChatDeepSeek({ model, ...passedParams });
|
|
84
|
+
}
|
|
79
85
|
case "fireworks": {
|
|
80
86
|
const { ChatFireworks } = await import(
|
|
81
87
|
// We can not 'expect-error' because if you explicitly build `@langchain/community`
|
|
@@ -391,6 +397,7 @@ class _ConfigurableModel extends BaseChatModel {
|
|
|
391
397
|
* - groq (@langchain/groq)
|
|
392
398
|
* - ollama (@langchain/ollama)
|
|
393
399
|
* - cerebras (@langchain/cerebras)
|
|
400
|
+
* - deepseek (@langchain/deepseek)
|
|
394
401
|
* @param {string[] | "any"} [fields.configurableFields] - Which model parameters are configurable:
|
|
395
402
|
* - undefined: No configurable fields.
|
|
396
403
|
* - "any": All fields are configurable. (See Security Note in description)
|
package/dist/hub/base.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateModelImportMap = exports.basePull = exports.basePush = void 0;
|
|
3
|
+
exports.generateOptionalImportMap = exports.generateModelImportMap = exports.basePull = exports.basePush = void 0;
|
|
4
4
|
const langsmith_1 = require("langsmith");
|
|
5
5
|
/**
|
|
6
6
|
* Push a prompt to the hub.
|
|
@@ -70,10 +70,6 @@ function generateModelImportMap(
|
|
|
70
70
|
modelClass) {
|
|
71
71
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
72
|
const modelImportMap = {};
|
|
73
|
-
// TODO: Fix in 0.4.0. We can't get lc_id without instantiating the class, so we
|
|
74
|
-
// must put them inline here. In the future, make this less hacky
|
|
75
|
-
// This should probably use dynamic imports and have a web-only entrypoint
|
|
76
|
-
// in a future breaking release
|
|
77
73
|
if (modelClass !== undefined) {
|
|
78
74
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
75
|
const modelLcName = modelClass?.lc_name();
|
|
@@ -113,3 +109,30 @@ modelClass) {
|
|
|
113
109
|
return modelImportMap;
|
|
114
110
|
}
|
|
115
111
|
exports.generateModelImportMap = generateModelImportMap;
|
|
112
|
+
function generateOptionalImportMap(
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
114
|
+
modelClass) {
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
116
|
+
const optionalImportMap = {};
|
|
117
|
+
if (modelClass !== undefined) {
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
119
|
+
const modelLcName = modelClass?.lc_name();
|
|
120
|
+
let optionalImportMapKey;
|
|
121
|
+
if (modelLcName === "ChatGoogleGenerativeAI") {
|
|
122
|
+
optionalImportMapKey = "langchain_google_genai/chat_models";
|
|
123
|
+
}
|
|
124
|
+
else if (modelLcName === "ChatBedrockConverse") {
|
|
125
|
+
optionalImportMapKey = "langchain_aws/chat_models";
|
|
126
|
+
}
|
|
127
|
+
else if (modelLcName === "ChatGroq") {
|
|
128
|
+
optionalImportMapKey = "langchain_groq/chat_models";
|
|
129
|
+
}
|
|
130
|
+
if (optionalImportMapKey !== undefined) {
|
|
131
|
+
optionalImportMap[optionalImportMapKey] = {
|
|
132
|
+
[modelLcName]: modelClass,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return optionalImportMap;
|
|
137
|
+
}
|
|
138
|
+
exports.generateOptionalImportMap = generateOptionalImportMap;
|
package/dist/hub/base.d.ts
CHANGED
|
@@ -27,3 +27,4 @@ export declare function basePull(ownerRepoCommit: string, options?: {
|
|
|
27
27
|
includeModel?: boolean;
|
|
28
28
|
}): Promise<import("langsmith/schemas").PromptCommit>;
|
|
29
29
|
export declare function generateModelImportMap(modelClass?: new (...args: any[]) => BaseLanguageModel): Record<string, any>;
|
|
30
|
+
export declare function generateOptionalImportMap(modelClass?: new (...args: any[]) => BaseLanguageModel): Record<string, any>;
|
package/dist/hub/base.js
CHANGED
|
@@ -65,10 +65,6 @@ export function generateModelImportMap(
|
|
|
65
65
|
modelClass) {
|
|
66
66
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
67
|
const modelImportMap = {};
|
|
68
|
-
// TODO: Fix in 0.4.0. We can't get lc_id without instantiating the class, so we
|
|
69
|
-
// must put them inline here. In the future, make this less hacky
|
|
70
|
-
// This should probably use dynamic imports and have a web-only entrypoint
|
|
71
|
-
// in a future breaking release
|
|
72
68
|
if (modelClass !== undefined) {
|
|
73
69
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
70
|
const modelLcName = modelClass?.lc_name();
|
|
@@ -107,3 +103,29 @@ modelClass) {
|
|
|
107
103
|
}
|
|
108
104
|
return modelImportMap;
|
|
109
105
|
}
|
|
106
|
+
export function generateOptionalImportMap(
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
|
+
modelClass) {
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
|
+
const optionalImportMap = {};
|
|
111
|
+
if (modelClass !== undefined) {
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
|
+
const modelLcName = modelClass?.lc_name();
|
|
114
|
+
let optionalImportMapKey;
|
|
115
|
+
if (modelLcName === "ChatGoogleGenerativeAI") {
|
|
116
|
+
optionalImportMapKey = "langchain_google_genai/chat_models";
|
|
117
|
+
}
|
|
118
|
+
else if (modelLcName === "ChatBedrockConverse") {
|
|
119
|
+
optionalImportMapKey = "langchain_aws/chat_models";
|
|
120
|
+
}
|
|
121
|
+
else if (modelLcName === "ChatGroq") {
|
|
122
|
+
optionalImportMapKey = "langchain_groq/chat_models";
|
|
123
|
+
}
|
|
124
|
+
if (optionalImportMapKey !== undefined) {
|
|
125
|
+
optionalImportMap[optionalImportMapKey] = {
|
|
126
|
+
[modelLcName]: modelClass,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return optionalImportMap;
|
|
131
|
+
}
|
package/dist/hub/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ Object.defineProperty(exports, "push", { enumerable: true, get: function () { re
|
|
|
23
23
|
async function pull(ownerRepoCommit, options) {
|
|
24
24
|
const promptObject = await (0, base_js_1.basePull)(ownerRepoCommit, options);
|
|
25
25
|
try {
|
|
26
|
-
const loadedPrompt = await (0, index_js_1.load)(JSON.stringify(promptObject.manifest), undefined,
|
|
26
|
+
const loadedPrompt = await (0, index_js_1.load)(JSON.stringify(promptObject.manifest), undefined, (0, base_js_1.generateOptionalImportMap)(options?.modelClass), (0, base_js_1.generateModelImportMap)(options?.modelClass));
|
|
27
27
|
return loadedPrompt;
|
|
28
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
29
|
}
|
package/dist/hub/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { load } from "../load/index.js";
|
|
2
|
-
import { basePush, basePull, generateModelImportMap } from "./base.js";
|
|
2
|
+
import { basePush, basePull, generateModelImportMap, generateOptionalImportMap, } from "./base.js";
|
|
3
3
|
export { basePush as push };
|
|
4
4
|
/**
|
|
5
5
|
* Pull a prompt from the hub.
|
|
@@ -20,7 +20,7 @@ export { basePush as push };
|
|
|
20
20
|
export async function pull(ownerRepoCommit, options) {
|
|
21
21
|
const promptObject = await basePull(ownerRepoCommit, options);
|
|
22
22
|
try {
|
|
23
|
-
const loadedPrompt = await load(JSON.stringify(promptObject.manifest), undefined,
|
|
23
|
+
const loadedPrompt = await load(JSON.stringify(promptObject.manifest), undefined, generateOptionalImportMap(options?.modelClass), generateModelImportMap(options?.modelClass));
|
|
24
24
|
return loadedPrompt;
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
26
|
}
|
package/dist/hub/node.cjs
CHANGED
|
@@ -47,7 +47,7 @@ async function pull(ownerRepoCommit, options) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
const loadedPrompt = await (0, index_js_1.load)(JSON.stringify(promptObject.manifest), undefined,
|
|
50
|
+
const loadedPrompt = await (0, index_js_1.load)(JSON.stringify(promptObject.manifest), undefined, (0, base_js_1.generateOptionalImportMap)(modelClass), (0, base_js_1.generateModelImportMap)(modelClass));
|
|
51
51
|
return loadedPrompt;
|
|
52
52
|
}
|
|
53
53
|
exports.pull = pull;
|
package/dist/hub/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { basePush, basePull, generateModelImportMap } from "./base.js";
|
|
1
|
+
import { basePush, basePull, generateModelImportMap, generateOptionalImportMap, } from "./base.js";
|
|
2
2
|
import { load } from "../load/index.js";
|
|
3
3
|
// TODO: Make this the default, add web entrypoint in next breaking release
|
|
4
4
|
export { basePush as push };
|
|
@@ -45,6 +45,6 @@ export async function pull(ownerRepoCommit, options) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
const loadedPrompt = await load(JSON.stringify(promptObject.manifest), undefined,
|
|
48
|
+
const loadedPrompt = await load(JSON.stringify(promptObject.manifest), undefined, generateOptionalImportMap(modelClass), generateModelImportMap(modelClass));
|
|
49
49
|
return loadedPrompt;
|
|
50
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.15",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -420,6 +420,7 @@
|
|
|
420
420
|
"@langchain/cerebras": "*",
|
|
421
421
|
"@langchain/cohere": "*",
|
|
422
422
|
"@langchain/core": "workspace:*",
|
|
423
|
+
"@langchain/deepseek": "*",
|
|
423
424
|
"@langchain/google-genai": "*",
|
|
424
425
|
"@langchain/google-vertexai": "*",
|
|
425
426
|
"@langchain/google-vertexai-web": "*",
|
|
@@ -469,6 +470,7 @@
|
|
|
469
470
|
"@langchain/cerebras": "*",
|
|
470
471
|
"@langchain/cohere": "*",
|
|
471
472
|
"@langchain/core": ">=0.2.21 <0.4.0",
|
|
473
|
+
"@langchain/deepseek": "*",
|
|
472
474
|
"@langchain/google-genai": "*",
|
|
473
475
|
"@langchain/google-vertexai": "*",
|
|
474
476
|
"@langchain/google-vertexai-web": "*",
|
|
@@ -494,6 +496,9 @@
|
|
|
494
496
|
"@langchain/cohere": {
|
|
495
497
|
"optional": true
|
|
496
498
|
},
|
|
499
|
+
"@langchain/deepseek": {
|
|
500
|
+
"optional": true
|
|
501
|
+
},
|
|
497
502
|
"@langchain/google-genai": {
|
|
498
503
|
"optional": true
|
|
499
504
|
},
|