langchain 0.3.18 → 0.3.19

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.
@@ -20,6 +20,7 @@ const _SUPPORTED_PROVIDERS = [
20
20
  "bedrock",
21
21
  "cerebras",
22
22
  "deepseek",
23
+ "xai",
23
24
  ];
24
25
  async function _initChatModelHelper(model, modelProvider,
25
26
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -84,6 +85,10 @@ params = {}) {
84
85
  const { ChatDeepSeek } = await import("@langchain/deepseek");
85
86
  return new ChatDeepSeek({ model, ...passedParams });
86
87
  }
88
+ case "xai": {
89
+ const { ChatXAI } = await import("@langchain/xai");
90
+ return new ChatXAI({ model, ...passedParams });
91
+ }
87
92
  case "fireworks": {
88
93
  const { ChatFireworks } = await import(
89
94
  // We can not 'expect-error' because if you explicitly build `@langchain/community`
@@ -136,7 +141,8 @@ params = {}) {
136
141
  function _inferModelProvider(modelName) {
137
142
  if (modelName.startsWith("gpt-3") ||
138
143
  modelName.startsWith("gpt-4") ||
139
- modelName.startsWith("o1")) {
144
+ modelName.startsWith("o1") ||
145
+ modelName.startsWith("o3")) {
140
146
  return "openai";
141
147
  }
142
148
  else if (modelName.startsWith("claude")) {
@@ -402,6 +408,7 @@ class _ConfigurableModel extends chat_models_1.BaseChatModel {
402
408
  * - ollama (@langchain/ollama)
403
409
  * - cerebras (@langchain/cerebras)
404
410
  * - deepseek (@langchain/deepseek)
411
+ * - xai (@langchain/xai)
405
412
  * @param {string[] | "any"} [fields.configurableFields] - Which model parameters are configurable:
406
413
  * - undefined: No configurable fields.
407
414
  * - "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", "ollama", "together", "fireworks", "mistralai", "groq", "bedrock", "cerebras", "deepseek"];
12
+ declare const _SUPPORTED_PROVIDERS: readonly ["openai", "anthropic", "azure_openai", "cohere", "google-vertexai", "google-vertexai-web", "google-genai", "ollama", "together", "fireworks", "mistralai", "groq", "bedrock", "cerebras", "deepseek", "xai"];
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)[];
@@ -17,6 +17,7 @@ const _SUPPORTED_PROVIDERS = [
17
17
  "bedrock",
18
18
  "cerebras",
19
19
  "deepseek",
20
+ "xai",
20
21
  ];
21
22
  async function _initChatModelHelper(model, modelProvider,
22
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -81,6 +82,10 @@ params = {}) {
81
82
  const { ChatDeepSeek } = await import("@langchain/deepseek");
82
83
  return new ChatDeepSeek({ model, ...passedParams });
83
84
  }
85
+ case "xai": {
86
+ const { ChatXAI } = await import("@langchain/xai");
87
+ return new ChatXAI({ model, ...passedParams });
88
+ }
84
89
  case "fireworks": {
85
90
  const { ChatFireworks } = await import(
86
91
  // We can not 'expect-error' because if you explicitly build `@langchain/community`
@@ -133,7 +138,8 @@ params = {}) {
133
138
  export function _inferModelProvider(modelName) {
134
139
  if (modelName.startsWith("gpt-3") ||
135
140
  modelName.startsWith("gpt-4") ||
136
- modelName.startsWith("o1")) {
141
+ modelName.startsWith("o1") ||
142
+ modelName.startsWith("o3")) {
137
143
  return "openai";
138
144
  }
139
145
  else if (modelName.startsWith("claude")) {
@@ -398,6 +404,7 @@ class _ConfigurableModel extends BaseChatModel {
398
404
  * - ollama (@langchain/ollama)
399
405
  * - cerebras (@langchain/cerebras)
400
406
  * - deepseek (@langchain/deepseek)
407
+ * - xai (@langchain/xai)
401
408
  * @param {string[] | "any"} [fields.configurableFields] - Which model parameters are configurable:
402
409
  * - undefined: No configurable fields.
403
410
  * - "any": All fields are configurable. (See Security Note in description)