@nocobase/plugin-ai 2.1.0-beta.24 → 2.1.0-beta.26
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/dist/ai/ai-employees/dara.js +1 -0
- package/dist/ai/tools/sub-agents/shared.js +3 -1
- package/dist/client/343.6f36d97dd122c5b6.js +10 -0
- package/dist/client/{559.133d286a0a0a1d93.js → 559.39872901b9053629.js} +1 -1
- package/dist/client/646.afa699c92cd556f3.js +10 -0
- package/dist/client/ai-employees/types.d.ts +2 -0
- package/dist/client/components/skill-settings.d.ts +2 -0
- package/dist/client/index.js +3 -3
- package/dist/client/llm-providers/mimo/ModelSettings.d.ts +10 -0
- package/dist/client/llm-providers/mimo/index.d.ts +10 -0
- package/dist/client/llm-providers/xai/ModelSettings.d.ts +10 -0
- package/dist/client/llm-providers/xai/index.d.ts +10 -0
- package/dist/collections/ai-employees.d.ts +7 -0
- package/dist/collections/ai-employees.js +13 -0
- package/dist/externalVersion.js +15 -15
- package/dist/locale/en-US.json +2 -0
- package/dist/locale/zh-CN.json +2 -0
- package/dist/node_modules/@langchain/xai/LICENSE +21 -0
- package/dist/node_modules/@langchain/xai/dist/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/completions.cjs +568 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/completions.d.cts +619 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/completions.d.ts +619 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/completions.js +566 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/index.cjs +2 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/index.d.ts +3 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/index.js +2 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses-types.d.cts +1178 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses-types.d.ts +1178 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses.cjs +233 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses.d.cts +70 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses.d.ts +70 -0
- package/dist/node_modules/@langchain/xai/dist/chat_models/responses.js +232 -0
- package/dist/node_modules/@langchain/xai/dist/converters/responses.cjs +168 -0
- package/dist/node_modules/@langchain/xai/dist/converters/responses.js +164 -0
- package/dist/node_modules/@langchain/xai/dist/index.cjs +7 -0
- package/dist/node_modules/@langchain/xai/dist/index.d.cts +5 -0
- package/dist/node_modules/@langchain/xai/dist/index.d.ts +6 -0
- package/dist/node_modules/@langchain/xai/dist/index.js +6 -0
- package/dist/node_modules/@langchain/xai/dist/live_search.cjs +54 -0
- package/dist/node_modules/@langchain/xai/dist/live_search.d.cts +145 -0
- package/dist/node_modules/@langchain/xai/dist/live_search.d.ts +145 -0
- package/dist/node_modules/@langchain/xai/dist/live_search.js +51 -0
- package/dist/node_modules/@langchain/xai/dist/profiles.cjs +289 -0
- package/dist/node_modules/@langchain/xai/dist/profiles.js +288 -0
- package/dist/node_modules/@langchain/xai/dist/tools/code_execution.cjs +52 -0
- package/dist/node_modules/@langchain/xai/dist/tools/code_execution.d.cts +64 -0
- package/dist/node_modules/@langchain/xai/dist/tools/code_execution.d.ts +64 -0
- package/dist/node_modules/@langchain/xai/dist/tools/code_execution.js +50 -0
- package/dist/node_modules/@langchain/xai/dist/tools/collections_search.cjs +60 -0
- package/dist/node_modules/@langchain/xai/dist/tools/collections_search.d.cts +90 -0
- package/dist/node_modules/@langchain/xai/dist/tools/collections_search.d.ts +90 -0
- package/dist/node_modules/@langchain/xai/dist/tools/collections_search.js +58 -0
- package/dist/node_modules/@langchain/xai/dist/tools/index.cjs +18 -0
- package/dist/node_modules/@langchain/xai/dist/tools/index.d.cts +18 -0
- package/dist/node_modules/@langchain/xai/dist/tools/index.d.ts +18 -0
- package/dist/node_modules/@langchain/xai/dist/tools/index.js +18 -0
- package/dist/node_modules/@langchain/xai/dist/tools/live_search.cjs +94 -0
- package/dist/node_modules/@langchain/xai/dist/tools/live_search.d.cts +149 -0
- package/dist/node_modules/@langchain/xai/dist/tools/live_search.d.ts +149 -0
- package/dist/node_modules/@langchain/xai/dist/tools/live_search.js +91 -0
- package/dist/node_modules/@langchain/xai/dist/tools/web_search.cjs +57 -0
- package/dist/node_modules/@langchain/xai/dist/tools/web_search.d.cts +104 -0
- package/dist/node_modules/@langchain/xai/dist/tools/web_search.d.ts +104 -0
- package/dist/node_modules/@langchain/xai/dist/tools/web_search.js +55 -0
- package/dist/node_modules/@langchain/xai/dist/tools/x_search.cjs +63 -0
- package/dist/node_modules/@langchain/xai/dist/tools/x_search.d.cts +145 -0
- package/dist/node_modules/@langchain/xai/dist/tools/x_search.d.ts +145 -0
- package/dist/node_modules/@langchain/xai/dist/tools/x_search.js +61 -0
- package/dist/node_modules/@langchain/xai/package.json +1 -0
- package/dist/node_modules/fast-glob/package.json +1 -1
- package/dist/node_modules/flexsearch/package.json +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/jsonrepair/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/ai-employees/ai-employee.js +20 -10
- package/dist/server/llm-providers/common/reasoning.js +2 -4
- package/dist/server/llm-providers/mimo.d.ts +37 -0
- package/dist/server/llm-providers/mimo.js +156 -0
- package/dist/server/llm-providers/xai.d.ts +17 -0
- package/dist/server/llm-providers/xai.js +88 -0
- package/dist/server/migrations/20260428175558-update-ai-employee-category.d.ts +14 -0
- package/dist/server/migrations/20260428175558-update-ai-employee-category.js +55 -0
- package/dist/server/migrations/20260429175132-ai-employee-deprecated-orin.d.ts +14 -0
- package/dist/server/migrations/20260429175132-ai-employee-deprecated-orin.js +53 -0
- package/dist/server/plugin.js +5 -0
- package/dist/server/resource/aiEmployees.js +10 -1
- package/dist/server/workflow/nodes/employee/files.js +7 -4
- package/dist/server/workflow/nodes/employee/index.js +136 -132
- package/dist/server/workflow/nodes/employee/types.d.ts +1 -1
- package/package.json +3 -2
- package/dist/client/343.83f7d96664e4e038.js +0 -10
- package/dist/client/646.cba98d80e9e6ea74.js +0 -10
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ChatXAI, ChatXAICallOptions, ChatXAICompletionsInvocationParams, ChatXAIInput, OpenAIToolChoice, XAIAdditionalKwargs, XAIBuiltInTool, XAIResponseMetadata, isXAIBuiltInTool } from "./chat_models/completions.cjs";
|
|
2
|
+
import { ChatXAIResponsesCallOptions, ChatXAIResponsesInput, ChatXAIResponsesInvocationParams, XAIResponse, XAIResponsesAnnotation, XAIResponsesCodeInterpreterResult, XAIResponsesCodeInterpreterTool, XAIResponsesCodeInterpreterToolCall, XAIResponsesCreateParams, XAIResponsesCreateParamsNonStreaming, XAIResponsesCreateParamsStreaming, XAIResponsesDebugOutput, XAIResponsesFileCitationAnnotation, XAIResponsesFileSearchResult, XAIResponsesFileSearchTool, XAIResponsesFunctionTool, XAIResponsesFunctionToolCall, XAIResponsesFunctionToolFunction, XAIResponsesFunctionToolOutput, XAIResponsesInclude, XAIResponsesIncompleteDetails, XAIResponsesIncompleteReason, XAIResponsesInput, XAIResponsesInputContentItem, XAIResponsesInputFileItem, XAIResponsesInputImageItem, XAIResponsesInputItem, XAIResponsesInputTextItem, XAIResponsesLogprobContent, XAIResponsesLogprobToken, XAIResponsesLogprobs, XAIResponsesMcpTool, XAIResponsesMcpToolCall, XAIResponsesMessage, XAIResponsesMessageRole, XAIResponsesObjectType, XAIResponsesOutputCodeInterpreterCall, XAIResponsesOutputContent, XAIResponsesOutputFileSearchCall, XAIResponsesOutputFunctionCall, XAIResponsesOutputItem, XAIResponsesOutputMcpCall, XAIResponsesOutputReasoning, XAIResponsesOutputRefusalContent, XAIResponsesOutputTextContent, XAIResponsesOutputTextItem, XAIResponsesOutputWebSearchCall, XAIResponsesPreviousResponse, XAIResponsesReasoning, XAIResponsesReasoningEffort, XAIResponsesReasoningResponse, XAIResponsesReasoningSummary, XAIResponsesReasoningSummaryItem, XAIResponsesSearchMode, XAIResponsesSearchParameters, XAIResponsesSearchSource, XAIResponsesSearchSourceRss, XAIResponsesSearchSourceWeb, XAIResponsesSearchSourceX, XAIResponsesStatus, XAIResponsesStreamEvent, XAIResponsesStreamEventBase, XAIResponsesStreamEventCompleted, XAIResponsesStreamEventContentPartAdded, XAIResponsesStreamEventContentPartDone, XAIResponsesStreamEventCreated, XAIResponsesStreamEventError, XAIResponsesStreamEventFailed, XAIResponsesStreamEventFunctionCallArgumentsDelta, XAIResponsesStreamEventFunctionCallArgumentsDone, XAIResponsesStreamEventInProgress, XAIResponsesStreamEventIncomplete, XAIResponsesStreamEventOutputItemAdded, XAIResponsesStreamEventOutputItemDone, XAIResponsesStreamEventReasoningSummaryTextDelta, XAIResponsesStreamEventReasoningSummaryTextDone, XAIResponsesStreamEventTextDelta, XAIResponsesStreamEventTextDone, XAIResponsesText, XAIResponsesTextFormat, XAIResponsesTextFormatJsonObject, XAIResponsesTextFormatJsonSchema, XAIResponsesTextFormatText, XAIResponsesTool, XAIResponsesToolCall, XAIResponsesToolChoice, XAIResponsesToolChoiceFunction, XAIResponsesToolChoiceString, XAIResponsesToolOutput, XAIResponsesUrlCitationAnnotation, XAIResponsesUsage, XAIResponsesWebSearchTool, XAIResponsesWebSearchToolCall, XAIResponsesXSearchTool } from "./chat_models/responses-types.cjs";
|
|
3
|
+
import { ChatXAIResponses } from "./chat_models/responses.cjs";
|
|
4
|
+
import { tools } from "./tools/index.cjs";
|
|
5
|
+
export { ChatXAI, ChatXAICallOptions, ChatXAICompletionsInvocationParams, ChatXAIInput, ChatXAIResponses, ChatXAIResponsesCallOptions, ChatXAIResponsesInput, ChatXAIResponsesInvocationParams, OpenAIToolChoice, XAIAdditionalKwargs, XAIBuiltInTool, XAIResponse, XAIResponseMetadata, XAIResponsesAnnotation, XAIResponsesCodeInterpreterResult, XAIResponsesCodeInterpreterTool, XAIResponsesCodeInterpreterToolCall, XAIResponsesCreateParams, XAIResponsesCreateParamsNonStreaming, XAIResponsesCreateParamsStreaming, XAIResponsesDebugOutput, XAIResponsesFileCitationAnnotation, XAIResponsesFileSearchResult, XAIResponsesFileSearchTool, XAIResponsesFunctionTool, XAIResponsesFunctionToolCall, XAIResponsesFunctionToolFunction, XAIResponsesFunctionToolOutput, XAIResponsesInclude, XAIResponsesIncompleteDetails, XAIResponsesIncompleteReason, XAIResponsesInput, XAIResponsesInputContentItem, XAIResponsesInputFileItem, XAIResponsesInputImageItem, XAIResponsesInputItem, XAIResponsesInputTextItem, XAIResponsesLogprobContent, XAIResponsesLogprobToken, XAIResponsesLogprobs, XAIResponsesMcpTool, XAIResponsesMcpToolCall, XAIResponsesMessage, XAIResponsesMessageRole, XAIResponsesObjectType, XAIResponsesOutputCodeInterpreterCall, XAIResponsesOutputContent, XAIResponsesOutputFileSearchCall, XAIResponsesOutputFunctionCall, XAIResponsesOutputItem, XAIResponsesOutputMcpCall, XAIResponsesOutputReasoning, XAIResponsesOutputRefusalContent, XAIResponsesOutputTextContent, XAIResponsesOutputTextItem, XAIResponsesOutputWebSearchCall, XAIResponsesPreviousResponse, XAIResponsesReasoning, XAIResponsesReasoningEffort, XAIResponsesReasoningResponse, XAIResponsesReasoningSummary, XAIResponsesReasoningSummaryItem, XAIResponsesSearchMode, XAIResponsesSearchParameters, XAIResponsesSearchSource, XAIResponsesSearchSourceRss, XAIResponsesSearchSourceWeb, XAIResponsesSearchSourceX, XAIResponsesStatus, XAIResponsesStreamEvent, XAIResponsesStreamEventBase, XAIResponsesStreamEventCompleted, XAIResponsesStreamEventContentPartAdded, XAIResponsesStreamEventContentPartDone, XAIResponsesStreamEventCreated, XAIResponsesStreamEventError, XAIResponsesStreamEventFailed, XAIResponsesStreamEventFunctionCallArgumentsDelta, XAIResponsesStreamEventFunctionCallArgumentsDone, XAIResponsesStreamEventInProgress, XAIResponsesStreamEventIncomplete, XAIResponsesStreamEventOutputItemAdded, XAIResponsesStreamEventOutputItemDone, XAIResponsesStreamEventReasoningSummaryTextDelta, XAIResponsesStreamEventReasoningSummaryTextDone, XAIResponsesStreamEventTextDelta, XAIResponsesStreamEventTextDone, XAIResponsesText, XAIResponsesTextFormat, XAIResponsesTextFormatJsonObject, XAIResponsesTextFormatJsonSchema, XAIResponsesTextFormatText, XAIResponsesTool, XAIResponsesToolCall, XAIResponsesToolChoice, XAIResponsesToolChoiceFunction, XAIResponsesToolChoiceString, XAIResponsesToolOutput, XAIResponsesUrlCitationAnnotation, XAIResponsesUsage, XAIResponsesWebSearchTool, XAIResponsesWebSearchToolCall, XAIResponsesXSearchTool, isXAIBuiltInTool, tools };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChatXAI, ChatXAICallOptions, ChatXAICompletionsInvocationParams, ChatXAIInput, OpenAIToolChoice, XAIAdditionalKwargs, XAIBuiltInTool, XAIResponseMetadata, isXAIBuiltInTool } from "./chat_models/completions.js";
|
|
2
|
+
import { ChatXAIResponsesCallOptions, ChatXAIResponsesInput, ChatXAIResponsesInvocationParams, XAIResponse, XAIResponsesAnnotation, XAIResponsesCodeInterpreterResult, XAIResponsesCodeInterpreterTool, XAIResponsesCodeInterpreterToolCall, XAIResponsesCreateParams, XAIResponsesCreateParamsNonStreaming, XAIResponsesCreateParamsStreaming, XAIResponsesDebugOutput, XAIResponsesFileCitationAnnotation, XAIResponsesFileSearchResult, XAIResponsesFileSearchTool, XAIResponsesFunctionTool, XAIResponsesFunctionToolCall, XAIResponsesFunctionToolFunction, XAIResponsesFunctionToolOutput, XAIResponsesInclude, XAIResponsesIncompleteDetails, XAIResponsesIncompleteReason, XAIResponsesInput, XAIResponsesInputContentItem, XAIResponsesInputFileItem, XAIResponsesInputImageItem, XAIResponsesInputItem, XAIResponsesInputTextItem, XAIResponsesLogprobContent, XAIResponsesLogprobToken, XAIResponsesLogprobs, XAIResponsesMcpTool, XAIResponsesMcpToolCall, XAIResponsesMessage, XAIResponsesMessageRole, XAIResponsesObjectType, XAIResponsesOutputCodeInterpreterCall, XAIResponsesOutputContent, XAIResponsesOutputFileSearchCall, XAIResponsesOutputFunctionCall, XAIResponsesOutputItem, XAIResponsesOutputMcpCall, XAIResponsesOutputReasoning, XAIResponsesOutputRefusalContent, XAIResponsesOutputTextContent, XAIResponsesOutputTextItem, XAIResponsesOutputWebSearchCall, XAIResponsesPreviousResponse, XAIResponsesReasoning, XAIResponsesReasoningEffort, XAIResponsesReasoningResponse, XAIResponsesReasoningSummary, XAIResponsesReasoningSummaryItem, XAIResponsesSearchMode, XAIResponsesSearchParameters, XAIResponsesSearchSource, XAIResponsesSearchSourceRss, XAIResponsesSearchSourceWeb, XAIResponsesSearchSourceX, XAIResponsesStatus, XAIResponsesStreamEvent, XAIResponsesStreamEventBase, XAIResponsesStreamEventCompleted, XAIResponsesStreamEventContentPartAdded, XAIResponsesStreamEventContentPartDone, XAIResponsesStreamEventCreated, XAIResponsesStreamEventError, XAIResponsesStreamEventFailed, XAIResponsesStreamEventFunctionCallArgumentsDelta, XAIResponsesStreamEventFunctionCallArgumentsDone, XAIResponsesStreamEventInProgress, XAIResponsesStreamEventIncomplete, XAIResponsesStreamEventOutputItemAdded, XAIResponsesStreamEventOutputItemDone, XAIResponsesStreamEventReasoningSummaryTextDelta, XAIResponsesStreamEventReasoningSummaryTextDone, XAIResponsesStreamEventTextDelta, XAIResponsesStreamEventTextDone, XAIResponsesText, XAIResponsesTextFormat, XAIResponsesTextFormatJsonObject, XAIResponsesTextFormatJsonSchema, XAIResponsesTextFormatText, XAIResponsesTool, XAIResponsesToolCall, XAIResponsesToolChoice, XAIResponsesToolChoiceFunction, XAIResponsesToolChoiceString, XAIResponsesToolOutput, XAIResponsesUrlCitationAnnotation, XAIResponsesUsage, XAIResponsesWebSearchTool, XAIResponsesWebSearchToolCall, XAIResponsesXSearchTool } from "./chat_models/responses-types.js";
|
|
3
|
+
import { ChatXAIResponses } from "./chat_models/responses.js";
|
|
4
|
+
import "./chat_models/index.js";
|
|
5
|
+
import { tools } from "./tools/index.js";
|
|
6
|
+
export { ChatXAI, ChatXAICallOptions, ChatXAICompletionsInvocationParams, ChatXAIInput, ChatXAIResponses, ChatXAIResponsesCallOptions, ChatXAIResponsesInput, ChatXAIResponsesInvocationParams, OpenAIToolChoice, XAIAdditionalKwargs, XAIBuiltInTool, XAIResponse, XAIResponseMetadata, XAIResponsesAnnotation, XAIResponsesCodeInterpreterResult, XAIResponsesCodeInterpreterTool, XAIResponsesCodeInterpreterToolCall, XAIResponsesCreateParams, XAIResponsesCreateParamsNonStreaming, XAIResponsesCreateParamsStreaming, XAIResponsesDebugOutput, XAIResponsesFileCitationAnnotation, XAIResponsesFileSearchResult, XAIResponsesFileSearchTool, XAIResponsesFunctionTool, XAIResponsesFunctionToolCall, XAIResponsesFunctionToolFunction, XAIResponsesFunctionToolOutput, XAIResponsesInclude, XAIResponsesIncompleteDetails, XAIResponsesIncompleteReason, XAIResponsesInput, XAIResponsesInputContentItem, XAIResponsesInputFileItem, XAIResponsesInputImageItem, XAIResponsesInputItem, XAIResponsesInputTextItem, XAIResponsesLogprobContent, XAIResponsesLogprobToken, XAIResponsesLogprobs, XAIResponsesMcpTool, XAIResponsesMcpToolCall, XAIResponsesMessage, XAIResponsesMessageRole, XAIResponsesObjectType, XAIResponsesOutputCodeInterpreterCall, XAIResponsesOutputContent, XAIResponsesOutputFileSearchCall, XAIResponsesOutputFunctionCall, XAIResponsesOutputItem, XAIResponsesOutputMcpCall, XAIResponsesOutputReasoning, XAIResponsesOutputRefusalContent, XAIResponsesOutputTextContent, XAIResponsesOutputTextItem, XAIResponsesOutputWebSearchCall, XAIResponsesPreviousResponse, XAIResponsesReasoning, XAIResponsesReasoningEffort, XAIResponsesReasoningResponse, XAIResponsesReasoningSummary, XAIResponsesReasoningSummaryItem, XAIResponsesSearchMode, XAIResponsesSearchParameters, XAIResponsesSearchSource, XAIResponsesSearchSourceRss, XAIResponsesSearchSourceWeb, XAIResponsesSearchSourceX, XAIResponsesStatus, XAIResponsesStreamEvent, XAIResponsesStreamEventBase, XAIResponsesStreamEventCompleted, XAIResponsesStreamEventContentPartAdded, XAIResponsesStreamEventContentPartDone, XAIResponsesStreamEventCreated, XAIResponsesStreamEventError, XAIResponsesStreamEventFailed, XAIResponsesStreamEventFunctionCallArgumentsDelta, XAIResponsesStreamEventFunctionCallArgumentsDone, XAIResponsesStreamEventInProgress, XAIResponsesStreamEventIncomplete, XAIResponsesStreamEventOutputItemAdded, XAIResponsesStreamEventOutputItemDone, XAIResponsesStreamEventReasoningSummaryTextDelta, XAIResponsesStreamEventReasoningSummaryTextDone, XAIResponsesStreamEventTextDelta, XAIResponsesStreamEventTextDone, XAIResponsesText, XAIResponsesTextFormat, XAIResponsesTextFormatJsonObject, XAIResponsesTextFormatJsonSchema, XAIResponsesTextFormatText, XAIResponsesTool, XAIResponsesToolCall, XAIResponsesToolChoice, XAIResponsesToolChoiceFunction, XAIResponsesToolChoiceString, XAIResponsesToolOutput, XAIResponsesUrlCitationAnnotation, XAIResponsesUsage, XAIResponsesWebSearchTool, XAIResponsesWebSearchToolCall, XAIResponsesXSearchTool, isXAIBuiltInTool, tools };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChatXAI, isXAIBuiltInTool } from "./chat_models/completions.js";
|
|
2
|
+
import { ChatXAIResponses } from "./chat_models/responses.js";
|
|
3
|
+
import "./chat_models/index.js";
|
|
4
|
+
import { tools } from "./tools/index.js";
|
|
5
|
+
|
|
6
|
+
export { ChatXAI, ChatXAIResponses, isXAIBuiltInTool, tools };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/live_search.ts
|
|
3
|
+
/**
|
|
4
|
+
* Merge search parameters from instance defaults, tool definition
|
|
5
|
+
* and per-call overrides.
|
|
6
|
+
*
|
|
7
|
+
* Precedence (lowest → highest):
|
|
8
|
+
* 1. tool-level configuration (e.g. from xaiLiveSearch)
|
|
9
|
+
* 2. instance-level defaults
|
|
10
|
+
* 3. per-call overrides passed via `searchParameters`
|
|
11
|
+
*/
|
|
12
|
+
function mergeSearchParams(instanceParams, callParams, toolParams) {
|
|
13
|
+
if (!instanceParams && !callParams && !toolParams) return void 0;
|
|
14
|
+
return {
|
|
15
|
+
...toolParams ?? {},
|
|
16
|
+
...instanceParams ?? {},
|
|
17
|
+
...callParams ?? {}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build the `search_parameters` payload to send to the xAI API
|
|
22
|
+
* from high-level `XAISearchParameters`.
|
|
23
|
+
*/
|
|
24
|
+
function buildSearchParametersPayload(params) {
|
|
25
|
+
if (!params) return void 0;
|
|
26
|
+
const payload = { mode: params.mode ?? "auto" };
|
|
27
|
+
if (params.max_search_results !== void 0) payload.max_search_results = params.max_search_results;
|
|
28
|
+
if (params.from_date !== void 0) payload.from_date = params.from_date;
|
|
29
|
+
if (params.to_date !== void 0) payload.to_date = params.to_date;
|
|
30
|
+
if (params.return_citations !== void 0) payload.return_citations = params.return_citations;
|
|
31
|
+
if (params.sources && params.sources.length > 0) payload.sources = params.sources;
|
|
32
|
+
return payload;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Filter out xAI built-in tools (like `live_search`) from a tools array.
|
|
36
|
+
* Used before sending the request to the xAI API, since built-in tools
|
|
37
|
+
* are controlled via `search_parameters` instead.
|
|
38
|
+
*/
|
|
39
|
+
function filterXAIBuiltInTools(payload) {
|
|
40
|
+
if (!payload?.tools) return void 0;
|
|
41
|
+
const filtered = payload.tools.filter((tool) => {
|
|
42
|
+
if (tool == null || typeof tool !== "object") return true;
|
|
43
|
+
if (!("type" in tool)) return true;
|
|
44
|
+
if (!payload?.excludedTypes?.length) return true;
|
|
45
|
+
return !payload.excludedTypes.includes(tool.type);
|
|
46
|
+
});
|
|
47
|
+
return filtered.length > 0 ? filtered : void 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.buildSearchParametersPayload = buildSearchParametersPayload;
|
|
52
|
+
exports.filterXAIBuiltInTools = filterXAIBuiltInTools;
|
|
53
|
+
exports.mergeSearchParams = mergeSearchParams;
|
|
54
|
+
//# sourceMappingURL=live_search.cjs.map
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
//#region src/live_search.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Web search source configuration for xAI Live Search.
|
|
4
|
+
* Corresponds to a `{"type": "web", ...}` entry in `search_parameters.sources`.
|
|
5
|
+
*/
|
|
6
|
+
interface XAIWebSource {
|
|
7
|
+
type: "web";
|
|
8
|
+
/**
|
|
9
|
+
* Optional ISO alpha-2 country code used to bias results
|
|
10
|
+
* towards a specific country/region.
|
|
11
|
+
*/
|
|
12
|
+
country?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Websites that should be excluded from the search results.
|
|
15
|
+
* Maximum of 5 entries.
|
|
16
|
+
*/
|
|
17
|
+
excluded_websites?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Websites that should be exclusively included in the search results.
|
|
20
|
+
* Maximum of 5 entries.
|
|
21
|
+
*/
|
|
22
|
+
allowed_websites?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Whether to enable safe search filtering for this source.
|
|
25
|
+
*/
|
|
26
|
+
safe_search?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* News search source configuration for xAI Live Search.
|
|
30
|
+
* Corresponds to a `{"type": "news", ...}` entry in `search_parameters.sources`.
|
|
31
|
+
*/
|
|
32
|
+
interface XAINewsSource {
|
|
33
|
+
type: "news";
|
|
34
|
+
/**
|
|
35
|
+
* Optional ISO alpha-2 country code used to bias results
|
|
36
|
+
* towards a specific country/region.
|
|
37
|
+
*/
|
|
38
|
+
country?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Websites that should be excluded from the search results.
|
|
41
|
+
* Maximum of 5 entries.
|
|
42
|
+
*/
|
|
43
|
+
excluded_websites?: string[];
|
|
44
|
+
/**
|
|
45
|
+
* Whether to enable safe search filtering for this source.
|
|
46
|
+
*/
|
|
47
|
+
safe_search?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* X (formerly Twitter) search source configuration for xAI Live Search.
|
|
51
|
+
* Corresponds to a `{"type": "x", ...}` entry in `search_parameters.sources`.
|
|
52
|
+
*/
|
|
53
|
+
interface XAIXSource {
|
|
54
|
+
type: "x";
|
|
55
|
+
/**
|
|
56
|
+
* X handles that should be explicitly included in the search.
|
|
57
|
+
* Maximum of 10 entries.
|
|
58
|
+
*/
|
|
59
|
+
included_x_handles?: string[];
|
|
60
|
+
/**
|
|
61
|
+
* X handles that should be excluded from the search.
|
|
62
|
+
* Maximum of 10 entries.
|
|
63
|
+
*/
|
|
64
|
+
excluded_x_handles?: string[];
|
|
65
|
+
/**
|
|
66
|
+
* Minimum number of favorites a post must have to be included.
|
|
67
|
+
*/
|
|
68
|
+
post_favorite_count?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Minimum number of views a post must have to be included.
|
|
71
|
+
*/
|
|
72
|
+
post_view_count?: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* RSS feed search source configuration for xAI Live Search.
|
|
76
|
+
* Corresponds to a `{"type": "rss", ...}` entry in `search_parameters.sources`.
|
|
77
|
+
*/
|
|
78
|
+
interface XAIRssSource {
|
|
79
|
+
type: "rss";
|
|
80
|
+
/**
|
|
81
|
+
* Links to RSS feeds to be used as a data source.
|
|
82
|
+
* The API currently expects a single URL.
|
|
83
|
+
*/
|
|
84
|
+
links: string[];
|
|
85
|
+
}
|
|
86
|
+
type XAISearchSource = XAIWebSource | XAINewsSource | XAIXSource | XAIRssSource;
|
|
87
|
+
/**
|
|
88
|
+
* Search parameters for xAI's Live Search API.
|
|
89
|
+
* Controls how the model searches for and retrieves real-time information.
|
|
90
|
+
*
|
|
91
|
+
* @note The Live Search API is being deprecated by xAI in favor of
|
|
92
|
+
* the agentic tool calling approach. Consider using `tools: [{ type: "live_search" }]`
|
|
93
|
+
* for future compatibility.
|
|
94
|
+
*/
|
|
95
|
+
interface XAISearchParameters {
|
|
96
|
+
/**
|
|
97
|
+
* Controls when the model should perform a search.
|
|
98
|
+
* - "auto": Let the model decide when to search (default)
|
|
99
|
+
* - "on": Always search for every request
|
|
100
|
+
* - "off": Never search
|
|
101
|
+
*/
|
|
102
|
+
mode?: "auto" | "on" | "off";
|
|
103
|
+
/**
|
|
104
|
+
* Maximum number of search results to return.
|
|
105
|
+
* @default 20
|
|
106
|
+
*/
|
|
107
|
+
max_search_results?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Filter search results to only include content from after this date.
|
|
110
|
+
* Format: ISO 8601 date string (e.g., "2024-01-01")
|
|
111
|
+
*/
|
|
112
|
+
from_date?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Filter search results to only include content from before this date.
|
|
115
|
+
* Format: ISO 8601 date string (e.g., "2024-12-31")
|
|
116
|
+
*/
|
|
117
|
+
to_date?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Whether to return citations/sources for the search results.
|
|
120
|
+
* @default true
|
|
121
|
+
*/
|
|
122
|
+
return_citations?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Specific web/news/X/RSS sources that can be used for the search.
|
|
125
|
+
* Each entry corresponds to a `{"type": "...", ...}` object in
|
|
126
|
+
* `search_parameters.sources` as documented in the xAI Live Search docs.
|
|
127
|
+
*
|
|
128
|
+
* If omitted, xAI will default to enabling `web`, `news` and `x` sources.
|
|
129
|
+
*/
|
|
130
|
+
sources?: XAISearchSource[];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Concrete payload shape sent as `search_parameters` to the xAI API.
|
|
134
|
+
*/
|
|
135
|
+
interface XAISearchParametersPayload {
|
|
136
|
+
mode: "auto" | "on" | "off";
|
|
137
|
+
max_search_results?: number;
|
|
138
|
+
from_date?: string;
|
|
139
|
+
to_date?: string;
|
|
140
|
+
return_citations?: boolean;
|
|
141
|
+
sources?: XAISearchSource[];
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
export { XAISearchParameters, XAISearchParametersPayload };
|
|
145
|
+
//# sourceMappingURL=live_search.d.cts.map
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
//#region src/live_search.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Web search source configuration for xAI Live Search.
|
|
4
|
+
* Corresponds to a `{"type": "web", ...}` entry in `search_parameters.sources`.
|
|
5
|
+
*/
|
|
6
|
+
interface XAIWebSource {
|
|
7
|
+
type: "web";
|
|
8
|
+
/**
|
|
9
|
+
* Optional ISO alpha-2 country code used to bias results
|
|
10
|
+
* towards a specific country/region.
|
|
11
|
+
*/
|
|
12
|
+
country?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Websites that should be excluded from the search results.
|
|
15
|
+
* Maximum of 5 entries.
|
|
16
|
+
*/
|
|
17
|
+
excluded_websites?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Websites that should be exclusively included in the search results.
|
|
20
|
+
* Maximum of 5 entries.
|
|
21
|
+
*/
|
|
22
|
+
allowed_websites?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Whether to enable safe search filtering for this source.
|
|
25
|
+
*/
|
|
26
|
+
safe_search?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* News search source configuration for xAI Live Search.
|
|
30
|
+
* Corresponds to a `{"type": "news", ...}` entry in `search_parameters.sources`.
|
|
31
|
+
*/
|
|
32
|
+
interface XAINewsSource {
|
|
33
|
+
type: "news";
|
|
34
|
+
/**
|
|
35
|
+
* Optional ISO alpha-2 country code used to bias results
|
|
36
|
+
* towards a specific country/region.
|
|
37
|
+
*/
|
|
38
|
+
country?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Websites that should be excluded from the search results.
|
|
41
|
+
* Maximum of 5 entries.
|
|
42
|
+
*/
|
|
43
|
+
excluded_websites?: string[];
|
|
44
|
+
/**
|
|
45
|
+
* Whether to enable safe search filtering for this source.
|
|
46
|
+
*/
|
|
47
|
+
safe_search?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* X (formerly Twitter) search source configuration for xAI Live Search.
|
|
51
|
+
* Corresponds to a `{"type": "x", ...}` entry in `search_parameters.sources`.
|
|
52
|
+
*/
|
|
53
|
+
interface XAIXSource {
|
|
54
|
+
type: "x";
|
|
55
|
+
/**
|
|
56
|
+
* X handles that should be explicitly included in the search.
|
|
57
|
+
* Maximum of 10 entries.
|
|
58
|
+
*/
|
|
59
|
+
included_x_handles?: string[];
|
|
60
|
+
/**
|
|
61
|
+
* X handles that should be excluded from the search.
|
|
62
|
+
* Maximum of 10 entries.
|
|
63
|
+
*/
|
|
64
|
+
excluded_x_handles?: string[];
|
|
65
|
+
/**
|
|
66
|
+
* Minimum number of favorites a post must have to be included.
|
|
67
|
+
*/
|
|
68
|
+
post_favorite_count?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Minimum number of views a post must have to be included.
|
|
71
|
+
*/
|
|
72
|
+
post_view_count?: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* RSS feed search source configuration for xAI Live Search.
|
|
76
|
+
* Corresponds to a `{"type": "rss", ...}` entry in `search_parameters.sources`.
|
|
77
|
+
*/
|
|
78
|
+
interface XAIRssSource {
|
|
79
|
+
type: "rss";
|
|
80
|
+
/**
|
|
81
|
+
* Links to RSS feeds to be used as a data source.
|
|
82
|
+
* The API currently expects a single URL.
|
|
83
|
+
*/
|
|
84
|
+
links: string[];
|
|
85
|
+
}
|
|
86
|
+
type XAISearchSource = XAIWebSource | XAINewsSource | XAIXSource | XAIRssSource;
|
|
87
|
+
/**
|
|
88
|
+
* Search parameters for xAI's Live Search API.
|
|
89
|
+
* Controls how the model searches for and retrieves real-time information.
|
|
90
|
+
*
|
|
91
|
+
* @note The Live Search API is being deprecated by xAI in favor of
|
|
92
|
+
* the agentic tool calling approach. Consider using `tools: [{ type: "live_search" }]`
|
|
93
|
+
* for future compatibility.
|
|
94
|
+
*/
|
|
95
|
+
interface XAISearchParameters {
|
|
96
|
+
/**
|
|
97
|
+
* Controls when the model should perform a search.
|
|
98
|
+
* - "auto": Let the model decide when to search (default)
|
|
99
|
+
* - "on": Always search for every request
|
|
100
|
+
* - "off": Never search
|
|
101
|
+
*/
|
|
102
|
+
mode?: "auto" | "on" | "off";
|
|
103
|
+
/**
|
|
104
|
+
* Maximum number of search results to return.
|
|
105
|
+
* @default 20
|
|
106
|
+
*/
|
|
107
|
+
max_search_results?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Filter search results to only include content from after this date.
|
|
110
|
+
* Format: ISO 8601 date string (e.g., "2024-01-01")
|
|
111
|
+
*/
|
|
112
|
+
from_date?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Filter search results to only include content from before this date.
|
|
115
|
+
* Format: ISO 8601 date string (e.g., "2024-12-31")
|
|
116
|
+
*/
|
|
117
|
+
to_date?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Whether to return citations/sources for the search results.
|
|
120
|
+
* @default true
|
|
121
|
+
*/
|
|
122
|
+
return_citations?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Specific web/news/X/RSS sources that can be used for the search.
|
|
125
|
+
* Each entry corresponds to a `{"type": "...", ...}` object in
|
|
126
|
+
* `search_parameters.sources` as documented in the xAI Live Search docs.
|
|
127
|
+
*
|
|
128
|
+
* If omitted, xAI will default to enabling `web`, `news` and `x` sources.
|
|
129
|
+
*/
|
|
130
|
+
sources?: XAISearchSource[];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Concrete payload shape sent as `search_parameters` to the xAI API.
|
|
134
|
+
*/
|
|
135
|
+
interface XAISearchParametersPayload {
|
|
136
|
+
mode: "auto" | "on" | "off";
|
|
137
|
+
max_search_results?: number;
|
|
138
|
+
from_date?: string;
|
|
139
|
+
to_date?: string;
|
|
140
|
+
return_citations?: boolean;
|
|
141
|
+
sources?: XAISearchSource[];
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
export { XAISearchParameters, XAISearchParametersPayload };
|
|
145
|
+
//# sourceMappingURL=live_search.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/live_search.ts
|
|
2
|
+
/**
|
|
3
|
+
* Merge search parameters from instance defaults, tool definition
|
|
4
|
+
* and per-call overrides.
|
|
5
|
+
*
|
|
6
|
+
* Precedence (lowest → highest):
|
|
7
|
+
* 1. tool-level configuration (e.g. from xaiLiveSearch)
|
|
8
|
+
* 2. instance-level defaults
|
|
9
|
+
* 3. per-call overrides passed via `searchParameters`
|
|
10
|
+
*/
|
|
11
|
+
function mergeSearchParams(instanceParams, callParams, toolParams) {
|
|
12
|
+
if (!instanceParams && !callParams && !toolParams) return void 0;
|
|
13
|
+
return {
|
|
14
|
+
...toolParams ?? {},
|
|
15
|
+
...instanceParams ?? {},
|
|
16
|
+
...callParams ?? {}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Build the `search_parameters` payload to send to the xAI API
|
|
21
|
+
* from high-level `XAISearchParameters`.
|
|
22
|
+
*/
|
|
23
|
+
function buildSearchParametersPayload(params) {
|
|
24
|
+
if (!params) return void 0;
|
|
25
|
+
const payload = { mode: params.mode ?? "auto" };
|
|
26
|
+
if (params.max_search_results !== void 0) payload.max_search_results = params.max_search_results;
|
|
27
|
+
if (params.from_date !== void 0) payload.from_date = params.from_date;
|
|
28
|
+
if (params.to_date !== void 0) payload.to_date = params.to_date;
|
|
29
|
+
if (params.return_citations !== void 0) payload.return_citations = params.return_citations;
|
|
30
|
+
if (params.sources && params.sources.length > 0) payload.sources = params.sources;
|
|
31
|
+
return payload;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Filter out xAI built-in tools (like `live_search`) from a tools array.
|
|
35
|
+
* Used before sending the request to the xAI API, since built-in tools
|
|
36
|
+
* are controlled via `search_parameters` instead.
|
|
37
|
+
*/
|
|
38
|
+
function filterXAIBuiltInTools(payload) {
|
|
39
|
+
if (!payload?.tools) return void 0;
|
|
40
|
+
const filtered = payload.tools.filter((tool) => {
|
|
41
|
+
if (tool == null || typeof tool !== "object") return true;
|
|
42
|
+
if (!("type" in tool)) return true;
|
|
43
|
+
if (!payload?.excludedTypes?.length) return true;
|
|
44
|
+
return !payload.excludedTypes.includes(tool.type);
|
|
45
|
+
});
|
|
46
|
+
return filtered.length > 0 ? filtered : void 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { buildSearchParametersPayload, filterXAIBuiltInTools, mergeSearchParams };
|
|
51
|
+
//# sourceMappingURL=live_search.js.map
|