> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/jp/moderu/decision-laya.md).

# Unsloth でローカルに Decision Models を実行・提供する：Laya + Jev API

Unsloth を使って decision models をローカルで提供・実行します。

次のような意思決定モデルを実行・提供できます **Laya** または **Clef**、Jev のオープンな代替を、ローカルの **Mac**, **Windows** そして **Linux** デバイス上で [Unsloth](https://github.com/unslothai/unsloth)。意思決定モデルは、テキスト入力を、アプリが利用できる構造化された判断に変換します。サポートチケットの振り分け、メールのフィルタリング、自動タグ付けや分類まで対応します。

Unsloth の GUI インターフェースを使えば、Laya と Clef を TypeSafe 互換の Jev API として公開できるため、既存の Jev 統合はそれらをローカルサーバーに向けるだけで動作します。

すべてのデータはデバイス上に残り、 **CPU**, **統合メモリ**と **GPU** の構成がすべてサポートされています。

<div align="center"><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FDvcVZXYF1Cepw6sw3UGs%2Flaya-demo-v2.gif?alt=media&amp;token=d550d7d8-d315-4e22-a9c2-eee2a0dbbf82" alt="Real time packing demo powered by local Laya through Unsloth’s Decision API: suitcase items update as you type and change your travel plans" width="563"><figcaption></figcaption></figure></div>

決定モデルにテキストの一部を送り、必要な判断（はい／いいえ、選択、またはスコア）を定義すると、調整済みの確率が返ってきます。

### 🖥️ 推奨設定

| モデル             | 最小 RAM   | サイズ    | 最適な用途                                        |
| --------------- | -------- | ------ | -------------------------------------------- |
| **多言語** （デフォルト） | 4 GB RAM | 678 MB | ほとんどの用途。100 以上の言語、1024 トークンのコンテキスト。          |
| **英語**          | 5 GB RAM | 846 MB | 英語のみ。より大きなエンコーダー、512 トークンのコンテキスト。            |
| **型付き意思決定**     | 5 GB RAM | 846 MB | 英語のみ。請求書、セキュリティインシデント、カスタマーサービス、エージェントのトレース。 |

CPU がデフォルトです。切り替えるには **実行先** GPU を使うと応答が速くなります。GPU は、次を押すまでモデルをメモリに保持します **アンロード** または Unsloth を再起動してください。GPU のメモリが不足した場合、Laya は CPU にフォールバックして応答を続けます。

### ⚡ クイックスタート

{% stepper %}
{% step %}

#### **Unslothのセットアップ**

始める最も簡単な方法は、次をダウンロードすることです。 [Unsloth Desktopアプリ](/docs/jp/desktop.md)。対応環境: [macOS](/docs/jp/meru/install/mac.md), [Windows](/docs/jp/meru/install/windows-installation.md)と [Linux](/docs/jp/meru/install/linux.md).

<a href="https://unsloth.ai/download" class="button primary" data-icon="down-to-bracket">Unslothをダウンロード</a>

* <i class="fa-apple">:apple:</i> [macOS版をダウンロード](https://unsloth.ai/download/mac)
* <i class="fa-windows">:windows:</i> [Windows版をダウンロード](https://unsloth.ai/download/windows)
* <i class="fa-linux">:linux:</i> [Linux版をダウンロード](https://unsloth.ai/download/linux)

または、手動でインストールしたい場合は:

MacOS、Linux、WSL:

```bash
curl -fsSL https://unsloth.ai/install.sh | sh
```

Windows PowerShell:

```bash
irm https://unsloth.ai/install.ps1 | iex
```

{% endstep %}

{% step %}

#### Laya のセットアップ

設定 → API → **意思決定 API** を開き **リクエストを提供**をオンにします。ダウンロードを開始するか確認すると、デフォルトの Laya モデル（678 MB）のダウンロードが始まります。

API キーは同じページの Access tokens にあります。あるいは **キー不要の API アクセス** → **チャットと推論** をオンにして、localhost ではキーを省略できます。

<div data-with-frame="true"><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F0Mt4vrBDlZMpLIP4O4L2%2Fdecision-api-loaded.png?alt=media&amp;token=921d0ba2-c60f-4fc2-82f9-b44584454ba3" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### 意思決定リクエストを送信する

それでは、意思決定リクエストを送信しましょう。この例では、サポートチケットを分類し、返金要求を検出し、緊急度をスコアリングします。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F57Wcq0T86gBgHWMt8ISt%2FScreenshot%202026-09-28%20at%206.53.48%E2%80%AFPM.png?alt=media&amp;token=88c48aef-0454-485a-8a30-ec55b0b6ad0c" alt="" width="563"><figcaption></figcaption></figure>

```bash
curl http://localhost:8888/v1/systemone \\
  -H "Authorization: Bearer sk-unsloth-YOUR_KEY" \\
  -H "Content-Type: application/json" \
  -d '{
    "model": "laya",
    "state": "3 月の請求書（#4411）で二重に請求されました。重複分を今日返金してください。",
    "questions": {
      "team": {
        "type": "choice",
        "instructions": "この担当はどのチームが処理すべきですか？",
        "criteria": {
          "billing": "請求書、支払い、返金",
          "technical": "バグ、停止、エラー",
          "sales": "価格、新しいプラン",
          "other": "それ以外すべて"
        }
      },
      "refund": {"type": "noul", "instructions": "顧客は返金を求めていますか？"},
      "urgency": {"type": "score", "instructions": "どのくらい緊急ですか？", "criteria": ["緊急ではない", "すぐに", "今日"]}
    }
  }'
```

返ってくるのは次のとおりです：

```json
{
  "model": "laya-multilingual",
  "answers": {
    "team": {"type": "choice", "choice": "billing", "confidence": 1.0, "probabilities": {"billing": 1.0, "technical": 0.0, "sales": 0.0, "other": 0.0}},
    "refund": {"type": "noul", "noul": 0.9794},
    "urgency": {"type": "score", "score": 1.9005, "confidence": 0.698, "legend": {"0": "緊急ではない", "1": "すぐに", "2": "今日"}, "probabilities": {"0": 0.004, "1": 0.0915, "2": 0.9045}}
  },
  "usage": {"input_tokens": 172, "output_tokens": 0}
}
```

最初のリクエストでモデルが読み込まれ、10〜20 秒かかります。その後は、ほとんどの CPU でリクエストは 1 秒を大きく下回ります。

`state` は文字列でも任意の JSON でも構いません。 `model` は `laya`, `デフォルト`、または `jev-latest` は、設定で選んだモデルに対応し、また `laya-multilingual`, `laya-english`, `laya-typed-decisions` などがあります。
{% endstep %}
{% endstepper %}

### ❓ 質問タイプ

| 型        | 用途             | 返ってくるのは                      |
| -------- | -------------- | ---------------------------- |
| `noul`   | はい／いいえ         | 0 から 1 の範囲での「はい」の確率          |
| `choice` | 1 つの विकल्पを選ぶ | 最も可能性の高い विकल्पと、各 विकल्पの確率 |
| `score`  | 尺度で評価する        | 0 から数えたときに、テキストが尺度のどこに位置するか  |

`noul` ははい／いいえを意味します。「はい」の確率を返します： `0.98` は非常にありそう、 `0.5` はどちらの可能性も同程度であることを意味します。

`choice` そして `score` も返します `信頼度`。 に近いほど `1` は 1 つの答えが際立っていることを意味します。 に近いほど `0` は、確率が均等に分布していることを意味します。

{% columns %}
{% column %}
選択に対して動作するには、その値を `probabilities`、ではなく `信頼度`。たとえば、 `technical` が を上回る場合にのみバグ報告を出します。 `0.8`。Laya と Jev は confidence の計算方法が異なるため、Jev の confidence 閾値は再利用しないでください。

各リクエストは最大 **64 問まで**、最大で **choice ごとに 255 個のオプション** そして **score ごとに 10 段階**.
{% endcolumn %}

{% column %}

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FlsX4Rv1JIcz1JuTkFIBO%2Fsuitcase-10mb.gif?alt=media&amp;token=1314fb64-166e-48b2-97cf-cb086d40fbe9" alt=""><figcaption><p>Unsloth の Decision API 経由でローカルの Laya が動かすリアルタイム荷造りデモ: 入力に応じてスーツケースの中身が更新され、旅行計画に合わせて変化します</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

### 🔁 Jev からの移行

次のコマンドで SDK をインストールします `pip install typesafe-sdk`、2 つの環境変数を設定すれば、既存のコードが Unsloth と通信します：

```bash
export TYPESAFE_BASE_URL=http://localhost:8888
export TYPESAFE_API_KEY=sk-unsloth-YOUR_KEY
```

SDK のデフォルトモデル `jev-latest`は、Settings で選択したモデルに対応します。

Jev とは 2 点異なります。 `信頼度` 別の式を使用するため、Jev で調整した閾値は移行できません。 の閾値は `probabilities` の代わりに使用してください。また、choice のオプションは固定のトークン予算を共有するため、説明付きオプションが 20 個前後を超えるとラベルが切り詰められます。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/jp/moderu/decision-laya.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
