diff --git a/langchain/package.json b/langchain/package.json index 44db99b8422b..07688c91e306 100644 --- a/langchain/package.json +++ b/langchain/package.json @@ -420,6 +420,7 @@ "@langchain/cerebras": "*", "@langchain/cohere": "*", "@langchain/core": "workspace:*", + "@langchain/deepseek": "*", "@langchain/google-genai": "*", "@langchain/google-vertexai": "*", "@langchain/google-vertexai-web": "*", @@ -469,6 +470,7 @@ "@langchain/cerebras": "*", "@langchain/cohere": "*", "@langchain/core": ">=0.2.21 <0.4.0", + "@langchain/deepseek": "*", "@langchain/google-genai": "*", "@langchain/google-vertexai": "*", "@langchain/google-vertexai-web": "*", @@ -494,6 +496,9 @@ "@langchain/cohere": { "optional": true }, + "@langchain/deepseek": { + "optional": true + }, "@langchain/google-genai": { "optional": true }, diff --git a/langchain/src/chat_models/tests/universal.int.test.ts b/langchain/src/chat_models/tests/universal.int.test.ts index a6a10403858a..a4a6857e7126 100644 --- a/langchain/src/chat_models/tests/universal.int.test.ts +++ b/langchain/src/chat_models/tests/universal.int.test.ts @@ -436,6 +436,17 @@ describe("Works with all model providers", () => { expect(vertexAIWebResult).toBeDefined(); expect(vertexAIWebResult.content.length).toBeGreaterThan(0); }); + + it("Can invoke deepseek", async () => { + const deepSeek = await initChatModel("deepseek-chat", { + modelProvider: "deepseek", + temperature: 0, + }); + + const deepSeekResult = await deepSeek.invoke("what's your name"); + expect(deepSeekResult).toBeDefined(); + expect(deepSeekResult.content.length).toBeGreaterThan(0); + }); }); test("Is compatible with agents", async () => { diff --git a/langchain/src/chat_models/universal.ts b/langchain/src/chat_models/universal.ts index 9d184e4bb3c7..679fa427ea31 100644 --- a/langchain/src/chat_models/universal.ts +++ b/langchain/src/chat_models/universal.ts @@ -49,6 +49,8 @@ const _SUPPORTED_PROVIDERS = [ "mistralai", "groq", "bedrock", + "cerebras", + "deepseek", ] as const; export type ChatModelProvider = (typeof _SUPPORTED_PROVIDERS)[number]; @@ -130,6 +132,10 @@ async function _initChatModelHelper( const { ChatBedrockConverse } = await import("@langchain/aws"); return new ChatBedrockConverse({ model, ...passedParams }); } + case "deepseek": { + const { ChatDeepSeek } = await import("@langchain/deepseek"); + return new ChatDeepSeek({ model, ...passedParams }); + } case "fireworks": { const { ChatFireworks } = await import( // We can not 'expect-error' because if you explicitly build `@langchain/community` @@ -611,6 +617,7 @@ export async function initChatModel< * - groq (@langchain/groq) * - ollama (@langchain/ollama) * - cerebras (@langchain/cerebras) + * - deepseek (@langchain/deepseek) * @param {string[] | "any"} [fields.configurableFields] - Which model parameters are configurable: * - undefined: No configurable fields. * - "any": All fields are configurable. (See Security Note in description) diff --git a/yarn.lock b/yarn.lock index e6344eed352e..fefd13294652 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12465,7 +12465,7 @@ __metadata: languageName: unknown linkType: soft -"@langchain/deepseek@workspace:*, @langchain/deepseek@workspace:libs/langchain-deepseek": +"@langchain/deepseek@*, @langchain/deepseek@workspace:*, @langchain/deepseek@workspace:libs/langchain-deepseek": version: 0.0.0-use.local resolution: "@langchain/deepseek@workspace:libs/langchain-deepseek" dependencies: @@ -33477,6 +33477,7 @@ __metadata: "@langchain/cerebras": "*" "@langchain/cohere": "*" "@langchain/core": "workspace:*" + "@langchain/deepseek": "*" "@langchain/google-genai": "*" "@langchain/google-vertexai": "*" "@langchain/google-vertexai-web": "*" @@ -33537,6 +33538,7 @@ __metadata: "@langchain/cerebras": "*" "@langchain/cohere": "*" "@langchain/core": ">=0.2.21 <0.4.0" + "@langchain/deepseek": "*" "@langchain/google-genai": "*" "@langchain/google-vertexai": "*" "@langchain/google-vertexai-web": "*" @@ -33557,6 +33559,8 @@ __metadata: optional: true "@langchain/cohere": optional: true + "@langchain/deepseek": + optional: true "@langchain/google-genai": optional: true "@langchain/google-vertexai":