Skip to content

https://arxiv.org/abs/2606.28344. The end of web parsing. The beginning of scalable pixel-native search. link: https://pixelrag.ai/

feat(eval): add optional Atlas Cloud reader (#159)

nb2138183de3f4600
diff --git a/eval/README.md b/eval/README.md
index 5f1151a..bfede20 100644
--- a/eval/README.md
+++ b/eval/README.md
@@ -172,6 +172,28 @@ text-only text retrieval.
PYTHONPATH=. .venv/bin/python -m lib.grader <task> <responses.jsonl>
```
+## Atlas Cloud readers
+
+Select Atlas Cloud explicitly with `--atlascloud`; other readers are unchanged.
+Set `ATLASCLOUD_API_KEY` and use an exact model ID from the
+[live catalog](https://api.atlascloud.ai/api/v1/models):
+
+```bash
+export ATLASCLOUD_API_KEY=your-api-key
+python run_bench.py --task simpleqa --model deepseek-ai/deepseek-v3.2 \
+ --atlascloud --num-examples 1 --max-concurrent 1 --max-tokens 256
+```
+
+This text-only example does not use retrieval. For screenshot benchmarks, select
+a model supporting image input. Model IDs are forwarded unchanged to
+`https://api.atlascloud.ai/v1`, including IDs containing `gemini`; they do not
+select the native Google SDK. `--api-key` overrides `ATLASCLOUD_API_KEY`, and
+other providers' environment keys are never used. Do not combine this option
+with another provider flag or `--api-base`.
+
+Atlas requests are not automatically retried, including timeouts, connection
+errors and rate limits, to avoid duplicating billable generation requests.
+
## MiniMax readers
Set `MINIMAX_API_KEY` and select either registered model ID. The model context length
diff --git a/eval/lib/llm.py b/eval/lib/llm.py
index 0f4879b..5f250bd 100644
--- a/eval/lib/llm.py
+++ b/eval/lib/llm.py
@@ -475,6 +475,7 @@ class LLMClient:
enable_thinking: bool | None = None,
force_openai_compat: bool = False,
use_litellm: bool = False,
+ retry_requests: bool = True,
):
self.model = model
self.temperature = temperature
@@ -482,6 +483,7 @@ class LLMClient:
self.timeout = timeout
self.max_context_tokens = max_context_tokens
self.enable_thinking = enable_thinking
+ self.retry_requests = retry_requests
# Kept for the LiteLLM path (module-level SDK, no persistent client object).
self.api_key = api_key
self.api_base = api_base
@@ -582,6 +584,8 @@ class LLMClient:
else:
return await self._generate_openai(messages)
except asyncio.TimeoutError:
+ if not self.retry_requests:
+ raise
timeout_attempts += 1
if timeout_attempts >= max_retries:
raise
@@ -591,6 +595,8 @@ class LLMClient:
)
await asyncio.sleep(wait_time)
except Exception as e:
+ if not self.retry_requests:
+ raise
error_str = str(e).lower()
if "timeout" in error_str or "timed out" in error_str:
timeout_attempts += 1
diff --git a/eval/lib/model_config.py b/eval/lib/model_config.py
index 24973b5..6fe6c3d 100644
--- a/eval/lib/model_config.py
+++ b/eval/lib/model_config.py
@@ -53,6 +53,21 @@ MINIMAX_ENDPOINTS = {
}
+def get_atlascloud_config(
+ model_name: str, api_key: str | None = None
+) -> Dict[str, Any]:
+ """Resolve an explicitly selected Atlas Cloud reader without native routing."""
+ if not api_key or api_key == "dummy":
+ api_key = os.getenv("ATLASCLOUD_API_KEY")
+ if not api_key or not api_key.strip() or api_key == "dummy":
+ raise ValueError("Atlas Cloud requires --api-key or ATLASCLOUD_API_KEY.")
+ return {
+ "api_base": "https://api.atlascloud.ai/v1",
+ "api_key": api_key,
+ "model": model_name,
+ }
+
+
def get_model_config(model_name: str) -> Dict[str, Any]:
"""
Get model configuration based on model name.
diff --git a/eval/run_bench.py b/eval/run_bench.py
index 39856dd..05361db 100644
--- a/eval/run_bench.py
+++ b/eval/run_bench.py
@@ -73,6 +73,7 @@ from lib.benchmarks import (
)
from lib.model_config import (
ORCAROUTER_API_BASE,
+ get_atlascloud_config,
get_model_config,
get_output_filename,
)
@@ -957,10 +958,19 @@ async def run_async(args):
)
# Get model configuration
- model_config = get_model_config(args.model)
+ model_config = (
+ get_atlascloud_config(args.model, args.api_key)
+ if args.atlascloud
+ else get_model_config(args.model)
+ )
# Handle OpenRouter API
- if args.open_router:
+ if args.atlascloud:
+ api_base = model_config["api_base"]
+ api_key = model_config["api_key"]
+ model = model_config["model"]
+ logger.info(f"Using Atlas Cloud API with model: {model}")
+ elif args.open_router:
api_base = "https://openrouter.ai/api/v1"
if args.api_key and args.api_key != "dummy":
api_key = args.api_key
@@ -1133,8 +1143,11 @@ async def run_async(args):
max_context_tokens=args.model_context_length,
timeout=args.timeout,
enable_thinking=(False if args.no_think else None),
- force_openai_compat=(args.open_router or args.commonstack or args.orcarouter),
+ force_openai_compat=(
+ args.open_router or args.commonstack or args.orcarouter or args.atlascloud
+ ),
use_litellm=args.litellm,
+ retry_requests=not args.atlascloud,
)
# 3b. Create pixel-compressed encoder for generation if requested
@@ -1356,6 +1369,11 @@ def main():
action="store_true",
help="Use OrcaRouter API (https://api.orcarouter.ai). Requires --api-key or ORCAROUTER_API_KEY env var.",
)
+ parser.add_argument(
+ "--atlascloud",
+ action="store_true",
+ help="Use Atlas Cloud with an exact catalog model ID. Requires --api-key or ATLASCLOUD_API_KEY.",
+ )
parser.add_argument(
"--litellm",
action="store_true",
@@ -1908,6 +1926,12 @@ def main():
)
args = parser.parse_args()
+ if args.atlascloud and (
+ args.open_router or args.commonstack or args.orcarouter or args.litellm
+ ):
+ parser.error("--atlascloud cannot be combined with another provider flag")
+ if args.atlascloud and args.api_base:
+ parser.error("--atlascloud uses its fixed endpoint; omit --api-base")
# Validate mutually exclusive options
mode_count = sum(
diff --git a/tests/test_atlascloud_client.py b/tests/test_atlascloud_client.py
new file mode 100644
index 0000000..e12b6b7
--- /dev/null
+++ b/tests/test_atlascloud_client.py
@@ -0,0 +1,114 @@
+"""Offline coverage of the optional Atlas Cloud evaluation reader."""
+
+import asyncio
+import sys
+import types
+from pathlib import Path
+from runpy import run_path
+from unittest.mock import AsyncMock
+
+import pytest
+
+_LIB = Path(__file__).parents[1] / "eval" / "lib"
+if "lib" not in sys.modules:
+ _pkg = types.ModuleType("lib")
+ _pkg.__path__ = [str(_LIB)]
+ sys.modules["lib"] = _pkg
+
+from lib.llm import LLMClient
+
+get_config = run_path(str(_LIB / "model_config.py"))["get_atlascloud_config"]
+
+
[email protected]("model", ["openai/gpt-4.1-mini", "google/gemini-3-pro"])
+def test_atlascloud_preserves_model_and_isolates_credentials(monkeypatch, model):
+ monkeypatch.setenv("ATLASCLOUD_API_KEY", "atlas-test-key")
+ monkeypatch.setenv("OPENAI_API_KEY", "other-key")
+ monkeypatch.setenv("API_KEY", "generic-key")
+ config = get_config(model)
+ assert config == {
+ "model": model,
+ "api_base": "https://api.atlascloud.ai/v1",
+ "api_key": "atlas-test-key",
+ }
+ assert get_config(model, "explicit-key")["api_key"] == "explicit-key"
+
+
[email protected]("key", [None, "", " ", "dummy"])
+def test_atlascloud_requires_own_key(monkeypatch, key):
+ monkeypatch.delenv("ATLASCLOUD_API_KEY", raising=False)
+ if key is not None:
+ monkeypatch.setenv("ATLASCLOUD_API_KEY", key)
+ monkeypatch.setenv("API_KEY", "generic-key")
+ monkeypatch.setenv("GOOGLE_API_KEY", "google-key")
+ with pytest.raises(ValueError, match="ATLASCLOUD_API_KEY"):
+ get_config("deepseek-ai/deepseek-v3.2")
+
+
+ "error",
+ [
+ None,
+ asyncio.TimeoutError(),
+ RuntimeError("Connection error"),
+ RuntimeError("429"),
+ ],
+)
+def test_atlascloud_client_routes_once(monkeypatch, error):
+ calls = []
+ options = {}
+
+ async def create(**kwargs):
+ calls.append(kwargs)
+ if error is not None:
+ raise error
+ return types.SimpleNamespace(
+ choices=[types.SimpleNamespace(message=types.SimpleNamespace(content="4"))],
+ usage=types.SimpleNamespace(
+ prompt_tokens=3, completion_tokens=1, total_tokens=4
+ ),
+ )
+
+ def openai_client(**kwargs):
+ options.update(kwargs)
+ return types.SimpleNamespace(
+ chat=types.SimpleNamespace(completions=types.SimpleNamespace(create=create))
+ )
+
+ monkeypatch.setitem(
+ sys.modules, "openai", types.SimpleNamespace(AsyncOpenAI=openai_client)
+ )
+ client = LLMClient(
+ **get_config("google/gemini-3-pro", "atlas-test-key"),
+ force_openai_compat=True,
+ retry_requests=False,
+ max_tokens=64,
+ )
+ messages = [{"role": "user", "content": "2+2?"}]
+ if error is None:
+ text, usage = asyncio.run(client.generate(messages))
+ assert text == "4"
+ assert usage["total_tokens"] == 4
+ else:
+ with pytest.raises(type(error)):
+ asyncio.run(client.generate(messages))
+ assert len(calls) == 1
+ assert calls[0]["model"] == "google/gemini-3-pro"
+ assert calls[0]["messages"] == messages
+ assert options["base_url"] == "https://api.atlascloud.ai/v1"
+ assert options["api_key"] == "atlas-test-key"
+ assert options["max_retries"] == 0
+ assert not client.is_gemini
+
+
+def test_other_readers_keep_existing_retry_behavior(monkeypatch):
+ client = LLMClient(model="openai/test-model", use_litellm=True)
+ generate = AsyncMock(side_effect=[asyncio.TimeoutError(), ("4", {})])
+ monkeypatch.setattr(client, "_generate_litellm", generate)
+ monkeypatch.setattr(asyncio, "sleep", AsyncMock())
+
+ assert asyncio.run(client.generate([{"role": "user", "content": "2+2?"}])) == (
+ "4",
+ {},
+ )
+ assert generate.await_count == 2