mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
LLMs: Gemini Parameters
This commit is contained in:
@@ -126,6 +126,24 @@ export const DModelParameterRegistry = {
|
||||
// No initial value - when undefined, the model decides the aspect ratio
|
||||
} as const,
|
||||
|
||||
llmVndGeminiCodeExecution: {
|
||||
label: 'Code Execution',
|
||||
type: 'enum' as const,
|
||||
description: 'Enable automatic Python code generation and execution by the model',
|
||||
values: ['auto'] as const,
|
||||
// No initialValue - undefined means off
|
||||
} as const,
|
||||
|
||||
llmVndGeminiComputerUse: {
|
||||
label: 'Computer Use Environment',
|
||||
type: 'enum' as const,
|
||||
description: 'Environment type for Computer Use tool (required for Computer Use model)',
|
||||
values: ['browser'] as const,
|
||||
initialValue: 'browser',
|
||||
// requiredFallback: 'browser', // See `const _requiredParamId: DModelParameterId[]` in llms.parameters.ts for why custom params don't have required values at AIX invocation...
|
||||
hidden: true,
|
||||
} as const,
|
||||
|
||||
llmVndGeminiGoogleSearch: {
|
||||
label: 'Google Search',
|
||||
type: 'enum' as const,
|
||||
@@ -134,6 +152,14 @@ export const DModelParameterRegistry = {
|
||||
// No initialValue - undefined means off
|
||||
} as const,
|
||||
|
||||
llmVndGeminiMediaResolution: {
|
||||
label: 'Media Resolution',
|
||||
type: 'enum' as const,
|
||||
description: 'Controls vision processing quality for multimodal inputs. Higher resolution improves text reading and detail identification but increases token usage.',
|
||||
values: ['mr_high', 'mr_medium', 'mr_low'] as const,
|
||||
// No initialValue - undefined: "If unspecified, the model uses optimal defaults based on the media type." (Images: high, PDFs: medium, Videos: low/medium (rec: high for OCR))
|
||||
} as const,
|
||||
|
||||
llmVndGeminiShowThoughts: {
|
||||
label: 'Show Thoughts',
|
||||
type: 'boolean' as const,
|
||||
@@ -154,16 +180,23 @@ export const DModelParameterRegistry = {
|
||||
description: 'Budget for extended thinking. 0 disables thinking. If not set, the model chooses automatically.',
|
||||
} as const,
|
||||
|
||||
llmVndGeminiComputerUse: {
|
||||
label: 'Computer Use Environment',
|
||||
llmVndGeminiThinkingLevel: {
|
||||
label: 'Thinking Level',
|
||||
type: 'enum' as const,
|
||||
description: 'Environment type for Computer Use tool (required for Computer Use model)',
|
||||
values: ['browser'] as const,
|
||||
initialValue: 'browser',
|
||||
// requiredFallback: 'browser', // See `const _requiredParamId: DModelParameterId[]` in llms.parameters.ts for why custom params don't have required values at AIX invocation...
|
||||
hidden: true,
|
||||
description: 'Controls internal reasoning depth. Replaces thinking_budget for Gemini 3 models. When unset, the model decides dynamically.',
|
||||
values: ['high', 'medium' /* not present at launch */, 'low' /* default when unset */] as const,
|
||||
// No initialValue - undefined means 'dynamic', which for Gemini Pro is the same as 'high' (which is the equivalent of 'medium' for OpenAI's effort levels.. somehow)
|
||||
} as const,
|
||||
|
||||
// NOTE: we don't have this as a parameter, as for now we use it in tandem with llmVndGeminiGoogleSearch
|
||||
// llmVndGeminiUrlContext: {
|
||||
// label: 'URL Context',
|
||||
// type: 'enum' as const,
|
||||
// description: 'Enable fetching and analyzing content from URLs provided in prompts (up to 20 URLs, 34MB each)',
|
||||
// values: ['auto'] as const,
|
||||
// // No initialValue - undefined means off
|
||||
// } as const,
|
||||
|
||||
// Moonshot-specific parameters
|
||||
|
||||
llmVndMoonshotWebSearch: {
|
||||
@@ -362,7 +395,7 @@ export function applyModelParameterInitialValues(destValues: DModelParameterValu
|
||||
const _requiredParamId: DModelParameterId[] = [
|
||||
// 'llmRef', // disabled: we know this can't have a fallback value in the registry
|
||||
'llmResponseTokens', // DModelParameterRegistry.llmResponseTokens.requiredFallback = FALLBACK_LLM_PARAM_RESPONSE_TOKENS
|
||||
'llmTemperature' // DModelParameterRegistry.llmTemperature.requiredFallback = FALLBACK_LLM_PARAM_TEMPERATURE
|
||||
'llmTemperature', // DModelParameterRegistry.llmTemperature.requiredFallback = FALLBACK_LLM_PARAM_TEMPERATURE
|
||||
] as const;
|
||||
|
||||
export function getAllModelParameterValues(initialParameters: undefined | DModelParameterValues, userParameters?: DModelParameterValues): DModelParameterValues {
|
||||
|
||||
@@ -68,6 +68,11 @@ const _geminiAspectRatioOptions = [
|
||||
{ value: '21:9', label: '21:9', description: 'Ultra wide' },
|
||||
] as const;
|
||||
|
||||
const _geminiCodeExecutionOptions = [
|
||||
{ value: 'auto', label: 'On', description: 'Enable code generation and execution' },
|
||||
{ value: _UNSPECIFIED, label: 'Off', description: 'Disabled (default)' },
|
||||
] as const;
|
||||
|
||||
const _geminiGoogleSearchOptions = [
|
||||
{ value: 'unfiltered', label: 'On', description: 'Web Search' },
|
||||
{ value: '1d', label: 'Last Day', description: 'Last 24 hours' },
|
||||
@@ -78,6 +83,20 @@ const _geminiGoogleSearchOptions = [
|
||||
{ value: _UNSPECIFIED, label: 'Off', description: 'Default (disabled)' },
|
||||
] as const;
|
||||
|
||||
const _geminiMediaResolutionOptions = [
|
||||
{ value: 'mr_high', label: 'High', description: 'Best quality, higher token usage' },
|
||||
{ value: 'mr_medium', label: 'Medium', description: 'Balanced quality and cost' },
|
||||
{ value: 'mr_low', label: 'Low', description: 'Faster, lower cost' },
|
||||
{ value: _UNSPECIFIED, label: 'Auto', description: 'Model optimizes based on media type (default)' },
|
||||
] as const;
|
||||
|
||||
const _geminiThinkingLevelOptions = [
|
||||
{ value: 'high', label: 'High', description: 'Maximum reasoning depth' },
|
||||
{ value: 'medium', label: 'Medium', description: 'Balanced reasoning' },
|
||||
{ value: 'low', label: 'Low', description: 'Quick responses (default when unset)' },
|
||||
{ value: _UNSPECIFIED, label: 'Dynamic', description: 'Model decides automatically (default)' },
|
||||
] as const;
|
||||
|
||||
const _xaiSearchModeOptions = [
|
||||
{ value: 'auto', label: 'Auto', description: 'Model decides (default)' },
|
||||
{ value: 'on', label: 'On', description: 'Always search active sources' },
|
||||
@@ -166,9 +185,12 @@ export function LLMParametersEditor(props: {
|
||||
llmVndAntWebFetch,
|
||||
llmVndAntWebSearch,
|
||||
llmVndGeminiAspectRatio,
|
||||
llmVndGeminiCodeExecution,
|
||||
llmVndGeminiGoogleSearch,
|
||||
llmVndGeminiMediaResolution,
|
||||
llmVndGeminiShowThoughts,
|
||||
llmVndGeminiThinkingBudget,
|
||||
llmVndGeminiThinkingLevel,
|
||||
// llmVndMoonshotWebSearch,
|
||||
llmVndOaiReasoningEffort,
|
||||
llmVndOaiReasoningEffort4,
|
||||
@@ -390,6 +412,19 @@ export function LLMParametersEditor(props: {
|
||||
/>
|
||||
)}
|
||||
|
||||
{showParam('llmVndGeminiCodeExecution') && (
|
||||
<FormSelectControl
|
||||
title='Code Execution'
|
||||
tooltip='Enable automatic Python code generation and execution by the model'
|
||||
value={llmVndGeminiCodeExecution ?? _UNSPECIFIED}
|
||||
onChange={(value) => {
|
||||
if (value === _UNSPECIFIED || !value) onRemoveParameter('llmVndGeminiCodeExecution');
|
||||
else onChangeParameter({ llmVndGeminiCodeExecution: value });
|
||||
}}
|
||||
options={_geminiCodeExecutionOptions}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showParam('llmVndGeminiGoogleSearch') && (
|
||||
<FormSelectControl
|
||||
title='Google Search'
|
||||
@@ -403,6 +438,32 @@ export function LLMParametersEditor(props: {
|
||||
/>
|
||||
)}
|
||||
|
||||
{showParam('llmVndGeminiMediaResolution') && (
|
||||
<FormSelectControl
|
||||
title='Media Resolution'
|
||||
tooltip='Controls vision processing quality for multimodal inputs. Higher resolution improves text reading and detail identification but increases token usage.'
|
||||
value={llmVndGeminiMediaResolution ?? _UNSPECIFIED}
|
||||
onChange={(value) => {
|
||||
if (value === _UNSPECIFIED || !value) onRemoveParameter('llmVndGeminiMediaResolution');
|
||||
else onChangeParameter({ llmVndGeminiMediaResolution: value });
|
||||
}}
|
||||
options={_geminiMediaResolutionOptions}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showParam('llmVndGeminiThinkingLevel') && (
|
||||
<FormSelectControl
|
||||
title='Thinking Level'
|
||||
tooltip='Controls internal reasoning depth. Replaces thinking_budget for Gemini 3 models. When unset, the model decides dynamically.'
|
||||
value={llmVndGeminiThinkingLevel ?? _UNSPECIFIED}
|
||||
onChange={(value) => {
|
||||
if (value === _UNSPECIFIED || !value) onRemoveParameter('llmVndGeminiThinkingLevel');
|
||||
else onChangeParameter({ llmVndGeminiThinkingLevel: value });
|
||||
}}
|
||||
options={_geminiThinkingLevelOptions}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
{/*{showParam('llmVndMoonshotWebSearch') && (*/}
|
||||
{/* <FormSelectControl*/}
|
||||
|
||||
@@ -77,17 +77,25 @@ const ModelParameterSpec_schema = z.object({
|
||||
paramId: z.enum([
|
||||
'llmTopP',
|
||||
'llmForceNoStream',
|
||||
// Anthropic
|
||||
'llmVndAnt1MContext',
|
||||
'llmVndAntSkills',
|
||||
'llmVndAntThinkingBudget',
|
||||
'llmVndAntWebFetch',
|
||||
'llmVndAntWebSearch',
|
||||
// Gemini
|
||||
'llmVndGeminiAspectRatio',
|
||||
'llmVndGeminiCodeExecution',
|
||||
'llmVndGeminiComputerUse',
|
||||
'llmVndGeminiGoogleSearch',
|
||||
'llmVndGeminiMediaResolution',
|
||||
'llmVndGeminiShowThoughts',
|
||||
'llmVndGeminiThinkingBudget',
|
||||
'llmVndGeminiThinkingLevel',
|
||||
// 'llmVndGeminiUrlContext',
|
||||
// Moonshot
|
||||
'llmVndMoonshotWebSearch',
|
||||
// OpenAI
|
||||
'llmVndOaiReasoningEffort',
|
||||
'llmVndOaiReasoningEffort4',
|
||||
'llmVndOaiRestoreMarkdown',
|
||||
@@ -95,9 +103,12 @@ const ModelParameterSpec_schema = z.object({
|
||||
'llmVndOaiWebSearchContext',
|
||||
'llmVndOaiWebSearchGeolocation',
|
||||
'llmVndOaiImageGeneration',
|
||||
// OpenRouter
|
||||
'llmVndOrtWebSearch',
|
||||
// Perplexity
|
||||
'llmVndPerplexityDateFilter',
|
||||
'llmVndPerplexitySearchMode',
|
||||
// xAI
|
||||
'llmVndXaiSearchMode',
|
||||
'llmVndXaiSearchSources',
|
||||
'llmVndXaiSearchDateFilter',
|
||||
|
||||
Reference in New Issue
Block a user