# أنواع الإدخال

Canonical URL: https://developers.iagenify.com/ar/sdk/concepts/inputs/
Language: ar

للإدخال نوع محدد، وقد يكون نصاً أو صورة أو مستنداً أو تسجيلاً أو مقطعاً أو مجموعة مقاطع نصية. ويمكن أن يصل كل منها كقيمة أو كرابط URL.

Status: 7 types · content · url

## البنية {#shape}

```javascript
{ type, content?, url?, mime? }
```

| النوع | يحمل |
| --- | --- |
| text | سلسلة نصية في content |
| image | صورة: url، أو base64 في content |
| video | مقطع فيديو: url، أو base64 في content |
| audio | تسجيل صوتي: url، أو base64 في content |
| speech | صوت يُراد تفريغه لا وصفه |
| passages | مقاطع نصية لترتيبها أو مقارنتها، بدلاً من قراءتها كنص واحد |
| file | a document such as a PDF: url only, never content |

## طريقتان لتقديم إدخال واحد {#sources}

```javascript
import { readFileSync } from "node:fs";

await assistant.generate({
  inputs: [
    { type: "text",  content: "What changed between these two?" },
    { type: "image", url: "https://example.com/before.png" },      // fetched for you
    { type: "image", content: base64Png, mime: "image/png" },      // already in hand
    // A local file is content too — read it yourself, there is no "path" input:
    { type: "image", content: readFileSync("./after.png").toString("base64"), mime: "image/png" },
  ],
});
```

> **عيّن mime عند تمرير محتوى خام**
>
> عند استخدام url يُستنتج النوع مما يجلبه الخادم. أما base64 في content — بايتاتك الخاصة، أو ملف قرأته للتو — فلا يوجد منه ما يُستنتج: عيّن mime بنفسك.

## الترتيب له معنى {#order}

تُقرأ المدخلات بالترتيب الذي تقدمه. ضع السؤال قبل المادة عندما تريد قراءتها مع أخذ السؤال في الحسبان، وضعه بعدها عندما تريد وصفاً غير موجّه أولاً.

## passages ليست مجرد نص أكثر {#passages}

تشكّل عدة مدخلات `text` جسماً واحداً للقراءة. أما `passages` فهي مجموعة عناصر مستقلة تُرتّب أو تُقارن — وهذا ما يحتاجه استدعاء إعادة الترتيب.

```javascript
await reranker.generate({
  inputs: [
    { type: "text", content: "Which of these answers the question best?" },
    { type: "passages", content: [chunkA, chunkB, chunkC] },
  ],
});
```

```python
{"type": ..., "content": ..., "url": ..., "mime": ...}
```

```python
import base64
from pathlib import Path

assistant.generate(inputs=[
    {"type": "text", "content": "What changed between these two?"},
    {"type": "image", "url": "https://example.com/before.png"},          # fetched for you
    {"type": "image", "content": base64_png, "mime": "image/png"},       # already in hand
    # A local file is content too — read it yourself, there is no "path" input:
    {"type": "image", "content": base64.b64encode(Path("after.png").read_bytes()).decode(),
     "mime": "image/png"},
])
```

```python
reranker.generate(inputs=[
    {"type": "text", "content": "Which of these answers the question best?"},
    {"type": "passages", "content": [chunk_a, chunk_b, chunk_c]},
])
```
