Logo Decision Model

Decision Model

Tổ chứcPhổ biến
GetStream
decision_model

What a decision model is in this repo, the contract one implements, the System One protocol most vendors here speak, and how to add a vendor or a model to the decision_model router. Read before adding a decision model, a decision model vendor or a guardrail backend.

Tổng quan

Nhà phát hànhGetStream
Kho mãAgents
Tên kỹ năngdecision_model
Sao
8.2K
Bản fork
709
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được GetStream công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Decision Model trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/GetStream/Agents/tree/main/.claude/skills/decision_model
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/GetStream/Agents.git /tmp/Agents
mkdir -p .claude/skills
cp -r /tmp/Agents/.claude/skills/decision_model .claude/skills/decision_model
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Decision Model trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Decision Model ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Decision Model với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Decision models

A decision model answers named questions about a piece of state with typed values and the probabilities behind them. It writes no prose. What used to be called an LCM (large classifier model) here is this; the industry settled on "decision model", and so did we.

The per-modality half of router-interface:

WhatWhere
The contractinternal/decisionmodel
The wire protocolinternal/decisionmodel/systemone
One package per vendorinternal/decisionmodel/<vendor>/
The routerinternal/decisionrouter
The modelsthe decision_model section of router.yaml
The modalityrouting.DecisionModel, "decision_model" in the API and in stats
Callers/v1/classify, type: decision_model guardrails, prompt injection screening

Our definition

Something is a decision model here when all four hold. If one does not, it belongs somewhere else.

  1. The caller writes the criteria. It is asked questions the caller wrote, about a state the caller chose. A moderation endpoint with a fixed taxonomy (OpenAI moderations, Stream Moderation) answers its own categories rather than the question asked, so it is not one.
  2. The answer is a distribution. violates: 0.93 is something a threshold acts on. A chat model's "Yes, this violates the policy" is something a parser acts on, and a parser that fails has no number to fall back to.
  3. The number is meant to be calibrated. A decision model's 0.9 is meant to be 90%, which is what makes a threshold in config mean the same thing across policies. A prompted chat model's "0.9" is a token it learned to emit.
  4. It is one request and one answer. There is no stream, no generated text, no token budget, no tools and no history. That is why it routes like search, not like llm, and why failover happens at start only. The caller is mid-turn, and a second provider's latency on top of the first one's failure is a longer silence than saying the judgement did not arrive.

A chat model with a JSON schema or logprobs passes the first test and fails the third. It stays in llmrouter. The two run side by side: internal/guardrail has a decision model backend and an LLM-judge backend, and the policy file picks one.

The three questions

ConstructorAsksAnswer lands in
Noul(instructions, yes, no)yes or noAnswer.Yes, a probability from 0 to 1
Choice(instructions, options)which of theseAnswer.Chosen, plus Probabilities and Confidence
Score(instructions, levels)where on this ordered scaleAnswer.Level, which can fall between two levels, plus Legend, Probabilities and Confidence

These three are what every vendor below takes. Do not add a fourth unless every vendor's API has it: a question type that only one provider supports can't be routed. A hazard battery is several Nouls in one request, not a new type. OpenAI's own API calls the noul a predicate and Vercel's AI SDK calls it boolean; translate that at the edge, never in the contract.

Getting the most out of them:

  • A model can only answer with an option it was given. Include a "none of these" option whenever the options may not cover an input. Choice keeps an option whose description is empty (it goes on the wire as null), because the name can be all an option needs.
  • Ask everything at once. The questions in one request are answered independently and share the cost of the state's tokens, so a question whose answer turns out to be irrelevant is close to free. Ask for everything you might need and let Go decide what applies. That keeps policy in code rather than in a prompt.
  • Use Score for a spectrum. A noul at 0.5 means an even split between yes and no, not "medium".
  • Confidence says how peaked a distribution is, not whether acting on it is safe. A guardrail should threshold on the probability it cares about, not on confidence.

The contract

decisionmodel.Provider is Classify, Start, Close, Provider and Model. The rules:

  • Validate first. Call Request.Validate() before anything reaches the wire. A question with no instructions, or a type nobody knows, is refused locally rather than spending a round trip to come back as a 422.
  • An unanswered question is an error, never a zero value. A missing violates read as 0.0 is a guardrail that allows everything, and nothing about the turn would say so.
  • Result.Model is the version that answered, not the alias that was asked. Aliases move when a release ships, and a threshold tuned against one version needs to know.
  • Report usage and let the price list price it. Report input and output tokens. The price list (acceleration/prices/vendor.json, then the database) turns them into cost; never compute cost in the provider.
  • Map failures onto the contract's errors. A rate limit (429) wraps ErrRateLimited. An overloaded service (503, 529) or a network failure wraps ErrUnavailable. Anything else is the request's own fault. /v1/classify turns those into its status codes.
  • No options, ever. options.Classifier.Terms() returns nothing, and that is not a gap to close later. Everything a caller asks for travels in the questions, so there is no parameter for a provider to accept and quietly drop. A provider that cannot express a question should fail the request rather than answer a different one. The caller cannot tell from a probability that it was answered about something else.

The protocol: System One

TypeSafe published System One for Jev. OpenRouter, Perplexity, Alibaba Model Studio and AnyRouter adopted it unchanged:

json
{"model": "...", "state": "text, or a JSON object whose parts a question names in backticks",
 "questions": {
   "is_bug":  {"type": "noul",   "instructions": "...", "criteria": {"true": "...", "false": "..."}},
   "team":    {"type": "choice", "instructions": "...", "criteria": {"payments": "...", "none": null}},
   "urgency": {"type": "score",  "instructions": "...", "criteria": ["lowest level", "...", "highest"]}}}

The answers come back keyed the same way, as {"type", "noul" | "choice" | "score", "probabilities", "confidence", "legend"}, beside model and usage.input_tokens and usage.output_tokens. systemone.Client speaks this and nothing else. Perplexity refuses any field it does not know, so the request carries model, state and questions and nothing more.

Google's Decisions API is the one vendor here off System One, in internal/decisionmodel/gemini. Its answers use System One's fields, but the state is input (a state with parts goes as its JSON text), a noul's criteria are true_description and false_description, the key is x-goog-api-key, usage is total_input_tokens, and the answer names no model. A yes or no probability is never below 0.01 or above 0.99, so a threshold outside that range never fires.

OpenAI's own Decisions API (POST /v1/decisions, limited preview) is another shape that differs: input instead of state, questions and answers as arrays carrying name, predicate with probability, and choices and levels as objects. Reach GPT-6 Luna Decisions through OpenRouter, which translates it into System One. Write an openai vendor only when there is a reason to skip OpenRouter, and do the translation inside that package.

The vendors and models

VendorEndpointKeyModels declared
typesafeapi.typesafe.ai/v1/systemoneTYPESAFE_API_KEYjev-latest (the default route's pin)
openrouteropenrouter.ai/api/alpha/decisionsOPENROUTER_API_KEYtypesafe/jev-1.13, openai/gpt-6-luna-decisions, cloudflare/clef-flash, cloudflare/clef, respan/span-01-lite, liquid/d1, jaredpalmer/kev-4b, perplexity/pplx-decider-v1.1-27b, inception/mercury-decide, inception/mercury-decide:free
perplexityapi.perplexity.ai/v1/decisionsPERPLEXITY_API_KEYpplx-decider-v1.1-27b, pplx-decider-v1-27b
geminigenerativelanguage.googleapis.com/v1beta/decisions (not System One)GOOGLE_API_KEYgemini-decision-1

To see what OpenRouter currently serves, run curl "https://openrouter.ai/api/v1/models?output_modalities=decisions". A model can be listed there with no endpoint behind it, which is why Decider V1 goes to Perplexity directly.

How they are routed:

  • classify-fast is what a guardrail or prompt injection screening gets when it names nothing. It prefers typesafe/jev-latest, because every threshold in use was tuned against Jev. Without the pin, health ranking would hand guardrails to whichever of the ten answered fastest last.
  • Clef is the only high-quality model, so it is what the two *-high-accuracy shortcuts resolve to.
  • Free endpoints (:free) are capped at a few requests a minute and a few dozen a day. They are declared realtime: false, so a live route never lands on one, and they are priced with free: true in prices/vendor.json rather than no price. TestEveryRoutedModelIsPriced still catches a price that was forgotten.
  • Data policy. Only TypeSafe and Gemini declare one (Gemini's retention is unspecified, so a request asking for no retention skips it). What happens to an OpenRouter request depends on where OpenRouter forwards it, so its models declare none, and a customer who asks for a data policy is kept away from them.

Adding a model

On a vendor that already exists, it is a router.yaml entry and its price:

  1. Add provider, model (exactly the vendor's model id), a one-sentence description, languages, realtime and tier to router.yaml, and its input_tokens rate to acceleration/prices/vendor.json, read from the vendor's price list and dated in the router.yaml comment.
  2. Choose a tier on purpose. low-latency is for the live path. high-quality is a slower model that is more accurate.
  3. Run the integration suite below against it. A model that cannot tell an SDK question from a pizza question must not be a candidate for a guardrail.

Adding a vendor

On System One, a vendor is an Endpoint and nothing else:

  1. Create internal/decisionmodel/<vendor>/<vendor>.go with ProviderName, an Endpoint (key and base-URL env vars, base URL, path, default model) and New(systemone.Options) (*systemone.Client, error). Copy perplexity as the template.
  2. Register it in registry.go, and add a row to TestEachVendorIsAskedAtItsOwnEndpointWithItsOwnKey and a key to the keys map in integration_test.go.
  3. Declare its models in router.yaml. TestTheDefaultRegistryHasEveryProviderTheConfigDeclares fails until step 2 is done, which is the point.
  4. Make sure to register usage and include pricing information, see the pricing skill from this repo on how to do this.

Off System One, the package implements decisionmodel.Provider itself. It translates the neutral request into the vendor's wire shape and back inside that package, and follows every rule under "The contract". The contract carries no vendor's JSON tags, and keeping it that way is what makes the next vendor cheap.

Testing

  • Wire behaviour (validation, criteria shape, unanswered questions, status mapping) is tested once, in systemone_test.go, against an httptest server with a made-up endpoint.
  • A vendor is covered by the registry test above: right path, right key, right model.
  • integration_test.go in decisionrouter (//go:build integration) asks every model declared in router.yaml an obvious yes and an obvious no, and skips a vendor whose key is not set. Run it with go test -tags integration ./internal/decisionrouter/ -run DecisionModelIntegration. An OpenRouter account with no credits answers 402 on every paid model, while the :free one still works.

Câu hỏi thường gặp

Kỹ năng AI Decision Model làm được gì?

What a decision model is in this repo, the contract one implements, the System One protocol most vendors here speak, and how to add a vendor or a model to the decision_model router. Read before adding a decision model, a decision model vendor or a guardrail backend.

Vì sao nên dùng Decision Model trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Decision Model là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Decision Model trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/GetStream/Agents/tree/main/.claude/skills/decision_model. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Decision Model?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Decision Model với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Decision Model với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Decision Model có miễn phí không?

Có. Kỹ năng này được GetStream phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇