# למיין לקטגוריה

> הוחלף בשלב סוכן AI. תנו לסוכן את הקטגוריות, ואת השדות category, confidence ו-reason.

Source: https://docs.go-lumen.ai/he/reference/steps/classify

## במבט אחד

| מאפיין | ערך |
| --- | --- |
| **שם השלב** | `classify` |
| **משאב** | ClusterStep (`lumen.ai/v1alpha1`) |
| **קבוצה וקטגוריה** | ai, ai |
| **קרדיטים** | **1.5** קרדיטים בכל פעם שהוא מצליח |
| **השפעה חיצונית** | לא |
| **ההתקנה צריכה לספק** | כלום |

## קלט

| מאפיין | ערך |
| --- | --- |
| **צריך** | כלום |
| **מפיק** | `fields` |
| **עובד על** | item: מסמך אחד בכל פעם |

״צריך״ ו״מפיק״ הם סוגי נתונים (file, text, fields, email). העורך מציע שלב רק במקום שבו מה שהוא צריך כבר נמצא במסלול. ראו [מסמכים ונתונים](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#documents-and-data).

## פלט

צומת מאוחר יותר מפנה לפלט כ-`{nodeId.field}` בטקסט, או כ-`nodeId.field` בתנאי.

| פלט | סוג |
| --- | --- |
| `category` | string |
| `confidence` | number |
| `reason` | string |

## הגדרות

מגדירים תחת `config:` בצומת של התהליך. הגדרות טקסט יכולות להכיל מצייני מקום כמו `{nodeId.field}`.

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `categories` (חובה) | list of object |  | Categories (minItems 2; maxItems 30) |
| `categories[].name` (חובה) | string |  | Name (minLength 1; maxLength 60) |
| `categories[].description` | string |  | Description says what belongs here, to the model. (maxLength 300) |
| `allowOther` | boolean | `true` | AllowOther lets the answer be "other" when nothing fits. On unless set to false; off, the document is put in the closest category. |
| `files` | object |  | Files is how the step reads the document's files and how much of them. |
| `files.mode` | string | `"attach"` | Mode is attach (the model reads each file whole when it can, its text otherwise), text (only the text read out of each file) or none (no file at all). Unset is attach. ifNoText attaches them only when the document has no text, and sends none otherwise. (one of attach, text, none, ifNoText) |
| `files.maxFiles` | integer | `10` | MaxFiles is the most files one document may bring; the rest are skipped. Unset is 10. (minimum 1; maximum 100) |
| `files.maxPages` | integer | `100` | MaxPages is the most PDF pages across all files together; a PDF that crosses it is read up to the pages left. Unset is 100. (minimum 1; maximum 1000) |
| `files.maxBytes` | integer | `20971520` | MaxBytes is the most bytes, all files together. Unset is 20 MB. (minimum 1; maximum 104857600) |

ה-JSON Schema המלא של ההגדרות: [classify.schema.json](https://docs.go-lumen.ai/schemas/steps/classify.schema.json).

## שימוש בתהליך

צומת שמריץ את `classify` נכנס תחת `spec.nodes` של [Flow](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#the-flow-as-yaml). תנו לו כל מזהה, ורשמו ב-next את מזהי הצמתים הבאים.

```yaml title="flow.yaml (spec.nodes)"
- id: classify
  stepRef: {name: classify}
```
