Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
GEMINI_API_KEY=
GOOGLE_API_KEY=
OPENAI_API_KEY=
# Optional OpenAI-compatible API endpoint base URL (for example, a local gateway)
OPENAI_BASE_URL=
ANTHROPIC_API_KEY=
OPEN_ROUTER_API_KEY=
XAI_API_KEY=
Expand Down
4 changes: 2 additions & 2 deletions apps/showcase_ui/src/app/pages/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,9 @@ <h3 class="step-title">AI Model Setup</h3>
<span class="metric-label">Default Model</span>
<div class="metric-val-pill">
<span class="provider-dot"></span>
<span class="provider-name">{{ modelConfigEnv()?.default_model?.provider || 'google' }}</span>
<span class="provider-name">{{ modelConfigEnv()?.default_model?.provider || '—' }}</span>
<span class="model-divider">/</span>
<span class="model-name">{{ modelConfigEnv()?.default_model?.model || 'gemini-3.8-flash' }}</span>
<span class="model-name">{{ modelConfigEnv()?.default_model?.model || '—' }}</span>
</div>
</div>

Expand Down
78 changes: 78 additions & 0 deletions apps/showcase_ui/src/app/pages/home/home.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/**
* Copyright 2026 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { signal } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { provideRouter } from '@angular/router';
import { of } from 'rxjs';

import { AgentService } from '../../services/agent.service';
import { SystemService } from '../../services/system.service';
import { TaskRecommendationService } from '../../core/services/task-recommendation.service';
import { HomeComponent } from './home.component';

describe('HomeComponent model setup mode', () => {
const storageKey = 'artemis_model_setup_mode';
let systemService: {
apiKeysMap: ReturnType<typeof signal<Record<string, string>>>;
currentApiKey: ReturnType<typeof signal<string>>;
setSkipCredentialsCheck: jasmine.Spy;
fetchReadiness: jasmine.Spy;
fetchModelConfigEnv: jasmine.Spy;
fetchAdbServerStatus: jasmine.Spy;
};

beforeEach(async () => {
localStorage.removeItem(storageKey);
systemService = {
apiKeysMap: signal<Record<string, string>>({}),
currentApiKey: signal(''),
setSkipCredentialsCheck: jasmine.createSpy('setSkipCredentialsCheck'),
fetchReadiness: jasmine.createSpy('fetchReadiness').and.returnValue(of(null)),
fetchModelConfigEnv: jasmine.createSpy('fetchModelConfigEnv').and.returnValue(of(null)),
fetchAdbServerStatus: jasmine.createSpy('fetchAdbServerStatus').and.returnValue(
of({ endpoint: { mode: 'local' } })
)
};

await TestBed.configureTestingModule({
imports: [HomeComponent],
providers: [
provideRouter([]),
{ provide: AgentService, useValue: { getProTuningDefaults: () => of({}) } },
{ provide: SystemService, useValue: systemService },
{ provide: TaskRecommendationService, useValue: {} }
]
}).compileComponents();
});

afterEach(() => localStorage.removeItem(storageKey));

it('persists and restores the custom setup choice', () => {
const first = TestBed.createComponent(HomeComponent);
first.componentInstance.setModelSetupMode('custom');

expect(localStorage.getItem(storageKey)).toBe('custom');
first.destroy();

const second = TestBed.createComponent(HomeComponent);
second.componentInstance.ngOnInit();

expect(second.componentInstance.modelSetupMode()).toBe('custom');
expect(systemService.setSkipCredentialsCheck).toHaveBeenCalledWith(true);
second.destroy();
});
});
34 changes: 31 additions & 3 deletions apps/showcase_ui/src/app/pages/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ export interface TuningSliderVm {
export type { AppReference, SmartSuggestion, SuggestionCategory };

type AdbGuideTab = 'emulator' | 'usb' | 'wifi' | 'remote';
type ModelSetupMode = 'gemini' | 'custom';

const MODEL_SETUP_MODE_STORAGE_KEY = 'artemis_model_setup_mode';

@Component({
selector: 'app-home',
Expand All @@ -121,8 +123,8 @@ export class HomeComponent implements OnInit, OnDestroy {
public activeAdbGuideTab = signal<AdbGuideTab>('emulator');
public emulatorSetupMode = signal<'studio' | 'cli'>('studio');

// Interactive guide tab for LLM / OCR credentials: 'gemini' | 'ocr'
public modelSetupMode = signal<'gemini' | 'custom'>('gemini');
// Interactive guide tab for LLM credentials: 'gemini' | 'custom'
public modelSetupMode = signal<ModelSetupMode>('gemini');
public showOcrConfig = signal<boolean>(false);
public showFullConfigFile = signal<boolean>(false);

Expand Down Expand Up @@ -536,6 +538,9 @@ export class HomeComponent implements OnInit, OnDestroy {
}

ngOnInit(): void {
const savedMode = this.getSavedModelSetupMode();
this.modelSetupMode.set(savedMode);
this.systemService.setSkipCredentialsCheck(savedMode === 'custom');

this.loadProTuningDefaults();
// Initial fetch of system readiness & model configuration
Expand Down Expand Up @@ -581,8 +586,9 @@ export class HomeComponent implements OnInit, OnDestroy {
this.emulatorSetupMode.set(mode);
}

public setModelSetupMode(mode: 'gemini' | 'custom'): void {
public setModelSetupMode(mode: ModelSetupMode): void {
this.modelSetupMode.set(mode);
this.saveModelSetupMode(mode);
if (mode === 'custom') {
this.systemService.setSkipCredentialsCheck(true);
this.systemService.fetchModelConfigEnv().subscribe();
Expand All @@ -591,6 +597,28 @@ export class HomeComponent implements OnInit, OnDestroy {
}
}

private getSavedModelSetupMode(): ModelSetupMode {
if (typeof localStorage === 'undefined') {
return 'gemini';
}
try {
return localStorage.getItem(MODEL_SETUP_MODE_STORAGE_KEY) === 'custom' ? 'custom' : 'gemini';
} catch {
return 'gemini';
}
}

private saveModelSetupMode(mode: ModelSetupMode): void {
if (typeof localStorage === 'undefined') {
return;
}
try {
localStorage.setItem(MODEL_SETUP_MODE_STORAGE_KEY, mode);
} catch {
// Keep the in-memory selection if browser storage is unavailable.
}
}

public toggleFullConfigFile(): void {
this.showFullConfigFile.update(v => !v);
}
Expand Down
17 changes: 8 additions & 9 deletions artemis/agents/flash/summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

from artemis.context import ArtemisContext
from artemis.memory.step_memory import JobKey, StepMemoryService
from artemis.services.llm import RobustChatModelWrapper, get_google_llm, get_llm
from artemis.services.llm import RobustChatModelWrapper, get_llm
from artemis.services.token_meter import record_llm_usage
from artemis.utils.task_tree import format_actions_clean
from artemis.utils.visualization import draw_action_overlay_on_image
Expand Down Expand Up @@ -161,16 +161,15 @@ def __init__(
flush_timeout_s=flush_timeout_s,
)

# Initialize lightweight VLM: prioritize explicit model_name
# Resolve the configured summarizer provider, applying an optional model override.
target_model = model_name or "gemini-2.5-flash-lite"
self._model_name = target_model
try:
if model_name:
self._llm = get_google_llm(model_name=target_model, temperature=0.0)
else:
self._llm = get_llm(ctx, name="summarizer", is_utils=True)
except Exception:
self._llm = get_google_llm(model_name=target_model, temperature=0.0)
self._llm = get_llm(
ctx,
name="summarizer",
model_name=model_name,
temperature=0.0,
)
try:
configured = getattr(self._llm, "model", None) or getattr(self._llm, "model_name", None)
if isinstance(configured, str) and configured:
Expand Down
8 changes: 7 additions & 1 deletion artemis/llm/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,15 @@ def create_model(cls, endpoint: ModelEndpoint) -> BaseChatModel:
base_url = endpoint.api_base or (
str(settings.OPENAI_BASE_URL) if settings.OPENAI_BASE_URL else None
)
# Copilot's OpenAI-compatible reasoning models reject temperature.
temperature = (
None
if endpoint.model_name.strip().lower().startswith("copilot/")
else endpoint.temperature
)
kwargs = {
"model": endpoint.model_name,
"temperature": endpoint.temperature,
"temperature": temperature,
"max_tokens": endpoint.max_tokens,
"api_key": api_key,
"base_url": base_url,
Expand Down
8 changes: 7 additions & 1 deletion artemis/services/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,11 +945,17 @@ def _get_llm(
is_utils: bool = False,
use_fallback: bool = False,
temperature: float | None = None,
model_name: str | None = None,
) -> BaseChatModel:
"""Resolves and instantiates the appropriate LLM wrapper for the given agent role."""
endpoint = _resolve_endpoint(ctx, name, is_utils=is_utils, use_fallback=use_fallback)
updates: dict[str, Any] = {}
if temperature is not None:
endpoint = endpoint.model_copy(update={"temperature": temperature})
updates["temperature"] = temperature
if model_name is not None:
updates["model_name"] = model_name
if updates:
endpoint = endpoint.model_copy(update=updates)
raw_model = ModelFactory.get_model(endpoint)

handler = DataEngineCallbackHandler(ctx)
Expand Down
58 changes: 29 additions & 29 deletions config/artemis.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
// 1. Global Default Model (Applied to all sub-agents unless overridden below)
// ------------------------------------------------------------------------------
"default": {
"provider": "google",
"model": "gemini-3.8-flash",
"provider": "openai",
"model": "copilot/gpt-6.1-sol",
"thinking_level": "medium",
"fallback": {
"provider": "google",
"model": "gemini-3.7-flash",
"provider": "openai",
"model": "copilot/gpt-6.1-terra",
"thinking_level": "medium"
}
},
Expand All @@ -22,29 +22,29 @@
// ------------------------------------------------------------------------------
"presets": {
"gemini-flagship": {
"provider": "google",
"model": "gemini-3.8-flash",
"fallback": { "provider": "google", "model": "gemini-3.7-flash" }
"provider": "openai",
"model": "copilot/gpt-6.1-sol",
"fallback": { "provider": "openai", "model": "copilot/gpt-6.1-terra" }
},
"gemini-flash": {
"provider": "google",
"model": "gemini-2.5-flash",
"fallback": { "provider": "google", "model": "gemini-2.0-flash" }
"provider": "openai",
"model": "copilot/gpt-6-sol",
"fallback": { "provider": "openai", "model": "copilot/gpt-6.1-terra" }
},
"openai-gpt4o": {
"provider": "openai",
"model": "gpt-4o",
"fallback": { "provider": "openai", "model": "gpt-4o-mini" }
"model": "copilot/gpt-6.1-sol",
"fallback": { "provider": "openai", "model": "copilot/gpt-6-sol" }
},
"cost-saving": {
"provider": "google",
"model": "gemini-3.5-flash-lite",
"fallback": { "provider": "google", "model": "gemini-3.1-flash-lite" }
"provider": "openai",
"model": "copilot/gpt-5.6-sol",
"fallback": { "provider": "openai", "model": "copilot/gpt-5.6-terra" }
},
"local-ollama": {
"provider": "openai",
"model": "llama3.2-vision",
"fallback": { "provider": "openai", "model": "llama3.2-vision" }
"model": "copilot/gpt-6.1-sol",
"fallback": { "provider": "openai", "model": "copilot/gpt-6.1-terra" }
}
},

Expand All @@ -71,14 +71,13 @@
"video_analyzer": {},

// 👁️ Object Detector & Explorer (Flash Mode): Visual coordinates grounding and bounding boxes
// CRITICAL REQUIREMENT: Standard LLMs (including standard Gemini Flash, GPT-4o, Claude 3.7) lack sub-pixel spatial coordinate fine-tuning.
// To achieve accurate [x, y] point and bounding box localization, this node MUST use specialized Gemini ER (Embodied Reasoning / Robotics) models:
// e.g., "gemini-robotics-er-2-preview". Non-ER models will fail spatial coordinate detection.
// This uses a Copilot model rather than a specialized Gemini ER model; coordinate localization may be less reliable.
"object_detector": {
"model": "gemini-robotics-er-2-preview",
"provider": "openai",
"model": "copilot/gpt-6.1-sol",
"fallback": {
"provider": "google",
"model": "gemini-robotics-er-2-preview"
"provider": "openai",
"model": "copilot/gpt-6.1-terra"
}
},

Expand All @@ -95,10 +94,11 @@

// 🔽 Hopper: Fast lightweight package name locator
"hopper": {
"model": "gemini-3.5-flash-lite",
"provider": "openai",
"model": "copilot/gpt-5.6-sol",
"fallback": {
"provider": "google",
"model": "gemini-3.1-flash-lite"
"provider": "openai",
"model": "copilot/gpt-5.6-terra"
}
},

Expand All @@ -125,7 +125,7 @@
}
// 🎯 Planner Validation: Advisory review of milestone changes.
// Defaults to the same lightweight model as the pixel safety net
// (gemini-3.5-flash-lite, temperature 0); add "planner_validation": {...} here to override.
// (copilot/gpt-5.6-sol, temperature 0); add "planner_validation": {...} here to override.
},

// ------------------------------------------------------------------------------
Expand All @@ -145,7 +145,7 @@
// replacing images only after strictly objective, high-density summaries are ready.
"step_summarizer": {
"enabled": true, // Whether background step summarization is active
"model": "gemini-3.5-flash-lite", // Lightweight model for fast background inference
"model": "copilot/gpt-5.6-sol", // Lightweight model for fast background inference
"prune_history_xml": true // Prune outdated heavy XML trees from historical steps
}
},
Expand Down Expand Up @@ -246,7 +246,7 @@
// call each); milestone closes are exempt, the hard line waives it.
"min_steps": 3,
"target_source_tokens": 2000,
"model": "gemini-3.8-flash",
"model": "copilot/gpt-6.1-sol",
"max_chunks": 8
// "max_eras": 8 // independent era cap; omitted = follows max_chunks
},
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/agents/test_flash_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def mock_context():
ctx = Mock(spec=ArtemisContext)
ctx.llm_config = Mock()
mock_llm_cfg = Mock()
mock_llm_cfg.model = "gemini-2.5-flash"
mock_llm_cfg.provider = "openai"
mock_llm_cfg.model = "gpt-4o-mini"
mock_llm_cfg.temperature = 0.1
ctx.llm_config.get_agent.return_value = mock_llm_cfg

Expand Down
Loading
Loading