> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/roboflow/roboflow-hi/deploy/supported-models/perception-encoder.md).

# Perception Encoder

Perception Encoder Meta का vision-language embedding model है। यह images और text को similarity search, zero-shot classification, और retrieval के लिए एक shared embedding space में map करता है।

{% hint style="info" %}
Perception Encoder Serverless Hosted API पर उपलब्ध नहीं है। इसे एक [Dedicated Deployment](/roboflow/roboflow-hi/deploy/dedicated-deployments.md) या [self-hosted Inference](https://inference.roboflow.com/).
{% endhint %}

हम तीन Perception Encoder endpoints का समर्थन करते हैं:

* `/perception_encoder/embed_image` — एक image embed करें
* `/perception_encoder/embed_text` — एक string embed करें
* `/perception_encoder/compare` — एक image और text prompts की सूची के बीच similarity compute करें

## कोड उदाहरण

निर्भरताएँ इंस्टॉल करें:

```bash
pip install requests opencv-python
```

नीचे दिया गया sample एक image भेजता है `/perception_encoder/embed_image` और embedding shape प्रिंट करता है। Set `URL` अपने Dedicated Deployment URL या किसी local Inference server पर। अपना [Roboflow API Key](https://app.roboflow.com/settings/api) के माध्यम से `API_KEY` environment variable.

```python
import base64
import os
import urllib.request

import cv2
import requests

URL = "https://your-deployment.roboflow.cloud"

image_url = "https://media.roboflow.com/notebooks/examples/dog.jpeg"
image_path = "dog.jpeg"
urllib.request.urlretrieve(image_url, image_path)

image = cv2.imread(image_path)
_, buffer = cv2.imencode(".jpg", image)
image_base64 = base64.b64encode(buffer).decode("utf-8")

response = requests.post(
    f"{URL}/perception_encoder/embed_image",
    json={
        "api_key": os.getenv("API_KEY"),
        "image": {"type": "base64", "value": image_base64},
    },
)
result = response.json()
embedding = result["embeddings"][0]
print(f"Embedding length: {len(embedding)}")
print(f"First values: {embedding[:5]}")
```

ऊपर दिया गया code terminal पर embedding shape प्रिंट करता है:

```
Embedding length: 1024
First values: [0.0545, -0.0338, -0.0355, -0.0062, 0.0154]
```

{% hint style="info" %}
सेट करें `URL` को अपने deployment target से मिलाने के लिए:

* `http://localhost:9001` एक स्थानीय [Inference](https://inference.roboflow.com/) सर्वर।
* आपका [Dedicated Deployment](/roboflow/roboflow-hi/deploy/dedicated-deployments.md) एक private endpoint के लिए URL।
  {% endhint %}


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-hi/deploy/supported-models/perception-encoder.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
