> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/hi/apis/embedding-spaces-api.md).

# Embedding spaces API

Unitlab Embedding spaces API: HTTP से एम्बेडिंग स्पेस बनाएँ, वेक्टर लिखें और cosine similarity पर आधारित वेक्टर सर्च से मिलती-जुलती फ़ाइलें खोजें।

सभी रूट `https://api.unitlab.ai/api/sdk/embedding-spaces/` के अंतर्गत हैं और इनके लिए **Manage data** चाहिए। सर्च **View labeling interface** से भी चलता है।

| Method और रूट                         | बॉडी                                                                    |
| ------------------------------------- | ----------------------------------------------------------------------- |
| `GET embedding-spaces/`               |                                                                         |
| `POST embedding-spaces/`              | `{"name", "dimensions", "model_name"}`; `dimensions` 1 से 4,096         |
| `GET embedding-spaces/{id}/`          |                                                                         |
| `DELETE embedding-spaces/{id}/`       |                                                                         |
| `POST embedding-spaces/{id}/vectors/` | `{"items": [{"asset_id", "vector", "frame_index"}]}`, अधिकतम 1,000 आइटम |
| `POST embedding-spaces/{id}/search/`  | `{"vector", "limit", "project_id", "level"}`                            |

```bash
curl -s -X POST "https://api.unitlab.ai/api/sdk/embedding-spaces/$SPACE_ID/search/" \
  -H "Authorization: Api-Key $UNITLAB_API_KEY" -H "Content-Type: application/json" \
  -d @query.json
```

```json
{
  "results": [
    {"asset_id": "3f2b...", "frame_index": null, "score": 0.912345, "file_name": "cell04_0117_front.jpg"}
  ],
  "count": 1
}
```

| सर्च फ़ील्ड  | डिफ़ॉल्ट | मान                            |
| ------------ | -------- | ------------------------------ |
| `vector`     | ज़रूरी   | स्पेस की लंबाई जितना           |
| `limit`      | 20       | 1 से 100                       |
| `project_id` | कोई नहीं | सिर्फ़ इस प्रोजेक्ट की फ़ाइलें |
| `level`      | `asset`  | `asset` या `frame`             |

`score` cosine similarity है। जिस फ़ाइल या फ़्रेम का वेक्टर पहले से है, उसका नया वेक्टर लिखने पर पुराना बदल जाता है; जवाब में `created` और `updated` की गिनती होती है। जब तक इंडेक्स बन रहा हो, सर्च `index_status` के साथ 409 लौटाता है। डिफ़ॉल्ट रूप से एक वर्कस्पेस में 32 स्पेस हो सकते हैं।

## संबंधित <a href="#related" id="related"></a>

[SDK: एम्बेडिंग स्पेस](https://docs.unitlab.ai/api-sdk-cli/hi/sdks/embedding-spaces.md) · [SDK: वेक्टर upsert और सर्च](https://docs.unitlab.ai/api-sdk-cli/hi/sdks/upsert-and-search-vectors.md)
