mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
LLMs/AIX: Parameters: Anthropic: max Fetch/Search depth. #1004
This commit is contained in:
@@ -234,6 +234,14 @@ export const DModelParameterRegistry = {
|
||||
// undefined means off (same as 'off')
|
||||
}),
|
||||
|
||||
llmVndAntWebFetchMaxUses: {
|
||||
label: 'Web Fetch Max Uses',
|
||||
type: 'integer',
|
||||
description: 'Maximum number of web page fetches per response',
|
||||
range: [1, 50],
|
||||
// undefined means default
|
||||
},
|
||||
|
||||
llmVndAntWebSearch: _enumDef({ // implies: LLM_IF_Tools_WebSearch
|
||||
label: 'Web Search',
|
||||
type: 'enum',
|
||||
@@ -242,6 +250,14 @@ export const DModelParameterRegistry = {
|
||||
// undefined means off (same as 'off')
|
||||
}),
|
||||
|
||||
llmVndAntWebSearchMaxUses: {
|
||||
label: 'Web Search Max Uses',
|
||||
type: 'integer',
|
||||
description: 'Maximum number of web searches per response',
|
||||
range: [1, 50],
|
||||
// undefined means default
|
||||
},
|
||||
|
||||
// llmVndAntToolSearch: { // Not user set
|
||||
// label: 'Tool Search',
|
||||
// type: 'enum',
|
||||
|
||||
@@ -50,7 +50,7 @@ export function aixCreateModelFromLLMOptions(
|
||||
const {
|
||||
llmRef, llmTemperature, llmResponseTokens, llmTopP, llmForceNoStream,
|
||||
llmVndAntEffort, llmVndGemEffort, llmVndOaiEffort, llmVndMiscEffort,
|
||||
llmVndAnt1MContext, llmVndAntInfSpeed, llmVndAntSkills, llmVndAntThinkingBudget, llmVndAntWebFetch, llmVndAntWebSearch,
|
||||
llmVndAnt1MContext, llmVndAntInfSpeed, llmVndAntSkills, llmVndAntThinkingBudget, llmVndAntWebFetch, llmVndAntWebFetchMaxUses, llmVndAntWebSearch, llmVndAntWebSearchMaxUses,
|
||||
llmVndBedrockAPI,
|
||||
llmVndGeminiAspectRatio, llmVndGeminiImageSize, llmVndGeminiCodeExecution, llmVndGeminiComputerUse, llmVndGeminiGoogleSearch, llmVndGeminiMediaResolution, llmVndGeminiThinkingBudget,
|
||||
// llmVndMoonshotWebSearch,
|
||||
@@ -115,8 +115,8 @@ export function aixCreateModelFromLLMOptions(
|
||||
...(llmVndAnt1MContext ? { vndAnt1MContext: llmVndAnt1MContext } : {}),
|
||||
...(llmVndAntInfSpeed === 'fast' ? { vndAntInfSpeed: 'fast' } : {}),
|
||||
...(llmVndAntSkills ? { vndAntSkills: llmVndAntSkills } : {}),
|
||||
...(llmVndAntWebFetch === 'auto' ? { vndAntWebFetch: llmVndAntWebFetch } : {}),
|
||||
...(llmVndAntWebSearch === 'auto' ? { vndAntWebSearch: llmVndAntWebSearch } : {}),
|
||||
...(llmVndAntWebFetch === 'auto' ? { vndAntWebFetch: llmVndAntWebFetch, ...(llmVndAntWebFetchMaxUses ? { vndAntWebFetchMaxUses: llmVndAntWebFetchMaxUses } : {}) } : {}),
|
||||
...(llmVndAntWebSearch === 'auto' ? { vndAntWebSearch: llmVndAntWebSearch, ...(llmVndAntWebSearchMaxUses ? { vndAntWebSearchMaxUses: llmVndAntWebSearchMaxUses } : {}) } : {}),
|
||||
|
||||
// Bedrock
|
||||
...(llmVndBedrockAPI ? { vndBedrockAPI: llmVndBedrockAPI } : {}),
|
||||
|
||||
@@ -482,7 +482,9 @@ export namespace AixWire_API {
|
||||
vndAntThinkingBudget: z.number().or(z.literal('adaptive')).nullable().optional(),
|
||||
vndAntToolSearch: z.enum(['regex', 'bm25']).optional(), // Tool Search Tool variant
|
||||
vndAntWebFetch: z.enum(['auto']).optional(),
|
||||
vndAntWebFetchMaxUses: z.number().int().min(1).max(50).optional(),
|
||||
vndAntWebSearch: z.enum(['auto']).optional(),
|
||||
vndAntWebSearchMaxUses: z.number().int().min(1).max(50).optional(),
|
||||
|
||||
// Bedrock
|
||||
vndBedrockAPI: z.enum(['converse', 'invoke-anthropic', 'mantle']).optional(),
|
||||
|
||||
@@ -7,6 +7,8 @@ import { aixSpillShallFlush, aixSpillSystemToUser, approxDocPart_To_String, appr
|
||||
|
||||
|
||||
// configuration
|
||||
const DEFAULT_WEB_FETCH_MAX_USES = 5;
|
||||
const DEFAULT_WEB_SEARCH_MAX_USES = 10;
|
||||
const hotFixImagePartsFirst = true;
|
||||
const hotFixMapModelImagesToUser = true;
|
||||
const hotFixDisableThinkingWhenToolsForced = true; // "Thinking may not be enabled when tool_choice forces tool use."
|
||||
@@ -216,7 +218,7 @@ export function aixToAnthropicMessageCreate(model: AixAPI_Model, _chatGenerate:
|
||||
hostedTools.push({
|
||||
type: 'web_search_20250305',
|
||||
name: 'web_search',
|
||||
max_uses: 10, // Allow up to 10 progressive searches // FIXME: HARDCODED
|
||||
max_uses: model.vndAntWebSearchMaxUses ?? DEFAULT_WEB_SEARCH_MAX_USES, // Allow up to 10 searches by default
|
||||
// Pass user geolocation for location-aware search results
|
||||
...(model.userGeolocation ? {
|
||||
user_location: { type: 'approximate' as const, ...model.userGeolocation },
|
||||
@@ -229,7 +231,7 @@ export function aixToAnthropicMessageCreate(model: AixAPI_Model, _chatGenerate:
|
||||
hostedTools.push({
|
||||
type: 'web_fetch_20250910',
|
||||
name: 'web_fetch',
|
||||
max_uses: 5, // Allow up to 5 fetches
|
||||
max_uses: model.vndAntWebFetchMaxUses ?? DEFAULT_WEB_FETCH_MAX_USES, // Allow up to 5 fetches by default
|
||||
citations: { enabled: true }, // Enable citations
|
||||
});
|
||||
}
|
||||
|
||||
@@ -243,7 +243,9 @@ export function LLMParametersEditor(props: {
|
||||
llmVndAntSkills,
|
||||
llmVndAntThinkingBudget,
|
||||
llmVndAntWebFetch,
|
||||
llmVndAntWebFetchMaxUses,
|
||||
llmVndAntWebSearch,
|
||||
llmVndAntWebSearchMaxUses,
|
||||
llmVndGemEffort,
|
||||
llmVndGeminiAspectRatio,
|
||||
llmVndGeminiCodeExecution,
|
||||
@@ -458,6 +460,18 @@ export function LLMParametersEditor(props: {
|
||||
/>
|
||||
)}
|
||||
|
||||
{showParam('llmVndAntWebSearchMaxUses') && (
|
||||
<FormSliderControl
|
||||
title='Search Max Uses' ariaLabel='Anthropic Web Search Max Uses'
|
||||
description='Per response'
|
||||
min={1} max={50} step={1} defaultValue={10}
|
||||
disabled={llmVndAntWebSearch !== 'auto'}
|
||||
valueLabelDisplay={props.parameters?.llmVndAntWebSearchMaxUses !== undefined ? 'on' : 'auto'}
|
||||
value={llmVndAntWebSearchMaxUses ?? 10}
|
||||
onChange={value => onChangeParameter({ llmVndAntWebSearchMaxUses: value })}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showParam('llmVndAntWebFetch') && (
|
||||
<FormSelectControl
|
||||
title='Web Fetch'
|
||||
@@ -471,6 +485,18 @@ export function LLMParametersEditor(props: {
|
||||
/>
|
||||
)}
|
||||
|
||||
{showParam('llmVndAntWebFetchMaxUses') && (
|
||||
<FormSliderControl
|
||||
title='Fetch Max Uses' ariaLabel='Anthropic Web Fetch Max Uses'
|
||||
description='Per response'
|
||||
min={1} max={50} step={1} defaultValue={5}
|
||||
disabled={llmVndAntWebFetch !== 'auto'}
|
||||
valueLabelDisplay={props.parameters?.llmVndAntWebFetchMaxUses !== undefined ? 'on' : 'auto'}
|
||||
value={llmVndAntWebFetchMaxUses ?? 5}
|
||||
onChange={value => onChangeParameter({ llmVndAntWebFetchMaxUses: value })}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showParam('llmVndAnt1MContext') && (
|
||||
<FormSwitchControl
|
||||
title='1M Context Window (Beta)'
|
||||
|
||||
@@ -25,9 +25,11 @@ const IF_4_R = [...IF_4, LLM_IF_OAI_Reasoning];
|
||||
// - llmVndAntWebFetch/Search seem an API feature available on all models
|
||||
|
||||
const ANT_TOOLS: ModelDescriptionSchema['parameterSpecs'] = [
|
||||
{ paramId: 'llmVndAntWebSearch' },
|
||||
{ paramId: 'llmVndAntWebFetch' },
|
||||
{ paramId: 'llmVndAntSkills' },
|
||||
{ paramId: 'llmVndAntWebFetch' },
|
||||
{ paramId: 'llmVndAntWebFetchMaxUses' },
|
||||
{ paramId: 'llmVndAntWebSearch' },
|
||||
{ paramId: 'llmVndAntWebSearchMaxUses' },
|
||||
] as const;
|
||||
|
||||
|
||||
|
||||
@@ -87,7 +87,9 @@ const ModelParameterSpec_schema = z.object({
|
||||
'llmVndAntSkills',
|
||||
'llmVndAntThinkingBudget',
|
||||
'llmVndAntWebFetch',
|
||||
'llmVndAntWebFetchMaxUses',
|
||||
'llmVndAntWebSearch',
|
||||
'llmVndAntWebSearchMaxUses',
|
||||
// Bedrock
|
||||
'llmVndBedrockAPI',
|
||||
// Gemini
|
||||
|
||||
Reference in New Issue
Block a user