Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 48 additions & 18 deletions lfm/models/decision-models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Every question you ask a decision model uses one of three types:

- **Noul**: A yes/no question that returns a probability between 0 and 1. Think of it as a boolean on a sliding scale. "Is this message spam?" might return `0.92`, meaning a 0.92 probability that the answer is yes.

Check warning on line 13 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L13

Did you really mean 'Noul'?

- **Choice**: A pick-one-from-many question that returns a probability distribution over named options. "Which department should handle this?" might return `{"billing": 0.65, "technical": 0.30, "account": 0.05}`.

Expand All @@ -22,11 +22,11 @@
|---|---|---|
| Pick one from a set of unordered categories | **Choice** | Which department handles this ticket? |
| Rate something along an ordered scale with defined levels | **Score** | How severe is this bug? |
| Yes or no, where the probability itself is useful | **Noul** | Does this message contain personal data? |

Check warning on line 25 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L25

Did you really mean 'Noul'?

**Noul vs Score**: A Noul at 0.5 means maximum uncertainty between yes and no. It says nothing about degree or intensity. If you want to measure degree (skill level, frustration, severity), use a Score with defined levels. If you need a yes/no gate, use a Noul.

Check warning on line 27 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L27

Did you really mean 'Noul'?

Check warning on line 27 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L27

Did you really mean 'Noul'?

Check warning on line 27 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L27

Did you really mean 'Noul'?

**When the answer could fit more than one type**, think about what your code does next. If it branches on a category, use a Choice. If it compares against a threshold on a continuum, use a Score. If it gates on a boolean, use a Noul.

Check warning on line 29 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L29

Did you really mean 'Noul'?

## Setup

Expand All @@ -40,12 +40,42 @@
export LIQUID_API_KEY="liquid_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
```

You can also use the following prompt to give your agent to enable it to use Liquid AI's decision models.
## Agent Skill

The [Liquid d1 agent skill](https://github.com/Liquid4All/liquid-d1-skills) helps coding agents find opportunities for d1 and integrate it into an application. It can inspect an existing codebase, recommend structured replacements for prompt-and-parse LLM calls, and help design effective Choice, Score, and Noul questions.

Check warning on line 45 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L45

Did you really mean 'Noul'?

Install the skill for the coding agent you use:

<Tabs>
<Tab title="Claude Code">
```bash
claude plugin marketplace add Liquid4All/liquid-d1-skills

Check warning on line 52 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L52

Did you really mean 'claude'?
claude plugin install liquid-d1@liquid-ai

Check warning on line 53 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L53

Did you really mean 'claude'?
```
</Tab>
<Tab title="Codex">
```bash
codex plugin marketplace add Liquid4All/liquid-d1-skills
codex plugin add liquid-d1@liquid-ai
```
</Tab>
<Tab title="Other agents">
```bash
npx skills add Liquid4All/liquid-d1-skills --skill liquid-d1

Check warning on line 64 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L64

Did you really mean 'npx'?
```

Choose your agent when prompted.
</Tab>
</Tabs>

After installation, start a new agent session and try:

```text
Load https://docs.liquid.ai/.well-known/skills/decision-model/skill.md, then inspect this project for generated-text calls that are really bounded decisions. Recommend d1 replacements for classification, routing, scoring, reranking, and yes/no gates.
Use the Liquid d1 skill to inspect this project for generated-text calls that are really bounded decisions. Recommend d1 replacements for classification, routing, scoring, reranking, and yes/no gates.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please update this in the decision-models-guide.mdx as well and reference this section (#agent-skills) for information on installation, etc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please delete the https://docs.liquid.ai/.well-known/skills/decision-model/skill.md file from the repo when replacing it with an external skill

```

The skill includes API and SDK references, guidance for Liquid, Vercel AI Gateway, and OpenRouter, and a dependency-free script for testing requests. Keep `LIQUID_API_KEY` in your environment instead of including it in a prompt.

Check warning on line 77 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L77

Did you really mean 'Vercel'?

## Your First Call

A single API call contains three things:
Expand All @@ -61,7 +91,7 @@
-H "Authorization: Bearer $LIQUID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "d1:free",
"model": "d1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please replace d1:free across entire documentation (decision-models-guide.mdx + build-a-game-with-decision-models.mdx). i will update it in https://github.com/Liquid4All/cookbook/tree/main/examples/road-decider

"state": "I have been waiting over three weeks for my order and nobody has responded to my emails. This is completely unacceptable.",
"questions": {
"is_complaint": {
Expand All @@ -79,7 +109,7 @@

```python
import os
from typesafe_sdk import TypeSafeClient, Noul

Check warning on line 112 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L112

Did you really mean 'Noul'?

client = TypeSafeClient(
api_key=os.environ["LIQUID_API_KEY"],
Expand All @@ -87,7 +117,7 @@
)

result = client.system_one(
model="d1:free",
model="d1",
state="I have been waiting over three weeks for my order and nobody has responded to my emails. This is completely unacceptable.",
questions={
"is_complaint": Noul(
Expand All @@ -112,7 +142,7 @@
});

const result = await client.systemOne({
model: "d1:free",
model: "d1",
state: "I have been waiting over three weeks for my order and nobody has responded to my emails. This is completely unacceptable.",
questions: {
is_complaint: {
Expand All @@ -130,7 +160,7 @@

```json
{
"model": "d1:free",
"model": "d1",
"answers": {
"is_complaint": {
"type": "noul",
Expand Down Expand Up @@ -165,7 +195,7 @@
-H "Authorization: Bearer $LIQUID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "d1:free",
"model": "d1",
"state": "You'\''re an absolute idiot and I hope your company goes bankrupt. I'\''m going to find out where you work.",
"questions": {
"is_harmful": {
Expand All @@ -181,7 +211,7 @@
from typesafe_sdk import Noul

result = client.system_one(
model="d1:free",
model="d1",
state="You're an absolute idiot and I hope your company goes bankrupt. I'm going to find out where you work.",
questions={
"is_harmful": Noul(
Expand All @@ -194,7 +224,7 @@
<Tab title="TypeScript">
```typescript
const result = await client.systemOne({
model: "d1:free",
model: "d1",
state: "You're an absolute idiot and I hope your company goes bankrupt. I'm going to find out where you work.",
questions: {
is_harmful: {
Expand Down Expand Up @@ -242,7 +272,7 @@
-H "Authorization: Bearer $LIQUID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "d1:free",
"model": "d1",
"state": "Hi, I was charged twice for my subscription last month. The amounts are $29.99 on March 3rd and again on March 5th. Can you refund the duplicate charge?",
"questions": {
"intent": {
Expand All @@ -262,10 +292,10 @@
</Tab>
<Tab title="Python">
```python
from typesafe_sdk import Choice

Check warning on line 295 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L295

Did you really mean 'typesafe_sdk'?

result = client.system_one(
model="d1:free",
model="d1",
state="Hi, I was charged twice for my subscription last month. The amounts are $29.99 on March 3rd and again on March 5th. Can you refund the duplicate charge?",
questions={
"intent": Choice(
Expand All @@ -285,7 +315,7 @@
<Tab title="TypeScript">
```typescript
const result = await client.systemOne({
model: "d1:free",
model: "d1",
state: "Hi, I was charged twice for my subscription last month. The amounts are $29.99 on March 3rd and again on March 5th. Can you refund the duplicate charge?",
questions: {
intent: {
Expand Down Expand Up @@ -354,7 +384,7 @@
-H "Authorization: Bearer $LIQUID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "d1:free",
"model": "d1",
"state": "Our production API is returning 500 errors on every request. All customers are affected. Revenue impact is approximately $12,000 per hour. Started 15 minutes ago.",
"questions": {
"urgency": {
Expand All @@ -373,10 +403,10 @@
</Tab>
<Tab title="Python">
```python
from typesafe_sdk import Score

Check warning on line 406 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L406

Did you really mean 'typesafe_sdk'?

result = client.system_one(
model="d1:free",
model="d1",
state="Our production API is returning 500 errors on every request. All customers are affected. Revenue impact is approximately $12,000 per hour. Started 15 minutes ago.",
questions={
"urgency": Score(
Expand All @@ -395,7 +425,7 @@
<Tab title="TypeScript">
```typescript
const result = await client.systemOne({
model: "d1:free",
model: "d1",
state: "Our production API is returning 500 errors on every request. All customers are affected. Revenue impact is approximately $12,000 per hour. Started 15 minutes ago.",
questions: {
urgency: {
Expand Down Expand Up @@ -462,7 +492,7 @@
-H "Authorization: Bearer $LIQUID_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "d1:free",
"model": "d1",
"state": "{\"message\": \"The checkout page crashes with a white screen whenever I try to apply a promo code. I'\''ve tried three different browsers. This is blocking a $4,200 order for our team and we need to place it before our procurement window closes on Friday.\", \"account\": {\"plan\": \"enterprise\", \"arr\": 52000, \"customer_since\": \"2022-03-15\"}}",
"questions": {
"is_bug": {
Expand Down Expand Up @@ -495,7 +525,7 @@
<Tab title="Python">
```python
import json
from typesafe_sdk import Choice, Noul, Score

Check warning on line 528 in lfm/models/decision-models.mdx

View check run for this annotation

Mintlify / Mintlify Validation (liquidai) - vale-spellcheck

lfm/models/decision-models.mdx#L528

Did you really mean 'typesafe_sdk'?

ticket = {
"message": "The checkout page crashes with a white screen whenever I try to apply a promo code. I've tried three different browsers. This is blocking a $4,200 order for our team and we need to place it before our procurement window closes on Friday.",
Expand All @@ -507,7 +537,7 @@
}

result = client.system_one(
model="d1:free",
model="d1",
state=json.dumps(ticket),
questions={
"is_bug": Noul(
Expand Down Expand Up @@ -546,7 +576,7 @@
};

const result = await client.systemOne({
model: "d1:free",
model: "d1",
state: JSON.stringify(ticket),
questions: {
is_bug: {
Expand Down
Loading