@omnicross/core 0.1.0 → 0.1.1
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/ApiConverter.cjs +799 -0
- package/dist/ApiConverter.d.cts +82 -0
- package/dist/ApiConverter.d.ts +82 -0
- package/dist/ApiConverter.js +763 -0
- package/dist/BuiltinToolExecutor-BluWyeob.d.ts +81 -0
- package/dist/BuiltinToolExecutor-CS2WpXhM.d.cts +81 -0
- package/dist/CompletionService-7fCmKAP3.d.ts +212 -0
- package/dist/CompletionService-DtOF_War.d.cts +212 -0
- package/dist/{ProviderProxy-f_8ziIhW.d.cts → ProviderProxy-C-xqrkKi.d.ts} +7 -2
- package/dist/{ProviderProxy-vjt8sQQk.d.ts → ProviderProxy-CnMQYN59.d.cts} +7 -2
- package/dist/completion/BuiltinToolExecutor.cjs +327 -0
- package/dist/completion/BuiltinToolExecutor.d.cts +4 -0
- package/dist/completion/BuiltinToolExecutor.d.ts +4 -0
- package/dist/completion/BuiltinToolExecutor.js +296 -0
- package/dist/completion/CompletionService.cjs +3487 -0
- package/dist/completion/CompletionService.d.cts +21 -0
- package/dist/completion/CompletionService.d.ts +21 -0
- package/dist/completion/CompletionService.js +3461 -0
- package/dist/completion/NativeSearchInjector.cjs +196 -0
- package/dist/completion/NativeSearchInjector.d.cts +42 -0
- package/dist/completion/NativeSearchInjector.d.ts +42 -0
- package/dist/completion/NativeSearchInjector.js +167 -0
- package/dist/completion/ProviderSearchInjector.cjs +87 -0
- package/dist/completion/ProviderSearchInjector.d.cts +47 -0
- package/dist/completion/ProviderSearchInjector.d.ts +47 -0
- package/dist/completion/ProviderSearchInjector.js +60 -0
- package/dist/completion/native-search-types.cjs +67 -0
- package/dist/completion/native-search-types.d.cts +3 -0
- package/dist/completion/native-search-types.d.ts +3 -0
- package/dist/completion/native-search-types.js +38 -0
- package/dist/completion/openrouter-headers.cjs +72 -0
- package/dist/completion/openrouter-headers.d.cts +44 -0
- package/dist/completion/openrouter-headers.d.ts +44 -0
- package/dist/completion/openrouter-headers.js +42 -0
- package/dist/completion/openrouter-models.cjs +86 -0
- package/dist/completion/openrouter-models.d.cts +27 -0
- package/dist/completion/openrouter-models.d.ts +27 -0
- package/dist/completion/openrouter-models.js +59 -0
- package/dist/completion/types.cjs +18 -0
- package/dist/completion/types.d.cts +3 -0
- package/dist/completion/types.d.ts +3 -0
- package/dist/completion/types.js +0 -0
- package/dist/completion/url-builder.cjs +138 -0
- package/dist/completion/url-builder.d.cts +87 -0
- package/dist/completion/url-builder.d.ts +87 -0
- package/dist/completion/url-builder.js +104 -0
- package/dist/completion.d.cts +148 -7
- package/dist/completion.d.ts +148 -7
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +27 -90
- package/dist/index.d.ts +27 -90
- package/dist/index.js +1 -0
- package/dist/outbound-api/routeResolver.cjs +221 -0
- package/dist/outbound-api/routeResolver.d.cts +18 -0
- package/dist/outbound-api/routeResolver.d.ts +18 -0
- package/dist/outbound-api/routeResolver.js +192 -0
- package/dist/outbound-api/subscriptionRegistryPort.d.cts +5 -2
- package/dist/outbound-api/subscriptionRegistryPort.d.ts +5 -2
- package/dist/outbound-api/types.cjs +18 -0
- package/dist/{types-CbCN2NQP.d.ts → outbound-api/types.d.cts} +17 -3
- package/dist/{types-CGGrKqC_.d.cts → outbound-api/types.d.ts} +17 -3
- package/dist/outbound-api/types.js +0 -0
- package/dist/outbound-api.cjs +1 -0
- package/dist/outbound-api.d.cts +14 -87
- package/dist/outbound-api.d.ts +14 -87
- package/dist/outbound-api.js +1 -0
- package/dist/pipeline/AuthSource.cjs +18 -0
- package/dist/pipeline/AuthSource.d.cts +101 -0
- package/dist/pipeline/AuthSource.d.ts +101 -0
- package/dist/pipeline/AuthSource.js +0 -0
- package/dist/pipeline/LlmConfigProviderAuth.cjs +169 -0
- package/dist/pipeline/LlmConfigProviderAuth.d.cts +86 -0
- package/dist/pipeline/LlmConfigProviderAuth.d.ts +86 -0
- package/dist/pipeline/LlmConfigProviderAuth.js +142 -0
- package/dist/pipeline/SubscriptionAuthSource.d.cts +165 -3
- package/dist/pipeline/SubscriptionAuthSource.d.ts +165 -3
- package/dist/pipeline/executeProviderCall.cjs +70 -0
- package/dist/pipeline/executeProviderCall.d.cts +149 -0
- package/dist/pipeline/executeProviderCall.d.ts +149 -0
- package/dist/pipeline/executeProviderCall.js +45 -0
- package/dist/pipeline/resolveProviderChain.cjs +47 -0
- package/dist/pipeline/resolveProviderChain.d.cts +58 -0
- package/dist/pipeline/resolveProviderChain.d.ts +58 -0
- package/dist/pipeline/resolveProviderChain.js +22 -0
- package/dist/pipeline/resolveSubscriptionChain.cjs +68 -0
- package/dist/pipeline/resolveSubscriptionChain.d.cts +68 -0
- package/dist/pipeline/resolveSubscriptionChain.d.ts +68 -0
- package/dist/pipeline/resolveSubscriptionChain.js +43 -0
- package/dist/ports/provider-config-source.cjs +18 -0
- package/dist/ports/provider-config-source.d.cts +51 -0
- package/dist/ports/provider-config-source.d.ts +51 -0
- package/dist/ports/provider-config-source.js +0 -0
- package/dist/ports/web-search-backend.cjs +18 -0
- package/dist/ports/web-search-backend.d.cts +29 -0
- package/dist/ports/web-search-backend.d.ts +29 -0
- package/dist/ports/web-search-backend.js +0 -0
- package/dist/ports.d.cts +10 -7
- package/dist/ports.d.ts +10 -7
- package/dist/provider-proxy/ProviderProxy.cjs +4643 -0
- package/dist/provider-proxy/ProviderProxy.d.cts +16 -0
- package/dist/provider-proxy/ProviderProxy.d.ts +16 -0
- package/dist/provider-proxy/ProviderProxy.js +4618 -0
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +5 -2
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +5 -2
- package/dist/provider-proxy/types.d.cts +406 -8
- package/dist/provider-proxy/types.d.ts +406 -8
- package/dist/provider-proxy.cjs +1 -0
- package/dist/provider-proxy.d.cts +8 -5
- package/dist/provider-proxy.d.ts +8 -5
- package/dist/provider-proxy.js +1 -0
- package/dist/routeResolver-BrbK6ja9.d.cts +88 -0
- package/dist/routeResolver-HE-ZO0fO.d.ts +88 -0
- package/dist/transformer/anthropicBetaInject.cjs +51 -0
- package/dist/transformer/anthropicBetaInject.d.cts +20 -0
- package/dist/transformer/anthropicBetaInject.d.ts +20 -0
- package/dist/transformer/anthropicBetaInject.js +25 -0
- package/dist/transformer/transformers/AnthropicTransformer.cjs +1017 -0
- package/dist/transformer/transformers/AnthropicTransformer.d.cts +148 -0
- package/dist/transformer/transformers/AnthropicTransformer.d.ts +148 -0
- package/dist/transformer/transformers/AnthropicTransformer.js +990 -0
- package/dist/transformer/transformers/ReasoningTransformer.cjs +273 -0
- package/dist/transformer/transformers/ReasoningTransformer.d.cts +47 -0
- package/dist/transformer/transformers/ReasoningTransformer.d.ts +47 -0
- package/dist/transformer/transformers/ReasoningTransformer.js +253 -0
- package/dist/transformer/transformers.cjs +3206 -0
- package/dist/transformer/transformers.d.cts +100 -0
- package/dist/transformer/transformers.d.ts +100 -0
- package/dist/transformer/transformers.js +3174 -0
- package/dist/transformer.d.cts +8 -31
- package/dist/transformer.d.ts +8 -31
- package/dist/types-BScIHmPr.d.cts +153 -0
- package/dist/types-BScIHmPr.d.ts +153 -0
- package/package.json +3 -3
- package/dist/SubscriptionAuthSource-Cr4fVEYY.d.cts +0 -264
- package/dist/SubscriptionAuthSource-D89zmiSS.d.ts +0 -264
- package/dist/index-BTSmc9Sm.d.ts +0 -645
- package/dist/index-DXazdTzZ.d.cts +0 -645
- package/dist/types-DCzHkhJt.d.ts +0 -467
- package/dist/types-DZIQbgp0.d.cts +0 -467
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/completion/NativeSearchInjector.ts
|
|
21
|
+
var NativeSearchInjector_exports = {};
|
|
22
|
+
__export(NativeSearchInjector_exports, {
|
|
23
|
+
applyAugmentation: () => applyAugmentation,
|
|
24
|
+
buildNativeSearchAugmentation: () => buildNativeSearchAugmentation,
|
|
25
|
+
detectNativeSearch: () => detectNativeSearch
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(NativeSearchInjector_exports);
|
|
28
|
+
|
|
29
|
+
// src/openrouter.ts
|
|
30
|
+
function isOpenRouterProvider(provider) {
|
|
31
|
+
const baseUrl = (provider.api_base_url || "").toLowerCase();
|
|
32
|
+
return baseUrl.includes("openrouter.ai");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/completion/native-search-types.ts
|
|
36
|
+
var NATIVE_SEARCH_MODEL_PATTERNS = {
|
|
37
|
+
openai: [/^gpt-4/, /^o[134]/, /^gpt-5/],
|
|
38
|
+
// Claude 3.x: claude-3-opus-*, claude-3-5-sonnet-*, etc.
|
|
39
|
+
// Claude 4.x: claude-sonnet-4-*, claude-opus-4-*, claude-haiku-4-*, etc.
|
|
40
|
+
anthropic: [/^claude-/],
|
|
41
|
+
google: [/^gemini-(?:2|3|flash|pro)/],
|
|
42
|
+
xai: [/^grok/],
|
|
43
|
+
openrouter: []
|
|
44
|
+
// Detected via provider, not model pattern
|
|
45
|
+
};
|
|
46
|
+
var OPENAI_CHAT_COMPLETION_SEARCH_MODELS = [
|
|
47
|
+
"gpt-4o-search-preview",
|
|
48
|
+
"gpt-4o-mini-search-preview",
|
|
49
|
+
"gpt-5-search-api"
|
|
50
|
+
];
|
|
51
|
+
var NATIVE_SEARCH_EXCLUDED_MODELS = [
|
|
52
|
+
"gpt-4.1-nano"
|
|
53
|
+
];
|
|
54
|
+
var API_FORMAT_PROVIDER_MAP = {
|
|
55
|
+
"openai-response": "openai",
|
|
56
|
+
anthropic: "anthropic",
|
|
57
|
+
google: "google"
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/completion/NativeSearchInjector.ts
|
|
61
|
+
function detectNativeSearch(modelId, apiFormat, provider, userExplicit) {
|
|
62
|
+
if (isOpenRouterProvider(provider)) {
|
|
63
|
+
return { supported: true, nativeProvider: "openrouter" };
|
|
64
|
+
}
|
|
65
|
+
if (isXaiProvider(provider)) {
|
|
66
|
+
return { supported: true, nativeProvider: "xai" };
|
|
67
|
+
}
|
|
68
|
+
if (apiFormat === "openai" && OPENAI_CHAT_COMPLETION_SEARCH_MODELS.some((m) => modelId.startsWith(m))) {
|
|
69
|
+
return { supported: true, nativeProvider: "openai" };
|
|
70
|
+
}
|
|
71
|
+
const formatProvider = API_FORMAT_PROVIDER_MAP[apiFormat];
|
|
72
|
+
if (formatProvider) {
|
|
73
|
+
const patterns = NATIVE_SEARCH_MODEL_PATTERNS[formatProvider];
|
|
74
|
+
if (patterns.some((re) => re.test(modelId))) {
|
|
75
|
+
if (!NATIVE_SEARCH_EXCLUDED_MODELS.some((m) => modelId.startsWith(m))) {
|
|
76
|
+
return { supported: true, nativeProvider: formatProvider };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (userExplicit && formatProvider) {
|
|
81
|
+
return { supported: true, nativeProvider: formatProvider };
|
|
82
|
+
}
|
|
83
|
+
return { supported: false, nativeProvider: null };
|
|
84
|
+
}
|
|
85
|
+
function buildNativeSearchAugmentation(nativeProvider, config, _apiFormat, modelId) {
|
|
86
|
+
if (!config.enabled) return null;
|
|
87
|
+
switch (nativeProvider) {
|
|
88
|
+
case "openai":
|
|
89
|
+
return buildOpenAIAugmentation(config, modelId);
|
|
90
|
+
case "anthropic":
|
|
91
|
+
return buildAnthropicAugmentation(config);
|
|
92
|
+
case "google":
|
|
93
|
+
return buildGoogleAugmentation(modelId);
|
|
94
|
+
case "xai":
|
|
95
|
+
return buildXaiAugmentation(config);
|
|
96
|
+
case "openrouter":
|
|
97
|
+
return buildOpenRouterAugmentation(config);
|
|
98
|
+
default:
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function applyAugmentation(requestBody, augmentation) {
|
|
103
|
+
if (augmentation.additionalTools?.length) {
|
|
104
|
+
const existing = requestBody.tools ?? [];
|
|
105
|
+
requestBody.tools = [...existing, ...augmentation.additionalTools];
|
|
106
|
+
}
|
|
107
|
+
if (augmentation.bodyFields) {
|
|
108
|
+
Object.assign(requestBody, augmentation.bodyFields);
|
|
109
|
+
}
|
|
110
|
+
return requestBody;
|
|
111
|
+
}
|
|
112
|
+
function buildOpenAIAugmentation(config, modelId) {
|
|
113
|
+
const isChatCompletionSearch = OPENAI_CHAT_COMPLETION_SEARCH_MODELS.some(
|
|
114
|
+
(m) => modelId.startsWith(m)
|
|
115
|
+
);
|
|
116
|
+
if (isChatCompletionSearch) {
|
|
117
|
+
return {
|
|
118
|
+
bodyFields: {
|
|
119
|
+
web_search_options: {
|
|
120
|
+
search_context_size: config.maxResults ? mapMaxResultsToContextSize(config.maxResults) : "medium"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
additionalTools: [
|
|
127
|
+
{
|
|
128
|
+
type: "web_search",
|
|
129
|
+
web_search: {
|
|
130
|
+
search_context_size: config.maxResults ? mapMaxResultsToContextSize(config.maxResults) : "medium"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function buildAnthropicAugmentation(config) {
|
|
137
|
+
const toolDef = {
|
|
138
|
+
type: "web_search_20250305",
|
|
139
|
+
name: "web_search"
|
|
140
|
+
};
|
|
141
|
+
if (config.maxResults) {
|
|
142
|
+
toolDef.max_uses = config.maxResults;
|
|
143
|
+
}
|
|
144
|
+
if (config.blockedDomains?.length) {
|
|
145
|
+
toolDef.blocked_domains = config.blockedDomains;
|
|
146
|
+
}
|
|
147
|
+
return { additionalTools: [toolDef] };
|
|
148
|
+
}
|
|
149
|
+
function buildGoogleAugmentation(modelId) {
|
|
150
|
+
const isLegacy = /gemini-1[._]/.test(modelId);
|
|
151
|
+
if (isLegacy) {
|
|
152
|
+
return {
|
|
153
|
+
additionalTools: [
|
|
154
|
+
{ googleSearchRetrieval: {} }
|
|
155
|
+
]
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
additionalTools: [
|
|
160
|
+
{ google_search: {} }
|
|
161
|
+
]
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function buildXaiAugmentation(config) {
|
|
165
|
+
const searchParams = {
|
|
166
|
+
mode: config.searchMode ?? "auto",
|
|
167
|
+
return_citations: true,
|
|
168
|
+
max_search_results: config.maxResults ?? 5
|
|
169
|
+
};
|
|
170
|
+
if (config.sources?.length) {
|
|
171
|
+
searchParams.sources = config.sources;
|
|
172
|
+
}
|
|
173
|
+
return { bodyFields: { search_parameters: searchParams } };
|
|
174
|
+
}
|
|
175
|
+
function buildOpenRouterAugmentation(config) {
|
|
176
|
+
const plugin = { id: "web" };
|
|
177
|
+
if (config.maxResults) {
|
|
178
|
+
plugin.max_results = config.maxResults;
|
|
179
|
+
}
|
|
180
|
+
return { bodyFields: { plugins: [plugin] } };
|
|
181
|
+
}
|
|
182
|
+
function isXaiProvider(provider) {
|
|
183
|
+
const baseUrl = (provider.api_base_url || "").toLowerCase();
|
|
184
|
+
return baseUrl.includes("x.ai") || baseUrl.includes("xai.com");
|
|
185
|
+
}
|
|
186
|
+
function mapMaxResultsToContextSize(maxResults) {
|
|
187
|
+
if (maxResults <= 2) return "low";
|
|
188
|
+
if (maxResults <= 5) return "medium";
|
|
189
|
+
return "high";
|
|
190
|
+
}
|
|
191
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
192
|
+
0 && (module.exports = {
|
|
193
|
+
applyAugmentation,
|
|
194
|
+
buildNativeSearchAugmentation,
|
|
195
|
+
detectNativeSearch
|
|
196
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { LLMProvider } from '@omnicross/contracts/llm-config';
|
|
2
|
+
import { b as NativeSearchAugmentation, d as NativeSearchProvider, e as NativeSearchUserConfig, A as ApiFormat, c as NativeSearchDetectionResult } from '../types-BScIHmPr.cjs';
|
|
3
|
+
import '@omnicross/contracts/message-blocks';
|
|
4
|
+
import '@omnicross/contracts/completion-types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Native Search Injector
|
|
8
|
+
*
|
|
9
|
+
* Detects provider-native web search support and builds request body
|
|
10
|
+
* augmentations for OpenAI, Anthropic, Google, xAI, and OpenRouter.
|
|
11
|
+
*
|
|
12
|
+
* This module does NOT execute searches — it only prepares the request
|
|
13
|
+
* so the LLM provider's server-side search runs automatically.
|
|
14
|
+
*
|
|
15
|
+
* @module completion/NativeSearchInjector
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Detect whether a model supports provider-native web search.
|
|
20
|
+
*
|
|
21
|
+
* Detection order:
|
|
22
|
+
* 1. OpenRouter — detected by provider base URL, not model pattern.
|
|
23
|
+
* 2. xAI — detected by base URL containing `x.ai` or `grok`.
|
|
24
|
+
* 3. Model-pattern match against known providers (OpenAI, Anthropic, Google).
|
|
25
|
+
* 4. If `userExplicit` is true, fall back to API format mapping even
|
|
26
|
+
* when the model ID doesn't match known patterns (user opted-in).
|
|
27
|
+
*/
|
|
28
|
+
declare function detectNativeSearch(modelId: string, apiFormat: ApiFormat, provider: LLMProvider, userExplicit?: boolean): NativeSearchDetectionResult;
|
|
29
|
+
/**
|
|
30
|
+
* Build a {@link NativeSearchAugmentation} for the given provider.
|
|
31
|
+
* Returns `null` if the provider is unknown or config is disabled.
|
|
32
|
+
*/
|
|
33
|
+
declare function buildNativeSearchAugmentation(nativeProvider: NativeSearchProvider, config: NativeSearchUserConfig, _apiFormat: ApiFormat, modelId: string): NativeSearchAugmentation | null;
|
|
34
|
+
/**
|
|
35
|
+
* Merge an augmentation into the request body **in-place**.
|
|
36
|
+
*
|
|
37
|
+
* - `additionalTools` are appended to the existing `tools` array.
|
|
38
|
+
* - `bodyFields` are shallow-merged into the top-level body.
|
|
39
|
+
*/
|
|
40
|
+
declare function applyAugmentation(requestBody: Record<string, unknown>, augmentation: NativeSearchAugmentation): Record<string, unknown>;
|
|
41
|
+
|
|
42
|
+
export { applyAugmentation, buildNativeSearchAugmentation, detectNativeSearch };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { LLMProvider } from '@omnicross/contracts/llm-config';
|
|
2
|
+
import { b as NativeSearchAugmentation, d as NativeSearchProvider, e as NativeSearchUserConfig, A as ApiFormat, c as NativeSearchDetectionResult } from '../types-BScIHmPr.js';
|
|
3
|
+
import '@omnicross/contracts/message-blocks';
|
|
4
|
+
import '@omnicross/contracts/completion-types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Native Search Injector
|
|
8
|
+
*
|
|
9
|
+
* Detects provider-native web search support and builds request body
|
|
10
|
+
* augmentations for OpenAI, Anthropic, Google, xAI, and OpenRouter.
|
|
11
|
+
*
|
|
12
|
+
* This module does NOT execute searches — it only prepares the request
|
|
13
|
+
* so the LLM provider's server-side search runs automatically.
|
|
14
|
+
*
|
|
15
|
+
* @module completion/NativeSearchInjector
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Detect whether a model supports provider-native web search.
|
|
20
|
+
*
|
|
21
|
+
* Detection order:
|
|
22
|
+
* 1. OpenRouter — detected by provider base URL, not model pattern.
|
|
23
|
+
* 2. xAI — detected by base URL containing `x.ai` or `grok`.
|
|
24
|
+
* 3. Model-pattern match against known providers (OpenAI, Anthropic, Google).
|
|
25
|
+
* 4. If `userExplicit` is true, fall back to API format mapping even
|
|
26
|
+
* when the model ID doesn't match known patterns (user opted-in).
|
|
27
|
+
*/
|
|
28
|
+
declare function detectNativeSearch(modelId: string, apiFormat: ApiFormat, provider: LLMProvider, userExplicit?: boolean): NativeSearchDetectionResult;
|
|
29
|
+
/**
|
|
30
|
+
* Build a {@link NativeSearchAugmentation} for the given provider.
|
|
31
|
+
* Returns `null` if the provider is unknown or config is disabled.
|
|
32
|
+
*/
|
|
33
|
+
declare function buildNativeSearchAugmentation(nativeProvider: NativeSearchProvider, config: NativeSearchUserConfig, _apiFormat: ApiFormat, modelId: string): NativeSearchAugmentation | null;
|
|
34
|
+
/**
|
|
35
|
+
* Merge an augmentation into the request body **in-place**.
|
|
36
|
+
*
|
|
37
|
+
* - `additionalTools` are appended to the existing `tools` array.
|
|
38
|
+
* - `bodyFields` are shallow-merged into the top-level body.
|
|
39
|
+
*/
|
|
40
|
+
declare function applyAugmentation(requestBody: Record<string, unknown>, augmentation: NativeSearchAugmentation): Record<string, unknown>;
|
|
41
|
+
|
|
42
|
+
export { applyAugmentation, buildNativeSearchAugmentation, detectNativeSearch };
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// src/openrouter.ts
|
|
2
|
+
function isOpenRouterProvider(provider) {
|
|
3
|
+
const baseUrl = (provider.api_base_url || "").toLowerCase();
|
|
4
|
+
return baseUrl.includes("openrouter.ai");
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// src/completion/native-search-types.ts
|
|
8
|
+
var NATIVE_SEARCH_MODEL_PATTERNS = {
|
|
9
|
+
openai: [/^gpt-4/, /^o[134]/, /^gpt-5/],
|
|
10
|
+
// Claude 3.x: claude-3-opus-*, claude-3-5-sonnet-*, etc.
|
|
11
|
+
// Claude 4.x: claude-sonnet-4-*, claude-opus-4-*, claude-haiku-4-*, etc.
|
|
12
|
+
anthropic: [/^claude-/],
|
|
13
|
+
google: [/^gemini-(?:2|3|flash|pro)/],
|
|
14
|
+
xai: [/^grok/],
|
|
15
|
+
openrouter: []
|
|
16
|
+
// Detected via provider, not model pattern
|
|
17
|
+
};
|
|
18
|
+
var OPENAI_CHAT_COMPLETION_SEARCH_MODELS = [
|
|
19
|
+
"gpt-4o-search-preview",
|
|
20
|
+
"gpt-4o-mini-search-preview",
|
|
21
|
+
"gpt-5-search-api"
|
|
22
|
+
];
|
|
23
|
+
var NATIVE_SEARCH_EXCLUDED_MODELS = [
|
|
24
|
+
"gpt-4.1-nano"
|
|
25
|
+
];
|
|
26
|
+
var API_FORMAT_PROVIDER_MAP = {
|
|
27
|
+
"openai-response": "openai",
|
|
28
|
+
anthropic: "anthropic",
|
|
29
|
+
google: "google"
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// src/completion/NativeSearchInjector.ts
|
|
33
|
+
function detectNativeSearch(modelId, apiFormat, provider, userExplicit) {
|
|
34
|
+
if (isOpenRouterProvider(provider)) {
|
|
35
|
+
return { supported: true, nativeProvider: "openrouter" };
|
|
36
|
+
}
|
|
37
|
+
if (isXaiProvider(provider)) {
|
|
38
|
+
return { supported: true, nativeProvider: "xai" };
|
|
39
|
+
}
|
|
40
|
+
if (apiFormat === "openai" && OPENAI_CHAT_COMPLETION_SEARCH_MODELS.some((m) => modelId.startsWith(m))) {
|
|
41
|
+
return { supported: true, nativeProvider: "openai" };
|
|
42
|
+
}
|
|
43
|
+
const formatProvider = API_FORMAT_PROVIDER_MAP[apiFormat];
|
|
44
|
+
if (formatProvider) {
|
|
45
|
+
const patterns = NATIVE_SEARCH_MODEL_PATTERNS[formatProvider];
|
|
46
|
+
if (patterns.some((re) => re.test(modelId))) {
|
|
47
|
+
if (!NATIVE_SEARCH_EXCLUDED_MODELS.some((m) => modelId.startsWith(m))) {
|
|
48
|
+
return { supported: true, nativeProvider: formatProvider };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (userExplicit && formatProvider) {
|
|
53
|
+
return { supported: true, nativeProvider: formatProvider };
|
|
54
|
+
}
|
|
55
|
+
return { supported: false, nativeProvider: null };
|
|
56
|
+
}
|
|
57
|
+
function buildNativeSearchAugmentation(nativeProvider, config, _apiFormat, modelId) {
|
|
58
|
+
if (!config.enabled) return null;
|
|
59
|
+
switch (nativeProvider) {
|
|
60
|
+
case "openai":
|
|
61
|
+
return buildOpenAIAugmentation(config, modelId);
|
|
62
|
+
case "anthropic":
|
|
63
|
+
return buildAnthropicAugmentation(config);
|
|
64
|
+
case "google":
|
|
65
|
+
return buildGoogleAugmentation(modelId);
|
|
66
|
+
case "xai":
|
|
67
|
+
return buildXaiAugmentation(config);
|
|
68
|
+
case "openrouter":
|
|
69
|
+
return buildOpenRouterAugmentation(config);
|
|
70
|
+
default:
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function applyAugmentation(requestBody, augmentation) {
|
|
75
|
+
if (augmentation.additionalTools?.length) {
|
|
76
|
+
const existing = requestBody.tools ?? [];
|
|
77
|
+
requestBody.tools = [...existing, ...augmentation.additionalTools];
|
|
78
|
+
}
|
|
79
|
+
if (augmentation.bodyFields) {
|
|
80
|
+
Object.assign(requestBody, augmentation.bodyFields);
|
|
81
|
+
}
|
|
82
|
+
return requestBody;
|
|
83
|
+
}
|
|
84
|
+
function buildOpenAIAugmentation(config, modelId) {
|
|
85
|
+
const isChatCompletionSearch = OPENAI_CHAT_COMPLETION_SEARCH_MODELS.some(
|
|
86
|
+
(m) => modelId.startsWith(m)
|
|
87
|
+
);
|
|
88
|
+
if (isChatCompletionSearch) {
|
|
89
|
+
return {
|
|
90
|
+
bodyFields: {
|
|
91
|
+
web_search_options: {
|
|
92
|
+
search_context_size: config.maxResults ? mapMaxResultsToContextSize(config.maxResults) : "medium"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
additionalTools: [
|
|
99
|
+
{
|
|
100
|
+
type: "web_search",
|
|
101
|
+
web_search: {
|
|
102
|
+
search_context_size: config.maxResults ? mapMaxResultsToContextSize(config.maxResults) : "medium"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function buildAnthropicAugmentation(config) {
|
|
109
|
+
const toolDef = {
|
|
110
|
+
type: "web_search_20250305",
|
|
111
|
+
name: "web_search"
|
|
112
|
+
};
|
|
113
|
+
if (config.maxResults) {
|
|
114
|
+
toolDef.max_uses = config.maxResults;
|
|
115
|
+
}
|
|
116
|
+
if (config.blockedDomains?.length) {
|
|
117
|
+
toolDef.blocked_domains = config.blockedDomains;
|
|
118
|
+
}
|
|
119
|
+
return { additionalTools: [toolDef] };
|
|
120
|
+
}
|
|
121
|
+
function buildGoogleAugmentation(modelId) {
|
|
122
|
+
const isLegacy = /gemini-1[._]/.test(modelId);
|
|
123
|
+
if (isLegacy) {
|
|
124
|
+
return {
|
|
125
|
+
additionalTools: [
|
|
126
|
+
{ googleSearchRetrieval: {} }
|
|
127
|
+
]
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
additionalTools: [
|
|
132
|
+
{ google_search: {} }
|
|
133
|
+
]
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function buildXaiAugmentation(config) {
|
|
137
|
+
const searchParams = {
|
|
138
|
+
mode: config.searchMode ?? "auto",
|
|
139
|
+
return_citations: true,
|
|
140
|
+
max_search_results: config.maxResults ?? 5
|
|
141
|
+
};
|
|
142
|
+
if (config.sources?.length) {
|
|
143
|
+
searchParams.sources = config.sources;
|
|
144
|
+
}
|
|
145
|
+
return { bodyFields: { search_parameters: searchParams } };
|
|
146
|
+
}
|
|
147
|
+
function buildOpenRouterAugmentation(config) {
|
|
148
|
+
const plugin = { id: "web" };
|
|
149
|
+
if (config.maxResults) {
|
|
150
|
+
plugin.max_results = config.maxResults;
|
|
151
|
+
}
|
|
152
|
+
return { bodyFields: { plugins: [plugin] } };
|
|
153
|
+
}
|
|
154
|
+
function isXaiProvider(provider) {
|
|
155
|
+
const baseUrl = (provider.api_base_url || "").toLowerCase();
|
|
156
|
+
return baseUrl.includes("x.ai") || baseUrl.includes("xai.com");
|
|
157
|
+
}
|
|
158
|
+
function mapMaxResultsToContextSize(maxResults) {
|
|
159
|
+
if (maxResults <= 2) return "low";
|
|
160
|
+
if (maxResults <= 5) return "medium";
|
|
161
|
+
return "high";
|
|
162
|
+
}
|
|
163
|
+
export {
|
|
164
|
+
applyAugmentation,
|
|
165
|
+
buildNativeSearchAugmentation,
|
|
166
|
+
detectNativeSearch
|
|
167
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/completion/ProviderSearchInjector.ts
|
|
21
|
+
var ProviderSearchInjector_exports = {};
|
|
22
|
+
__export(ProviderSearchInjector_exports, {
|
|
23
|
+
applyProviderSearchAugmentation: () => applyProviderSearchAugmentation,
|
|
24
|
+
buildProviderSearchAugmentation: () => buildProviderSearchAugmentation,
|
|
25
|
+
getSearchConfig: () => getSearchConfig
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(ProviderSearchInjector_exports);
|
|
28
|
+
var import_provider_presets = require("@omnicross/contracts/provider-presets");
|
|
29
|
+
function getSearchConfig(provider) {
|
|
30
|
+
const presetId = provider.presetId || provider.id;
|
|
31
|
+
if (presetId in import_provider_presets.PROVIDER_SEARCH_CONFIGS) {
|
|
32
|
+
return import_provider_presets.PROVIDER_SEARCH_CONFIGS[presetId];
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
function buildProviderSearchAugmentation(provider, modelId, hasOtherTools) {
|
|
37
|
+
const config = getSearchConfig(provider);
|
|
38
|
+
if (!config) return null;
|
|
39
|
+
if (config.applicableModels && !config.applicableModels.includes(modelId)) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
switch (config.type) {
|
|
43
|
+
case "model-param": {
|
|
44
|
+
const bodyFields = {};
|
|
45
|
+
if (config.paramName) {
|
|
46
|
+
bodyFields[config.paramName] = config.paramValue ?? true;
|
|
47
|
+
}
|
|
48
|
+
if (config.extraParams) {
|
|
49
|
+
Object.assign(bodyFields, config.extraParams);
|
|
50
|
+
}
|
|
51
|
+
return { bodyFields };
|
|
52
|
+
}
|
|
53
|
+
case "builtin-tool": {
|
|
54
|
+
if (config.conflictsWithFC && hasOtherTools) {
|
|
55
|
+
return {
|
|
56
|
+
warning: `${provider.name} search conflicts with function calling. Search disabled for this request.`
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (config.toolDefinition) {
|
|
60
|
+
return { additionalTools: [config.toolDefinition] };
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
case "mcp":
|
|
65
|
+
case "sdk-native":
|
|
66
|
+
case "none":
|
|
67
|
+
return null;
|
|
68
|
+
default:
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function applyProviderSearchAugmentation(requestBody, augmentation) {
|
|
73
|
+
if (augmentation.bodyFields) {
|
|
74
|
+
Object.assign(requestBody, augmentation.bodyFields);
|
|
75
|
+
}
|
|
76
|
+
if (augmentation.additionalTools?.length) {
|
|
77
|
+
const existing = requestBody.tools ?? [];
|
|
78
|
+
requestBody.tools = [...existing, ...augmentation.additionalTools];
|
|
79
|
+
}
|
|
80
|
+
return requestBody;
|
|
81
|
+
}
|
|
82
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
+
0 && (module.exports = {
|
|
84
|
+
applyProviderSearchAugmentation,
|
|
85
|
+
buildProviderSearchAugmentation,
|
|
86
|
+
getSearchConfig
|
|
87
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LLMProvider } from '@omnicross/contracts/llm-config';
|
|
2
|
+
import { ProviderSearchConfig } from '@omnicross/contracts/provider-presets';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Provider Search Injector
|
|
6
|
+
*
|
|
7
|
+
* Handles provider-specific search parameter injection for Chinese cloud
|
|
8
|
+
* providers that don't use SDK-native search (which is handled by
|
|
9
|
+
* NativeSearchInjector).
|
|
10
|
+
*
|
|
11
|
+
* Supports:
|
|
12
|
+
* - model-param: Adds search parameters to request body (DashScope, Baidu)
|
|
13
|
+
* - builtin-tool: Adds provider-specific tool definitions (Kimi, Volcengine)
|
|
14
|
+
*
|
|
15
|
+
* MCP-based search is handled externally by the MCP tool system.
|
|
16
|
+
* SDK-native search is handled by NativeSearchInjector.
|
|
17
|
+
*
|
|
18
|
+
* @module completion/ProviderSearchInjector
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
interface SearchAugmentation {
|
|
22
|
+
/** Parameters to merge into the request body */
|
|
23
|
+
bodyFields?: Record<string, unknown>;
|
|
24
|
+
/** Tool definitions to append to the tools array */
|
|
25
|
+
additionalTools?: unknown[];
|
|
26
|
+
/** Warning message if search has limitations */
|
|
27
|
+
warning?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the search config for a provider.
|
|
31
|
+
*/
|
|
32
|
+
declare function getSearchConfig(provider: LLMProvider): ProviderSearchConfig | null;
|
|
33
|
+
/**
|
|
34
|
+
* Build search augmentation for a provider request.
|
|
35
|
+
*
|
|
36
|
+
* @param provider The LLM provider
|
|
37
|
+
* @param modelId The model being used
|
|
38
|
+
* @param hasOtherTools Whether the request already has tool definitions (for FC conflict detection)
|
|
39
|
+
* @returns Search augmentation to apply, or null if no search is available
|
|
40
|
+
*/
|
|
41
|
+
declare function buildProviderSearchAugmentation(provider: LLMProvider, modelId: string, hasOtherTools: boolean): SearchAugmentation | null;
|
|
42
|
+
/**
|
|
43
|
+
* Apply search augmentation to a request body.
|
|
44
|
+
*/
|
|
45
|
+
declare function applyProviderSearchAugmentation(requestBody: Record<string, unknown>, augmentation: SearchAugmentation): Record<string, unknown>;
|
|
46
|
+
|
|
47
|
+
export { type SearchAugmentation, applyProviderSearchAugmentation, buildProviderSearchAugmentation, getSearchConfig };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LLMProvider } from '@omnicross/contracts/llm-config';
|
|
2
|
+
import { ProviderSearchConfig } from '@omnicross/contracts/provider-presets';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Provider Search Injector
|
|
6
|
+
*
|
|
7
|
+
* Handles provider-specific search parameter injection for Chinese cloud
|
|
8
|
+
* providers that don't use SDK-native search (which is handled by
|
|
9
|
+
* NativeSearchInjector).
|
|
10
|
+
*
|
|
11
|
+
* Supports:
|
|
12
|
+
* - model-param: Adds search parameters to request body (DashScope, Baidu)
|
|
13
|
+
* - builtin-tool: Adds provider-specific tool definitions (Kimi, Volcengine)
|
|
14
|
+
*
|
|
15
|
+
* MCP-based search is handled externally by the MCP tool system.
|
|
16
|
+
* SDK-native search is handled by NativeSearchInjector.
|
|
17
|
+
*
|
|
18
|
+
* @module completion/ProviderSearchInjector
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
interface SearchAugmentation {
|
|
22
|
+
/** Parameters to merge into the request body */
|
|
23
|
+
bodyFields?: Record<string, unknown>;
|
|
24
|
+
/** Tool definitions to append to the tools array */
|
|
25
|
+
additionalTools?: unknown[];
|
|
26
|
+
/** Warning message if search has limitations */
|
|
27
|
+
warning?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the search config for a provider.
|
|
31
|
+
*/
|
|
32
|
+
declare function getSearchConfig(provider: LLMProvider): ProviderSearchConfig | null;
|
|
33
|
+
/**
|
|
34
|
+
* Build search augmentation for a provider request.
|
|
35
|
+
*
|
|
36
|
+
* @param provider The LLM provider
|
|
37
|
+
* @param modelId The model being used
|
|
38
|
+
* @param hasOtherTools Whether the request already has tool definitions (for FC conflict detection)
|
|
39
|
+
* @returns Search augmentation to apply, or null if no search is available
|
|
40
|
+
*/
|
|
41
|
+
declare function buildProviderSearchAugmentation(provider: LLMProvider, modelId: string, hasOtherTools: boolean): SearchAugmentation | null;
|
|
42
|
+
/**
|
|
43
|
+
* Apply search augmentation to a request body.
|
|
44
|
+
*/
|
|
45
|
+
declare function applyProviderSearchAugmentation(requestBody: Record<string, unknown>, augmentation: SearchAugmentation): Record<string, unknown>;
|
|
46
|
+
|
|
47
|
+
export { type SearchAugmentation, applyProviderSearchAugmentation, buildProviderSearchAugmentation, getSearchConfig };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/completion/ProviderSearchInjector.ts
|
|
2
|
+
import { PROVIDER_SEARCH_CONFIGS } from "@omnicross/contracts/provider-presets";
|
|
3
|
+
function getSearchConfig(provider) {
|
|
4
|
+
const presetId = provider.presetId || provider.id;
|
|
5
|
+
if (presetId in PROVIDER_SEARCH_CONFIGS) {
|
|
6
|
+
return PROVIDER_SEARCH_CONFIGS[presetId];
|
|
7
|
+
}
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
function buildProviderSearchAugmentation(provider, modelId, hasOtherTools) {
|
|
11
|
+
const config = getSearchConfig(provider);
|
|
12
|
+
if (!config) return null;
|
|
13
|
+
if (config.applicableModels && !config.applicableModels.includes(modelId)) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
switch (config.type) {
|
|
17
|
+
case "model-param": {
|
|
18
|
+
const bodyFields = {};
|
|
19
|
+
if (config.paramName) {
|
|
20
|
+
bodyFields[config.paramName] = config.paramValue ?? true;
|
|
21
|
+
}
|
|
22
|
+
if (config.extraParams) {
|
|
23
|
+
Object.assign(bodyFields, config.extraParams);
|
|
24
|
+
}
|
|
25
|
+
return { bodyFields };
|
|
26
|
+
}
|
|
27
|
+
case "builtin-tool": {
|
|
28
|
+
if (config.conflictsWithFC && hasOtherTools) {
|
|
29
|
+
return {
|
|
30
|
+
warning: `${provider.name} search conflicts with function calling. Search disabled for this request.`
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (config.toolDefinition) {
|
|
34
|
+
return { additionalTools: [config.toolDefinition] };
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
case "mcp":
|
|
39
|
+
case "sdk-native":
|
|
40
|
+
case "none":
|
|
41
|
+
return null;
|
|
42
|
+
default:
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function applyProviderSearchAugmentation(requestBody, augmentation) {
|
|
47
|
+
if (augmentation.bodyFields) {
|
|
48
|
+
Object.assign(requestBody, augmentation.bodyFields);
|
|
49
|
+
}
|
|
50
|
+
if (augmentation.additionalTools?.length) {
|
|
51
|
+
const existing = requestBody.tools ?? [];
|
|
52
|
+
requestBody.tools = [...existing, ...augmentation.additionalTools];
|
|
53
|
+
}
|
|
54
|
+
return requestBody;
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
applyProviderSearchAugmentation,
|
|
58
|
+
buildProviderSearchAugmentation,
|
|
59
|
+
getSearchConfig
|
|
60
|
+
};
|