[Feat] Add Cloudflare Clef / Clef-flash as a System One decision backend

Đang mở
#126 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Birfy đang làm issue này rồi.

Từ ngày 23/11/2026.

  • #131 của @Birfy — đang mở

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
28/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
ai, backend-api-design

Hướng nghiên cứu

Start with s1a/decision_models/factory.py and the existing served backends (clm, onejev), then read their shared contract tests and DecisionModel interface. Trace how Observation.images is represented and how served backends record URLs, request IDs, model names, usage, and deadlines. Done means the clef backend passes choice, noul, and image contract tests for Workers AI and local serving, with qualification runs and the specified capability and configuration documentation; score and video support must be stated.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Why

Cloudflare released Clef (27B) and Clef-flash (9B) on 2026-10-01: open-weight, Apache-2.0, multimodal System One decision models that return a probability for every option of every typed question in one forward pass. They are advertised as Jev / System One compatible, with a vision encoder and a longer context than hosted Jev on the 27B model.

This repository still has no --model clef (or clef-flash). s1a/decision_models/factory.py registers jev, jev-vl-served, clm, laya, laya-served, cua, omnijev, onejev, random, and rule only. Clef is not a substitute for the open issues that qualify other checkpoints through an existing adapter:

  • #103 qualifies Open-Jev 9B/27B on the local System One text path
  • #108 qualifies Kev (kev-0.6b-browser-use and Kev-4B) by pointing TYPESAFE_API_URL at kev.serve
  • #114 qualifies served OneJev 1.6
  • #97 is TypeSafe image input on hosted Jev

Clef cannot ride those paths unchanged. Workers AI is not /v1/systemone: it is POST /client/v4/accounts/$ACCOUNT_ID/ai/run/@cf/cloudflare/clef (or clef-flash) with a Cloudflare token. Local serving (the model card's SGLang image) does speak POST /v1/systemone, but screenshots use Clef's images (and optional videos) field, not OneJev's media + <image:N> markers and not TypeSafe's image input. Our DecisionModel interface also has only choice and noul today; Clef's score type is out of scope here.

Official docs (context window and pricing from the Workers AI pages, not the blog's rounded 64k figure):

Do not copy Cloudflare's Decision Index or workflow-eval numbers into our docs as ours.

Proposed work

  1. Add --model clef (variant via CLEF_MODEL=clef|clef-flash, default clef-flash for latency) that talks to either Workers AI or a local /v1/systemone server, selected by env (CLEF_URL / Cloudflare account + token). Follow the existing served-backend pattern (clm, onejev): one deadline per decision, record url, request id, the served model name, and usage; fail closed on a missing URL/token or a bad body. Contract tests against a stub server; no live Cloudflare or GPU call in CI.
  2. Text path first (choice + noul only): ticket-router or s1a probe, plus one browser suite already in-tree (Allrecipes task 0 or the deterministic local search path used for Laya). Count every attempt (success, failure, timeout, BLOCKED), decision p50/p95, and hardware / S1A_DECISION_TIMEOUT_S.
  3. Screenshot path: map Observation.images to Clef's images array (PNG/JPEG/WebP, max 4 per the Workers AI schema). An observation without an image may still run as text; do not pretend the onejev media mapping works. If Workers AI or the local server rejects or ignores a field of our body, document which field and stop rather than inventing a second shaping layer in this PR.
  4. Add a Clef / Clef-flash row to docs/capabilities.md that distinguishes "adapter wired" from "qualified on this checkpoint and path", link it from #54, and mention the env vars in docs/configuration.md.

Acceptance criteria

  • build_model("clef") is registered and covered by the shared decision-model contract tests (choice + noul; images when present).
  • Every claimed run names Agents SHA, checkpoint or Workers AI model id, path (Workers AI vs local SGLang), hardware, and timeout.
  • Results under docs/results/ include failures in the denominator. No Decision Index figure is reported as an Agents result.
  • Docs state whether score questions and videos are unsupported on our interface.

Out of scope

  • Adding a ScoreQuestion type to s1a/decision_models.
  • Fine-tuning or an in-process PyTorch loader (joint_schema_model.py); HTTP only in this issue.
  • Replacing hosted Jev in the README headline table.
  • Qualifying Open-Jev (#103), Kev (#108), or OneJev 1.6 (#114).

References

Ngôn ngữ chính
Python
Star
120
Fork
21
Merge trung bình
17 giờ 13 phút
Pull request đã merge (30 ngày)
7

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ThinkFlowLab/system1-agents

Tất cả issue của ThinkFlowLab/system1-agents

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.