feat: add agentic video analysis and clarify action results
Report device actions as dispatched and preserve full failure details. Route Flash through McpActionExecutor and use ToolFailure across helper tools and agent loops instead of inferring failure from response text. Require model-provided descriptions for coordinate targets. Keep observed element metadata separate from those descriptions in safety checks, visual summaries, history, and frontend labels. Add Gemini Interactions API video analysis with configurable processing mode, chunk size, and timeouts. Centralize Google provider capabilities and token usage normalization, and update google-genai to 2.22.0. Preserve system instructions on follow-up interactions, replan pending chunks when falling back to static processing, and reject unanswered native video and audio segments instead of caching placeholder results. Keep helper-tool failure status intact through history tools and committee calls. Validation: 1,762 Python unit tests passed (3 skipped), 40 frontend formatter tests passed, and the production UI build completed. Ruff lint, formatting, the quality ratchet, and git diff checks passed.
This commit is contained in:
1 parent
611d1a0947
commit
a45daf23f8
120 files changed
+6301
-1710
No files matched your search
@@ -26,6 +26,7 @@ from artemis.config.constants import (
|
||||
ExplorerVersion,
|
||||
)
|
||||
from artemis.config.paths import ROOT_DIR, get_config_path
|
||||
from artemis.llm.google import VideoProcessing
|
||||
from artemis.utils.file import load_jsonc
|
||||
from artemis.utils.logger import get_logger
|
||||
|
||||
@@ -109,6 +110,30 @@ class VideoAnalyzerConfig(BaseModel):
|
||||
le=600.0,
|
||||
description="Hard timeout for one native or universal video-model response.",
|
||||
)
|
||||
processing: VideoProcessing = Field(
|
||||
default="auto",
|
||||
description=(
|
||||
"How Gemini sub-agents watch a clip. 'agentic' lets the model search,"
|
||||
" scan and re-watch the clip on demand (Gemini Interactions API);"
|
||||
" 'static' samples it at a fixed frame rate; 'auto' picks agentic on"
|
||||
" Gemini 3.6+ Flash models and static everywhere else."
|
||||
),
|
||||
)
|
||||
agentic_chunk_size_seconds: float = Field(
|
||||
default=600.0,
|
||||
ge=30.0,
|
||||
le=1800.0,
|
||||
description=(
|
||||
"Maximum clip length handed to one agentic sub-agent. Static mode keeps"
|
||||
" using chunk_size_seconds."
|
||||
),
|
||||
)
|
||||
agentic_call_timeout_seconds: float = Field(
|
||||
default=300.0,
|
||||
ge=30.0,
|
||||
le=1200.0,
|
||||
description="Hard timeout for one agentic sub-agent response.",
|
||||
)
|
||||
model_config = {"extra": "allow"}
|
||||
|
||||
|
||||
|
||||
@@ -186,9 +186,11 @@ class Settings(BaseSettings):
|
||||
Returns:
|
||||
SecretStr containing the API key or None if not configured.
|
||||
"""
|
||||
from artemis.llm.google.provider import is_google_family_provider
|
||||
|
||||
provider_lower = provider.lower()
|
||||
key: SecretStr | None = None
|
||||
if provider_lower in ("google", "gemini", "vertexai"):
|
||||
if is_google_family_provider(provider_lower):
|
||||
key = self.GOOGLE_API_KEY or self.GEMINI_API_KEY or self.GCP_API_KEY
|
||||
elif provider_lower in ("ocr", "vision", "google_vision"):
|
||||
key = self.OCR_API_KEY or self.VISION_API_KEY
|
||||
@@ -214,10 +216,12 @@ class Settings(BaseSettings):
|
||||
persist_to_env: Whether to save the key to the app directory's .env file.
|
||||
"""
|
||||
secret = SecretStr(key)
|
||||
from artemis.llm.google.provider import is_google_family_provider
|
||||
|
||||
provider_lower = provider.lower()
|
||||
env_key_name = None
|
||||
|
||||
if provider_lower in ("google", "gemini", "vertexai"):
|
||||
if is_google_family_provider(provider_lower):
|
||||
self.GOOGLE_API_KEY = secret
|
||||
self.GEMINI_API_KEY = secret
|
||||
self.GCP_API_KEY = secret
|
||||
@@ -265,7 +269,7 @@ class Settings(BaseSettings):
|
||||
|
||||
# Determine keys to update
|
||||
keys_to_update = [env_key_name]
|
||||
if provider_lower in ("google", "gemini", "vertexai"):
|
||||
if is_google_family_provider(provider_lower):
|
||||
keys_to_update = [ENV_GEMINI_API_KEY, ENV_GOOGLE_API_KEY, ENV_GCP_API_KEY]
|
||||
elif provider_lower in ("ocr", "vision", "google_vision"):
|
||||
keys_to_update = [ENV_OCR_API_KEY, ENV_VISION_API_KEY]
|
||||
|
||||
Reference in new issue
Block a user