> ## Documentation Index
> Fetch the complete documentation index at: https://docs.conare.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Conare's API is at https://api.conare.ai. Authenticate with `Authorization: Bearer $CONARE_API_KEY`.
> The full OpenAPI spec is at https://api.conare.ai/openapi.yaml; each endpoint has a page under /api-reference, and appending .md to any page URL returns its Markdown.
> Embed with model conare-embed-1; send input_type "query" for search queries. Rerank with conare-rerank-1.
> Prefer the TypeScript SDK (`npm install conare`) or plain HTTP in examples.
> Install the Conare skill with `npx skills add https://docs.conare.ai`; search these docs over MCP at https://docs.conare.ai/mcp; the whole site is at https://docs.conare.ai/llms-full.txt.

# التضمين وإعادة الترتيب

> استخدم نماذج التضمين وإعادة الترتيب من Conare مع أي قاعدة بيانات متجهية، عبر نقاط نهاية متوافقة مع OpenAI وCohere.

وجّه عميل OpenAI أو Cohere إلى `https://api.conare.ai/v1` لاستخدام نماذج Conare بشكل مستقل. يمكن لـ[مفتاح](https://docs.conare.ai/ar/console.md#المفاتيح) **Models only** استدعاؤها، ولا يصل إلى أي مساحة أسماء.

| النموذج | الاستخدام | المُخرَج |
| - | - | - |
| `conare-embed-1` | تضمينات للمستندات والاستعلامات | 1,024 بُعدًا |
| `conare-rerank-1` | إعادة الترتيب (الافتراضي) | درجة صلة لكل مستند |

## التضمين

`POST /v1/embeddings`

ضمّن المستندات كما هي، واستعلامات البحث مع `input_type: "query"`.

```bash curl theme={null}
curl https://api.conare.ai/v1/embeddings \
  -H "Authorization: Bearer $CONARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "conare-embed-1", "input": ["Refunds are available for 30 days."]}'

curl https://api.conare.ai/v1/embeddings \
  -H "Authorization: Bearer $CONARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "conare-embed-1", "input": "how do refunds work?", "input_type": "query"}'
```

```ts TypeScript theme={null}
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.conare.ai/v1", apiKey: process.env.CONARE_API_KEY });

const docs = await client.embeddings.create({ model: "conare-embed-1", input: ["Refunds are available for 30 days."] });
const query = await client.embeddings.create({
  model: "conare-embed-1",
  input: "how do refunds work?",
  input_type: "query",
} as OpenAI.EmbeddingCreateParams);
```

```python Python theme={null}
import os
from openai import OpenAI

client = OpenAI(base_url="https://api.conare.ai/v1", api_key=os.environ["CONARE_API_KEY"])

docs = client.embeddings.create(model="conare-embed-1", input=["Refunds are available for 30 days."])
query = client.embeddings.create(
    model="conare-embed-1",
    input="how do refunds work?",
    extra_body={"input_type": "query"},
)
```

```json Response theme={null}
{
  "data": [{ "embedding": [0.12506497, 0.07159516, 0.017521178, ...], "index": 0, "object": "embedding" }],
  "model": "conare-embed-1",
  "object": "list",
  "usage": { "prompt_tokens": 12, "total_tokens": 12 }
}
```

| الخيار | النوع | الوظيفة |
| - | - | - |
| `input` | string أو array، مطلوب | من 1 إلى 128 نصًا، كلٌّ منها حتى 32 KiB |
| `model` | string | `conare-embed-1` (الافتراضي)، أو معرّف نموذجك الخاص |
| `input_type` | string، الافتراضي `document` | `query` لاستعلامات البحث |
| `encoding_format` | string، الافتراضي `float` | `float`، أو `base64` لقيم float32 بترتيب little-endian |
| `dimensions` | integer | أبعاد النموذج نفسه فقط، 1,024 |

يحتوي `data` على `embedding` واحد من 1,024 رقمًا لكل مُدخل، مع `index` الخاص به. المخطط الكامل: [تضمين النصوص (متوافق مع OpenAI)](https://docs.conare.ai/ar/api-reference/models/embed-texts-openai-compatible.md).

## إعادة الترتيب

`POST /v1/rerank`

يقيّم المستندات مقابل استعلام، الأفضل أولًا؛ يقبل طلب Cohere، ويقبل `/v2/rerank` الواجهة `ClientV2` من Cohere.

```bash curl theme={null}
curl https://api.conare.ai/v1/rerank \
  -H "Authorization: Bearer $CONARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "how do refunds work?",
    "documents": ["Orders ship within two days.", "Refunds are available for 30 days."],
    "top_n": 1
  }'
```

```ts TypeScript (SDK) theme={null}
import { Conare } from "conare";

const conare = new Conare();
const ranked = await conare.rerank("how do refunds work?", [
  "Orders ship within two days.",
  "Refunds are available for 30 days.",
]);
// [{ index: 1, score: 0.3468, document: "Refunds are available for 30 days." }, ...]
```

```python Python theme={null}
import os
import cohere

co = cohere.Client(base_url="https://api.conare.ai", api_key=os.environ["CONARE_API_KEY"])

response = co.rerank(
    query="how do refunds work?",
    documents=["Orders ship within two days.", "Refunds are available for 30 days."],
    top_n=1,
)
```

```json Response theme={null}
{
  "id": "d9d8ac5739d77af256c01449d7f23bb2",
  "model": "conare-rerank-1",
  "results": [{ "index": 1, "relevance_score": 0.3484 }],
  "unscored": [],
  "usage": { "total_tokens": 57 }
}
```

| الخيار | النوع | الوظيفة |
| - | - | - |
| `query` | string، مطلوب | حتى 8,192 حرفًا |
| `documents` | array، مطلوب | من 1 إلى 100 سلسلة نصية، أو كائنات تحتوي `text`؛ حتى 1,000 مع نموذج مدرَّب لك |
| `model` | string | اتركه فارغًا لاستخدام `conare-rerank-1`؛ النموذج غير المعروف يعيد `400` |
| `top_n` | integer | أعد أفضل `top_n` فقط |
| `return_documents` | boolean، الافتراضي `false` | يضمّن نص كل مستند كـ `document` |
| `max_tokens_per_doc` | integer | يقتطع كل مستند إلى هذا العدد من الرموز تقريبًا |

| الحقل | المعنى |
| - | - |
| `results` | الأفضل أولًا: `index` في `documents`، و`relevance_score` (الأعلى أفضل) |
| `unscored` | المستندات التي لم يصل إليها مُعيد الترتيب في الوقت المحدد |
| `id`، `usage` | معرّف الطلب، والرموز المقروءة |

المخطط الكامل: [إعادة الترتيب (متوافق مع Cohere)](https://docs.conare.ai/ar/api-reference/models/rerank-documents-cohere-and-vllm-compatible.md)، [إعادة الترتيب (Cohere v2)](https://docs.conare.ai/ar/api-reference/models/rerank-documents-cohere-v2-compatible.md).

## النماذج

`GET /v1/models`

يسرد في `data` النماذج التي يمكن لمفتاحك استدعاؤها، بما فيها النماذج المدرَّبة لمؤسستك.

* لكل نموذج `id` و`type` (`embedding` أو `rerank`)؛ والنموذج الذي يجري إيقافه له تاريخ `sunset` و`successor`.
* يعيد `GET /v1/models/:id` نموذجًا واحدًا، أو `404 model_not_found`.

المخطط الكامل: [سرد النماذج](https://docs.conare.ai/ar/api-reference/models/list-models-openai-compatible.md).

## المسارات الأصلية

صيغة Conare الخاصة، التي تستخدمها [SDK](https://docs.conare.ai/ar/sdk.md).

`POST /embed`

```ts TypeScript theme={null}
const [vector] = await conare.embed("how do refunds work?", { type: "query" });
const int8 = await conare.embed("how do refunds work?", { type: "query", outputDtype: "int8" });
```

```json Response theme={null}
{ "dimensions": 1024, "embeddings": [[0.15636191, 0.03499228, -0.003388892, ...]], "model": "conare-embed-1" }
```

| الخيار | النوع | الوظيفة |
| - | - | - |
| `input` | array، مطلوب | من 1 إلى 128 نصًا |
| `type` | string، الافتراضي `document` | `query` لاستعلامات البحث |
| `output_dtype` | string، الافتراضي `float` | يعيد `int8` أعدادًا صحيحة من -127 إلى 127 ومعامل قياس واحدًا لكل متجه في `scales`؛ ويبقى تشابه جيب التمام كما هو |

المخطط الكامل: [تضمين النصوص](https://docs.conare.ai/ar/api-reference/models/embed-texts.md).

`POST /rerank`

```json Response theme={null}
{
  "model": "conare-rerank-1",
  "results": [{ "index": 1, "score": 0.3484 }, { "index": 0, "score": 0.1169 }],
  "unscored": []
}
```

| الخيار | النوع | الوظيفة |
| - | - | - |
| `query` | string، مطلوب | حتى 8,192 حرفًا |
| `documents` | array، مطلوب | من 1 إلى 100 سلسلة نصية، أو حتى 1,000 مع نموذج مدرَّب لك |
| `top_k` | integer | أعد أفضل `top_k` فقط |

المخطط الكامل: [إعادة ترتيب المستندات](https://docs.conare.ai/ar/api-reference/models/rerank-documents.md).


## Related topics

- [مقدمة](https://docs.conare.ai/ar/index.md)
- [وحدة التحكم](https://docs.conare.ai/ar/console.md)
- [نظرة عامة على الواجهة البرمجية](https://docs.conare.ai/ar/api.md)
- [البحث](https://docs.conare.ai/ar/query.md)
- [كتابة المستندات](https://docs.conare.ai/ar/write.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.