Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Migrate Anthropic smoke probes to v1 (#9468)
Pascal André4d90c41d0047
diff --git a/.github/scripts/studio_smoke/multi_turn_chat.py b/.github/scripts/studio_smoke/multi_turn_chat.pyindex fcca17d99f6..0682ab3e668 100644--- a/.github/scripts/studio_smoke/multi_turn_chat.py+++ b/.github/scripts/studio_smoke/multi_turn_chat.py@@ -172,8 +172,8 @@ def run_anthropic() -> list[str]:model = "default",max_tokens = MAX_TOKENS,messages = history,- temperature = 0.0,- extra_body = {"seed": SEED, "enable_thinking": False},+ # anthropic 1.x rejects a top-level temperature; extra_body sends the same JSON.+ extra_body = {"temperature": 0.0, "seed": SEED, "enable_thinking": False},)text = "".join(b.text for b in msg.content if getattr(b, "type", None) == "text")replies.append(text)diff --git a/.github/workflows/studio-inference-smoke.yml b/.github/workflows/studio-inference-smoke.ymlindex e7024a739b6..02548d54cbd 100644--- a/.github/workflows/studio-inference-smoke.yml+++ b/.github/workflows/studio-inference-smoke.yml@@ -236,12 +236,7 @@ jobs:id: sdksif: ${{ !cancelled() && steps.install.outcome == 'success' }}timeout-minutes: 10- # anthropic is held below 1.0: v1 removed temperature, top_p and top_k as- # accepted arguments on messages.create(), so the probes below, which pin- # temperature = 0.0 for determinism, raise TypeError against it. The v1 route- # is extra_body; moving to it is a deliberate change to what the probes send,- # not something a CI install should decide by resolving a new major.- run: pip install 'openai>=1.50,<4' 'anthropic>=0.40,<1'+ run: pip install 'openai>=1.50,<4' 'anthropic>=1,<2'# Phase 1's environment and model cache sit HERE, after the shared# preamble, not before it. They used to run before the installer, which is@@ -1245,8 +1240,8 @@ jobs:a_msg = anthropic.messages.create(model = "default",max_tokens = 80,- temperature = 0.0,- extra_body = {"seed": SEED},+ # anthropic 1.x rejects a top-level temperature; extra_body sends the same JSON.+ extra_body = {"temperature": 0.0, "seed": SEED},messages = [{"role": "user","content": [diff --git a/.github/workflows/studio-mac-ui-smoke.yml b/.github/workflows/studio-mac-ui-smoke.ymlindex 07017ab5405..73123922ae5 100644--- a/.github/workflows/studio-mac-ui-smoke.yml+++ b/.github/workflows/studio-mac-ui-smoke.yml@@ -685,12 +685,7 @@ jobs:id: sdks-chatif: ${{ !cancelled() && steps.assert_llama.outcome == 'success' }}timeout-minutes: 5- # anthropic is held below 1.0: v1 removed temperature, top_p and top_k as- # accepted arguments on messages.create(), so the probes below, which pin- # temperature = 0.0 for determinism, raise TypeError against it. The v1 route- # is extra_body; moving to it is a deliberate change to what the probes send,- # not something a CI install should decide by resolving a new major.- run: pip install 'openai>=1.50,<4' 'anthropic>=0.40,<1'+ run: pip install 'openai>=1.50,<4' 'anthropic>=1,<2'- name: Reset auth + boot Unsloth (API-only)id: boot-chat@@ -1335,12 +1330,7 @@ jobs:id: sdks-visionif: ${{ !cancelled() && steps.assert_llama.outcome == 'success' }}timeout-minutes: 5- # anthropic is held below 1.0: v1 removed temperature, top_p and top_k as- # accepted arguments on messages.create(), so the probes below, which pin- # temperature = 0.0 for determinism, raise TypeError against it. The v1 route- # is extra_body; moving to it is a deliberate change to what the probes send,- # not something a CI install should decide by resolving a new major.- run: pip install 'openai>=1.50,<4' 'anthropic>=0.40,<1'+ run: pip install 'openai>=1.50,<4' 'anthropic>=1,<2'- name: Reset auth + boot Unsloth (API-only)id: boot-vision@@ -1608,8 +1598,8 @@ jobs:a_msg = anthropic.messages.create(model = "default",max_tokens = 80,- temperature = TEMP,- extra_body = {"seed": SEED},+ # anthropic 1.x rejects a top-level temperature; extra_body sends the same JSON.+ extra_body = {"temperature": TEMP, "seed": SEED},messages = [{"role": "user","content": [diff --git a/.github/workflows/studio-windows-inference-smoke.yml b/.github/workflows/studio-windows-inference-smoke.ymlindex c55930dece1..7d56c22ee3e 100644--- a/.github/workflows/studio-windows-inference-smoke.yml+++ b/.github/workflows/studio-windows-inference-smoke.yml@@ -363,12 +363,7 @@ jobs:id: sdksif: ${{ !cancelled() && steps.assert-prebuilt.outcome == 'success' }}timeout-minutes: 10- # anthropic is held below 1.0: v1 removed temperature, top_p and top_k as- # accepted arguments on messages.create(), so the probes below, which pin- # temperature = 0.0 for determinism, raise TypeError against it. The v1 route- # is extra_body; moving to it is a deliberate change to what the probes send,- # not something a CI install should decide by resolving a new major.- run: python -m pip install 'openai>=1.50,<4' 'anthropic>=0.40,<1'+ run: python -m pip install 'openai>=1.50,<4' 'anthropic>=1,<2'# Phase 1's environment and model cache sit HERE, after the shared# preamble, not before it. They used to run before the installer, which is@@ -1388,8 +1383,8 @@ jobs:a_msg = anthropic.messages.create(model = "default",max_tokens = 80,- temperature = TEMP,- extra_body = {"seed": SEED},+ # anthropic 1.x rejects a top-level temperature; extra_body sends the same JSON.+ extra_body = {"temperature": TEMP, "seed": SEED},messages = [{"role": "user","content": [diff --git a/tests/studio/test_sdk_installs_are_major_bounded.py b/tests/studio/test_sdk_installs_are_major_bounded.pyindex 1154034a511..17933e99377 100644--- a/tests/studio/test_sdk_installs_are_major_bounded.py+++ b/tests/studio/test_sdk_installs_are_major_bounded.py@@ -31,13 +31,19 @@ import pytestREPO = Path(__file__).resolve().parents[2]WORKFLOWS = REPO / ".github" / "workflows"+ANTHROPIC_PROBES = (+ REPO / ".github" / "scripts" / "studio_smoke" / "multi_turn_chat.py",+ WORKFLOWS / "studio-inference-smoke.yml",+ WORKFLOWS / "studio-mac-ui-smoke.yml",+ WORKFLOWS / "studio-windows-inference-smoke.yml",+)# Packages our probe code calls directly by keyword, each with the first major it must NOT reach.# Asserting the boundary rather than "some upper bound exists" is what makes this mean anything: `openai>=1.50,<999`# contains a `<` and admits every major it is meant to keep out.GUARDED = {- # v1 removed temperature, top_p and top_k from messages.create().- "anthropic": (1,),+ # v1 probes pass sampling parameters through extra_body.+ "anthropic": (2,),# 3.3.1 resolves today and the probes pass, so the bound sits above it, not at <2."openai": (4,),"playwright": (2,),@@ -167,6 +173,28 @@ def _specs_for(package: str) -> list[tuple[Path, int, str]]:return hits+def _anthropic_create_blocks() -> list[tuple[Path, str]]:+ blocks = []+ for path in ANTHROPIC_PROBES:+ lines = path.read_text(encoding = "utf-8").splitlines()+ for index, line in enumerate(lines):+ if ".messages.create(" not in line:+ continue+ indent = len(line) - len(line.lstrip())+ block = [line]+ for continuation in lines[index + 1 :]:+ block.append(continuation)+ if (+ continuation.strip() == ")"+ and len(continuation) - len(continuation.lstrip()) == indent+ ):+ break+ else:+ raise AssertionError(f"unterminated messages.create call in {path}")+ blocks.append((path, "\n".join(block)))+ return blocks++def _release(raw: str) -> tuple[int, ...]:"""Release segment as ints, every component kept.@@ -247,6 +275,23 @@ def test_the_sdk_is_pinned_below_the_next_major(package: str) -> None:)+def test_anthropic_sampling_parameters_use_extra_body() -> None:+ blocks = _anthropic_create_blocks()+ assert len(blocks) == 4, blocks+ for path, block in blocks:+ assert not re.search(r"\btemperature\s*=", block), path+ assert re.search(r'extra_body\s*=\s*\{[^\n]*["\']temperature["\']', block), path+++def test_anthropic_smokes_install_v1() -> None:+ not_v1 = [+ (path, number, spec)+ for path, number, spec in _specs_for("anthropic")+ if not re.search(r"(?:^|,)>=1(?:\.\d+)*(?:,|$)", spec)+ ]+ assert not not_v1, not_v1++def test_a_bound_above_the_next_major_is_not_accepted() -> None:"""`<` alone is not the property; keeping the major out is.