mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 11:04:42 -07:00
feat(core): Wire up chat code path for model configs. (#12850)
This commit is contained in:
@@ -231,4 +231,42 @@ describe('ModelConfigService Integration', () => {
|
||||
topP: 0.95, // from base
|
||||
});
|
||||
});
|
||||
|
||||
it('should correctly merge static aliases, runtime aliases, and overrides', () => {
|
||||
// Re-instantiate service for this isolated test to not pollute other tests
|
||||
const service = new ModelConfigService(complexConfig);
|
||||
|
||||
// Register a runtime alias, simulating what AgentExecutor does.
|
||||
// This alias extends a static base and provides its own settings.
|
||||
service.registerRuntimeModelConfig('agent-runtime:my-agent', {
|
||||
extends: 'creative-writer', // extends a multi-level alias
|
||||
modelConfig: {
|
||||
generateContentConfig: {
|
||||
temperature: 0.1, // Overrides parent
|
||||
maxOutputTokens: 8192, // Adds a new property
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Resolve the configuration for the runtime alias, with a matching agent scope
|
||||
const resolved = service.getResolvedConfig({
|
||||
model: 'agent-runtime:my-agent',
|
||||
overrideScope: 'core',
|
||||
});
|
||||
|
||||
// Assert the final merged configuration.
|
||||
expect(resolved.model).toBe('gemini-1.5-pro-latest'); // from 'default-text-model'
|
||||
expect(resolved.generateContentConfig).toEqual({
|
||||
// from 'core' agent override, wins over runtime alias's 0.1 and creative-writer's 0.9
|
||||
temperature: 0.5,
|
||||
// from 'base' alias
|
||||
topP: 0.95,
|
||||
// from 'creative-writer' alias
|
||||
topK: 50,
|
||||
// from runtime alias
|
||||
maxOutputTokens: 8192,
|
||||
// from 'core' agent override
|
||||
stopSequences: ['AGENT_STOP'],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user