
//#region src/tools/x_search.ts
/**
* xAI X Search tool type constant.
*/
const XAI_X_SEARCH_TOOL_TYPE = "x_search";
/**
* Creates an xAI X search tool.
* Enables the model to perform keyword search, semantic search, user search,
* and thread fetch on X (formerly Twitter).
*
* This tool is executed server-side by the xAI API as part of the agentic
* tool calling workflow.
*
* @param options - Configuration options for the X search tool
* @returns An XAIXSearchTool object to pass to the model
*
* @example Basic usage
* ```typescript
* import { ChatXAIResponses, tools } from "@langchain/xai";
*
* const llm = new ChatXAIResponses({
*   model: "grok-4-1-fast",
* });
*
* const xSearch = tools.xaiXSearch();
* const result = await llm.invoke("What is the current status of xAI?", {
*   tools: [xSearch],
* });
* ```
*
* @example With handle filtering
* ```typescript
* const xSearch = tools.xaiXSearch({
*   allowedXHandles: ["elonmusk", "xai"],
*   enableImageUnderstanding: true,
* });
* ```
*
* @example With date range
* ```typescript
* const xSearch = tools.xaiXSearch({
*   fromDate: "2024-10-01",
*   toDate: "2024-10-31",
*   enableVideoUnderstanding: true,
* });
* ```
*/
function xaiXSearch(options = {}) {
	const tool = { type: XAI_X_SEARCH_TOOL_TYPE };
	if (options.allowedXHandles !== void 0) tool.allowed_x_handles = options.allowedXHandles;
	if (options.excludedXHandles !== void 0) tool.excluded_x_handles = options.excludedXHandles;
	if (options.fromDate !== void 0) tool.from_date = options.fromDate;
	if (options.toDate !== void 0) tool.to_date = options.toDate;
	if (options.enableImageUnderstanding !== void 0) tool.enable_image_understanding = options.enableImageUnderstanding;
	if (options.enableVideoUnderstanding !== void 0) tool.enable_video_understanding = options.enableVideoUnderstanding;
	return tool;
}

//#endregion
exports.XAI_X_SEARCH_TOOL_TYPE = XAI_X_SEARCH_TOOL_TYPE;
exports.xaiXSearch = xaiXSearch;
//# sourceMappingURL=x_search.cjs.map