mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
AIX: OpenAI chatCompletions: remove obsolete X search params
This commit is contained in:
@@ -185,37 +185,6 @@ export function aixToOpenAIChatCompletions(openAIDialect: OpenAIDialects, model:
|
||||
if (openAIDialect === 'openrouter' && model.vndOaiVerbosity)
|
||||
payload.verbosity = model.vndOaiVerbosity;
|
||||
|
||||
// [xAI] Vendor-specific extensions for Live Search
|
||||
if (openAIDialect === 'xai' && model.vndXaiSearchMode && model.vndXaiSearchMode !== 'off') {
|
||||
const search_parameters: any = {
|
||||
return_citations: true,
|
||||
};
|
||||
|
||||
// mode defaults to 'auto' if not specified, so only include if not 'auto'
|
||||
if (model.vndXaiSearchMode && model.vndXaiSearchMode !== 'auto')
|
||||
search_parameters.mode = model.vndXaiSearchMode;
|
||||
|
||||
if (model.vndXaiSearchSources) {
|
||||
const sources = model.vndXaiSearchSources
|
||||
.split(',')
|
||||
.map(s => s.trim())
|
||||
.filter(s => !!s);
|
||||
|
||||
// only omit sources if it's the default ('web' and 'x')
|
||||
const isDefaultSources = sources.length === 2 && sources.includes('web') && sources.includes('x');
|
||||
if (!isDefaultSources)
|
||||
search_parameters.sources = sources.map(s => ({ type: s }));
|
||||
}
|
||||
|
||||
if (model.vndXaiSearchDateFilter && model.vndXaiSearchDateFilter !== 'unfiltered') {
|
||||
const fromDate = _convertSimpleDateFilterToISO(model.vndXaiSearchDateFilter);
|
||||
if (fromDate)
|
||||
search_parameters.from_date = fromDate;
|
||||
}
|
||||
|
||||
payload.search_parameters = search_parameters;
|
||||
}
|
||||
|
||||
// [Moonshot] Kimi's $web_search builtin function
|
||||
if (openAIDialect === 'moonshot' && model.vndMoonshotWebSearch === 'auto' && !skipWebSearchDueToCustomTools)
|
||||
payload.tools = [...(payload.tools || []), {
|
||||
@@ -765,24 +734,3 @@ function _convertPerplexityDateFilter(filter: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
function _convertSimpleDateFilterToISO(filter: '1d' | '1w' | '1m' | '6m' | '1y'): string {
|
||||
const now = new Date();
|
||||
switch (filter) {
|
||||
case '1d':
|
||||
now.setDate(now.getDate() - 1);
|
||||
break;
|
||||
case '1w':
|
||||
now.setDate(now.getDate() - 7);
|
||||
break;
|
||||
case '1m':
|
||||
now.setMonth(now.getMonth() - 1);
|
||||
break;
|
||||
case '6m':
|
||||
now.setMonth(now.getMonth() - 6);
|
||||
break;
|
||||
case '1y':
|
||||
now.setFullYear(now.getFullYear() - 1);
|
||||
break;
|
||||
}
|
||||
return now.toISOString().split('T')[0];
|
||||
}
|
||||
|
||||
@@ -414,9 +414,6 @@ export namespace OpenAIWire_API_Chat_Completions {
|
||||
search_mode: z.enum(['academic']).optional(), // Academic filter for scholarly sources
|
||||
search_after_date_filter: z.string().optional(), // Date filter in MM/DD/YYYY format
|
||||
|
||||
// [xAI] xAI-specific search parameters
|
||||
search_parameters: z.record(z.string(), z.any()).optional(), // xAI Live Search parameters - keeping flexible for API evolution
|
||||
|
||||
seed: z.number().int().optional(),
|
||||
stop: z.array(z.string()).optional(), // Up to 4 sequences where the API will stop generating further tokens.
|
||||
user: z.string().optional(),
|
||||
|
||||
Reference in New Issue
Block a user