Skip to content

Use Anthropic messages API - #304

Merged
merrymercy merged 2 commits into
sgl-project:mainfrom
janimo:anthropic-new-api
Mar 22, 2024
Merged

merrymercy merged 2 commits into
sgl-project:mainfrom
janimo:anthropic-new-api

Conversation

@janimo

@janimo janimo commented Mar 15, 2024

Copy link
Copy Markdown
Contributor

This switches to the newer Anthropic API. The claude-3 models only work with this (so do claude-2.1 and claude-instant-1.2)

https://docs.anthropic.com/claude/reference/migrating-from-text-completions-to-messages

@merrymercy

merrymercy commented Mar 22, 2024 •

Copy link
Copy Markdown
Collaborator

@janimo Great! Can you also add some if/else to make it also work with old versions or enforce a new version here?

anthropic = ["anthropic", "numpy"]

@janimo

janimo commented Mar 22, 2024

Copy link
Copy Markdown
Contributor Author

@merrymercy thanks for the review. Updated the package version required. The only model that does not work with the new API is the legacy Claude 2.

""")
s += "\n\nHuman: " + question + "\n"
s += "\n\nAssistant:" + sgl.gen("answer", stop="\n", temperature=0)
s += "\n\nAssistant:" + sgl.gen("answer", stop="\\n", temperature=0)

@merrymercy merrymercy Mar 22, 2024 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is "\\n" a typo?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the new API apparently does not take empty stop sequences, and considers '\n' empty....

@merrymercy
merrymercy merged commit e57f079 into sgl-project:main Mar 22, 2024
@janimo
janimo deleted the anthropic-new-api branch September 17, 2024 12:28
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
efschu added a commit to efschu/htsglang that referenced this pull request Jul 30, 2026
…zvous hardening fixed it, link matrix completes in 15.3s vs 469s (inherited MASTER_ADDR from launcher was the trigger, 45s cap never needed); migration carries all four v2 link entries, fresh values match within 2%; honest correction: lanes top-up cost 132s from one-time nvcc cold build per arch, not 6s; FP8 lanes on 3080 ALL fail (scaled_mm CC>=8.9, marlin/w8a16 NoKernelImage sm86 = sgl-project#304 — now an ACCURACY issue for auto-performance, planner compares 570 fp8 vs 61.8 dense-bf16); sgl-project#290 kernel check exit 0 (1.71 GiB packed, rel err 0.0055-0.0074; needs htsglang-gpu venv for GGUF bindings); s04 DFLASH-solo-Q8 accept collapse GONE: 6.19/6.86/9.60 synthetic, code 4.27 vs NEXTN 3.279, prose 2.95 vs 2.688 — prose<code ordering consistent with accept logic

# Conflicts:
#	docs/dev/INTEGRATION_R3_VALIDATION.md
efschu added a commit to efschu/htsglang that referenced this pull request Jul 30, 2026
…cts, one error line — get_jit_cuda_arch resolved once per process and all 103 JIT getters memoized arch-blind (single-process rig walk launched the 5090's sm_120 cubin on the 3080s; one-ELF proof on disk), plus cache key lacking flags/deps/tree provenance (foreign-worktree __FILE__); fix: cache_once_per_arch on all getters + is_arch_support_pdl, build-input hash in dir name, sgl_jit_provenance.json stamped and verified on reuse (cross-tree reuse with identical inputs stays allowed, mismatch refused loudly and purged), kill switch, Dynamo-safe; sibling audit: trtllm_lora + native_hash fixed, htccl/vmm/render already correct; 30 new tests + 74 JIT-family green, failure sets identical; NOTE: new hash orphans ~148 cache entries — next window pays one cold nvcc pass (piggybacks on the sgl-project#295 cold rebuild already due)
efschu added a commit to efschu/htsglang that referenced this pull request Jul 30, 2026
… runs on sm86 for the first time — marlin beats w8a16 by ~1.11x (4 points, 2 runs), the right lane for fp8 on Ampere; real format-pure FP8 spread 5090:3080 = 9.3-9.7:1:1 (cached 10.8:1 undersold the 3080s by 11-13%; the dense-bf16 fallback at 9.2:1 was accidentally near-right); side finding: forcing all cards onto marlin gives 3.6-3.7:1 — the planner spread is mostly the 5090's _scaled_mm privilege, not raw compute; provenance stamps correct (arch 8.6 + source_tree), the welle-2 repack crash line now passes; NEW OPEN ITEM: a venv without sgl_kernel writes 'marlin did not run' as a CARD verdict into the profile instead of an environment error — lane probes outside the GPU venv poison the profile

# Conflicts:
#	docs/dev/INTEGRATION_R3_VALIDATION.md
efschu added a commit to efschu/htsglang that referenced this pull request Jul 31, 2026
…ct#323): S3 PORTED from vLLM per prior-art directive (CT W4A4-NVFP4 scheme without Blackwell floor + marlin nvfp4 path; reciprocal handling matched vLLM exactly; documented divergences: fork per-rank backend resolver, floor 80 not 75; sglang upstream has nothing per API search); #323a modelopt_fp4_uneven_tp_block = lcm(16,32,128) spanning both kernel families (mixed-arch rig resolves different backends per rank), agrees with CT [128,128]; #323b three NVFP4 MoE classes into deny list with scheme= argument, hard error no downgrade; #323c sm120 auto picks fork JIT cutlass gated on arch AND import (sgl-project#304), named degrade; 43 new tests, quant dir 180 green; phi0 microbench + v4 boot proof prepared; flagged: German comments fused_moe_triton/layer.py 131-146
1195343015 pushed a commit to 1195343015/sglang that referenced this pull request Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants