{"version":3,"file":"collections_search.cjs","names":[],"sources":["../../src/tools/collections_search.ts"],"sourcesContent":["/**\n * xAI Collections Search tool type constant.\n * Note: The Responses API uses \"file_search\" as the type name.\n */\nexport const XAI_COLLECTIONS_SEARCH_TOOL_TYPE = \"file_search\";\n\n/**\n * xAI's built-in collections search tool interface.\n * Enables the model to search through uploaded knowledge bases (collections)\n * to retrieve relevant information from your documents.\n *\n * This tool is part of xAI's agentic tool calling API and is particularly\n * powerful for:\n * - Document retrieval from uploaded files\n * - Semantic search across knowledge bases\n * - RAG (Retrieval-Augmented Generation) applications\n * - Enterprise knowledge base queries\n */\nexport interface XAICollectionsSearchTool {\n  /**\n   * The type of the tool. Must be \"file_search\".\n   */\n  type: typeof XAI_COLLECTIONS_SEARCH_TOOL_TYPE;\n  /**\n   * List of vector store (collection) IDs to search.\n   * These are the IDs of collections created via the xAI Collections API.\n   */\n  vector_store_ids?: string[];\n}\n\n/**\n * Options for the xAI collections 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 XAICollectionsSearchToolOptions {\n  /**\n   * List of vector store (collection) IDs to search.\n   * These are the IDs of collections created via the xAI Collections API.\n   *\n   * @example [\"collection_abc123\", \"collection_def456\"]\n   */\n  vectorStoreIds?: string[];\n}\n\n/**\n * Creates an xAI collections search tool.\n * Enables the model to search through your uploaded knowledge bases (collections)\n * to retrieve relevant information from your documents.\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 collections search tool\n * @returns An XAICollectionsSearchTool object to pass to the model\n *\n * @example Basic usage with collection IDs\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 collectionsSearch = tools.xaiCollectionsSearch({\n *   vectorStoreIds: [\"collection_abc123\"],\n * });\n *\n * const result = await llm.invoke(\n *   \"What are the key findings in the Q3 report?\",\n *   { tools: [collectionsSearch] }\n * );\n * ```\n *\n * @example Combining with other tools for hybrid analysis\n * ```typescript\n * const collectionsSearch = tools.xaiCollectionsSearch({\n *   vectorStoreIds: [\"collection_sec_filings\"],\n * });\n * const webSearch = tools.xaiWebSearch();\n * const codeExecution = tools.xaiCodeExecution();\n *\n * const result = await llm.invoke(\n *   \"Based on our internal SEC filings, what is the market sentiment on our performance?\",\n *   { tools: [collectionsSearch, webSearch, codeExecution] }\n * );\n * ```\n */\nexport function xaiCollectionsSearch(\n  options: XAICollectionsSearchToolOptions = {}\n): XAICollectionsSearchTool {\n  const tool: XAICollectionsSearchTool = {\n    type: XAI_COLLECTIONS_SEARCH_TOOL_TYPE,\n  };\n\n  if (options.vectorStoreIds !== undefined) {\n    tool.vector_store_ids = options.vectorStoreIds;\n  }\n\n  return tool;\n}\n"],"mappings":";;;;;AAIA,MAAa,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFhD,SAAgB,qBACd,UAA2C,EAAE,EACnB;CAC1B,MAAM,OAAiC,EACrC,MAAM,kCACP;AAED,KAAI,QAAQ,mBAAmB,KAAA,EAC7B,MAAK,mBAAmB,QAAQ;AAGlC,QAAO"}