@langchain/xai 1.3.3 → 1.3.4
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/CHANGELOG.md +9 -0
- package/dist/chat_models/completions.cjs +9 -11
- package/dist/chat_models/completions.cjs.map +1 -1
- package/dist/chat_models/completions.d.cts.map +1 -1
- package/dist/chat_models/completions.d.ts.map +1 -1
- package/dist/chat_models/completions.js +4 -5
- package/dist/chat_models/completions.js.map +1 -1
- package/dist/chat_models/index.js +2 -0
- package/dist/chat_models/responses-types.d.cts +5 -12
- package/dist/chat_models/responses-types.d.cts.map +1 -1
- package/dist/chat_models/responses-types.d.ts +5 -12
- package/dist/chat_models/responses-types.d.ts.map +1 -1
- package/dist/chat_models/responses.cjs +9 -14
- package/dist/chat_models/responses.cjs.map +1 -1
- package/dist/chat_models/responses.d.cts +0 -1
- package/dist/chat_models/responses.d.cts.map +1 -1
- package/dist/chat_models/responses.d.ts +0 -1
- package/dist/chat_models/responses.d.ts.map +1 -1
- package/dist/chat_models/responses.js +5 -9
- package/dist/chat_models/responses.js.map +1 -1
- package/dist/converters/responses.cjs +15 -20
- package/dist/converters/responses.cjs.map +1 -1
- package/dist/converters/responses.js +6 -10
- package/dist/converters/responses.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/live_search.cjs +3 -3
- package/dist/live_search.cjs.map +1 -1
- package/dist/live_search.d.cts.map +1 -1
- package/dist/live_search.d.ts.map +1 -1
- package/dist/live_search.js +3 -3
- package/dist/live_search.js.map +1 -1
- package/dist/profiles.cjs +86 -59
- package/dist/profiles.cjs.map +1 -1
- package/dist/profiles.js +86 -59
- package/dist/profiles.js.map +1 -1
- package/dist/tools/code_execution.cjs.map +1 -1
- package/dist/tools/code_execution.d.cts.map +1 -1
- package/dist/tools/code_execution.d.ts.map +1 -1
- package/dist/tools/code_execution.js.map +1 -1
- package/dist/tools/collections_search.cjs.map +1 -1
- package/dist/tools/collections_search.d.cts.map +1 -1
- package/dist/tools/collections_search.d.ts.map +1 -1
- package/dist/tools/collections_search.js.map +1 -1
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.cts +1 -2
- package/dist/tools/index.d.cts.map +1 -1
- package/dist/tools/index.d.ts +1 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/live_search.cjs +1 -4
- package/dist/tools/live_search.cjs.map +1 -1
- package/dist/tools/live_search.d.cts +0 -1
- package/dist/tools/live_search.d.cts.map +1 -1
- package/dist/tools/live_search.d.ts +0 -1
- package/dist/tools/live_search.d.ts.map +1 -1
- package/dist/tools/live_search.js +1 -4
- package/dist/tools/live_search.js.map +1 -1
- package/dist/tools/web_search.cjs.map +1 -1
- package/dist/tools/web_search.d.cts.map +1 -1
- package/dist/tools/web_search.d.ts.map +1 -1
- package/dist/tools/web_search.js.map +1 -1
- package/dist/tools/x_search.cjs.map +1 -1
- package/dist/tools/x_search.d.cts.map +1 -1
- package/dist/tools/x_search.d.ts.map +1 -1
- package/dist/tools/x_search.js.map +1 -1
- package/package.json +6 -6
- package/dist/_virtual/rolldown_runtime.cjs +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x_search.js","names":[
|
|
1
|
+
{"version":3,"file":"x_search.js","names":[],"sources":["../../src/tools/x_search.ts"],"sourcesContent":["/**\n * xAI X Search tool type constant.\n */\nexport const XAI_X_SEARCH_TOOL_TYPE = \"x_search\";\n\n/**\n * xAI's built-in X (formerly Twitter) search tool interface.\n * Enables the model to perform keyword search, semantic search, user search,\n * and thread fetch on X.\n *\n * This tool is part of xAI's agentic tool calling API.\n */\nexport interface XAIXSearchTool {\n /**\n * The type of the tool. Must be \"x_search\".\n */\n type: typeof XAI_X_SEARCH_TOOL_TYPE;\n /**\n * X handles to exclusively include in the search (max 10).\n * Cannot be used together with `excluded_x_handles`.\n */\n allowed_x_handles?: string[];\n /**\n * X handles to exclude from the search (max 10).\n * Cannot be used together with `allowed_x_handles`.\n */\n excluded_x_handles?: string[];\n /**\n * Start date for search results (ISO-8601 format: \"YYYY-MM-DD\").\n * Only posts from this date onwards will be included.\n */\n from_date?: string;\n /**\n * End date for search results (ISO-8601 format: \"YYYY-MM-DD\").\n * Only posts up to this date will be included.\n */\n to_date?: string;\n /**\n * Whether to enable image understanding.\n * When enabled, the model can analyze images in X posts.\n */\n enable_image_understanding?: boolean;\n /**\n * Whether to enable video understanding.\n * When enabled, the model can analyze videos in X posts.\n */\n enable_video_understanding?: boolean;\n}\n\n/**\n * Options for the xAI X search tool (camelCase).\n * All fields are camel-cased for the TypeScript API and are mapped to the\n * corresponding snake_case fields in the API request.\n */\nexport interface XAIXSearchToolOptions {\n /**\n * X handles to exclusively include in the search (max 10).\n * Cannot be used together with `excludedXHandles`.\n *\n * @example [\"elonmusk\", \"xai\"]\n */\n allowedXHandles?: string[];\n /**\n * X handles to exclude from the search (max 10).\n * Cannot be used together with `allowedXHandles`.\n *\n * @example [\"spamaccount\"]\n */\n excludedXHandles?: string[];\n /**\n * Start date for search results (ISO-8601 format: \"YYYY-MM-DD\").\n * Only posts from this date onwards will be included.\n *\n * @example \"2024-01-01\"\n */\n fromDate?: string;\n /**\n * End date for search results (ISO-8601 format: \"YYYY-MM-DD\").\n * Only posts up to this date will be included.\n *\n * @example \"2024-12-31\"\n */\n toDate?: string;\n /**\n * Whether to enable image understanding.\n * When enabled, the model can analyze images in X posts.\n * Note: This increases token usage as images are processed.\n *\n * @default false\n */\n enableImageUnderstanding?: boolean;\n /**\n * Whether to enable video understanding.\n * When enabled, the model can analyze videos in X posts.\n * Note: This increases token usage as video content is processed.\n *\n * @default false\n */\n enableVideoUnderstanding?: boolean;\n}\n\n/**\n * Creates an xAI X search tool.\n * Enables the model to perform keyword search, semantic search, user search,\n * and thread fetch on X (formerly Twitter).\n *\n * This tool is executed server-side by the xAI API as part of the agentic\n * tool calling workflow.\n *\n * @param options - Configuration options for the X search tool\n * @returns An XAIXSearchTool object to pass to the model\n *\n * @example Basic usage\n * ```typescript\n * import { ChatXAIResponses, tools } from \"@langchain/xai\";\n *\n * const llm = new ChatXAIResponses({\n * model: \"grok-4-1-fast\",\n * });\n *\n * const xSearch = tools.xaiXSearch();\n * const result = await llm.invoke(\"What is the current status of xAI?\", {\n * tools: [xSearch],\n * });\n * ```\n *\n * @example With handle filtering\n * ```typescript\n * const xSearch = tools.xaiXSearch({\n * allowedXHandles: [\"elonmusk\", \"xai\"],\n * enableImageUnderstanding: true,\n * });\n * ```\n *\n * @example With date range\n * ```typescript\n * const xSearch = tools.xaiXSearch({\n * fromDate: \"2024-10-01\",\n * toDate: \"2024-10-31\",\n * enableVideoUnderstanding: true,\n * });\n * ```\n */\nexport function xaiXSearch(\n options: XAIXSearchToolOptions = {}\n): XAIXSearchTool {\n const tool: XAIXSearchTool = {\n type: XAI_X_SEARCH_TOOL_TYPE,\n };\n\n if (options.allowedXHandles !== undefined) {\n tool.allowed_x_handles = options.allowedXHandles;\n }\n\n if (options.excludedXHandles !== undefined) {\n tool.excluded_x_handles = options.excludedXHandles;\n }\n\n if (options.fromDate !== undefined) {\n tool.from_date = options.fromDate;\n }\n\n if (options.toDate !== undefined) {\n tool.to_date = options.toDate;\n }\n\n if (options.enableImageUnderstanding !== undefined) {\n tool.enable_image_understanding = options.enableImageUnderstanding;\n }\n\n if (options.enableVideoUnderstanding !== undefined) {\n tool.enable_video_understanding = options.enableVideoUnderstanding;\n }\n\n return tool;\n}\n"],"mappings":";;;;AAGA,MAAa,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4ItC,SAAgB,WACd,UAAiC,EAAE,EACnB;CAChB,MAAM,OAAuB,EAC3B,MAAM,wBACP;AAED,KAAI,QAAQ,oBAAoB,OAC9B,MAAK,oBAAoB,QAAQ;AAGnC,KAAI,QAAQ,qBAAqB,OAC/B,MAAK,qBAAqB,QAAQ;AAGpC,KAAI,QAAQ,aAAa,OACvB,MAAK,YAAY,QAAQ;AAG3B,KAAI,QAAQ,WAAW,OACrB,MAAK,UAAU,QAAQ;AAGzB,KAAI,QAAQ,6BAA6B,OACvC,MAAK,6BAA6B,QAAQ;AAG5C,KAAI,QAAQ,6BAA6B,OACvC,MAAK,6BAA6B,QAAQ;AAG5C,QAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/xai",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "xAI integration for LangChain.js",
|
|
5
5
|
"author": "LangChain",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-xai/",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@langchain/openai": "1.2.
|
|
17
|
+
"@langchain/openai": "1.2.8"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@langchain/core": "^1.0.0"
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"typescript": "~5.8.3",
|
|
31
31
|
"vitest": "^3.2.4",
|
|
32
32
|
"zod": "^3.25.76",
|
|
33
|
-
"@langchain/core": "^1.1.
|
|
33
|
+
"@langchain/core": "^1.1.25",
|
|
34
34
|
"@langchain/eslint": "0.1.1",
|
|
35
|
-
"@langchain/openai": "^1.2.
|
|
36
|
-
"@langchain/
|
|
37
|
-
"@langchain/
|
|
35
|
+
"@langchain/openai": "^1.2.8",
|
|
36
|
+
"@langchain/standard-tests": "0.0.23",
|
|
37
|
+
"@langchain/tsconfig": "0.0.1"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
|
|
25
|
-
exports.__toESM = __toESM;
|