Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Yandex Cloud AI Studio connector standard blueprint example for embedding models

This blueprint demonstrates how to deploy a Yandex Cloud AI Studio embedding models.

## 1. Allow connection to Yandex Cloud

```json
PUT /_cluster/settings
{
"persistent": {
"plugins.ml_commons.trusted_connector_endpoints_regex": [
"^https://llm\\.api\\.cloud\\.yandex\\.net/.*$"
]
}
}
```

## 2. Create connector for Yandex Cloud Embeddings:


```json
POST /_plugins/_ml/connectors/_create
{
"name": "YC Connector: embedding",
"description": "Yandex Cloud AI Studio Embeddings",
"version": "1",
"protocol": "http",
"parameters": {
"modelUri": "emb://<folder_ID>/text-search-<doc|query>/latest",
"folder_id":"<folder_ID>"
},
"credential": {
"api_key": "<API-KEY>"
},
"actions": [
{
"action_type": "predict",
"method": "POST",
"url": "https://llm.api.cloud.yandex.net/foundationModels/v1/textEmbedding",
"headers": {
"Authorization": "Api-Key ${credential.api_key}",
"x-folder-id": "${parameters.folder_id}"
},
"request_body": "{ \"text\": \"${parameters.inputText}\", \"modelUri\": \"${parameters.modelUri}\" }",
"pre_process_function": "connector.pre_process.bedrock.embedding",
"post_process_function": "connector.post_process.bedrock.embedding"
}
]
}
```

Note: Replace all `<placeholders>` in the preceding code snippet with appropriate values, while preserving `${curly braces}` syntax exactly as shown. Short-lived [bearer tokens](https://yandex.cloud/en/docs/iam/concepts/authorization/iam-token) (valid ~12 hours) may be used as an alternative to [API keys](https://yandex.cloud/en/docs/iam/concepts/authorization/api-key). API keys must be granted either `yc.ai.languageModels.execute` or `yc.ai.foundationModels.execute` roles. Also refer to [the guide](https://yandex.cloud/en/docs/ai-studio/security/). Additionally, due to distinct [models](https://yandex.cloud/en/docs/ai-studio/concepts/embeddings) being employed for query processing versus document processing, two dedicated connectors are required. Using these particular pre/post processing functions is crucial.

Sample response:
```json
{
"connector_id": "CTEou5oBdUNOOrVArUAU"
}
```

## 3. Register model & deploy model:

```json
POST /_plugins/_ml/model_groups/_register
{
"name": "yc_remote_model_group",
"description": "A model group for external YC AI Studio models"
}
```

Sample response:
```json
{
"model_group_id": "4THNtZoBdUNOOrVAzj_V"
}
```

```json
POST /_plugins/_ml/models/_register
{
"name": "yc-embedding",
"function_name": "remote",
"model_group_id": "4THNtZoBdUNOOrVAzj_V",
"description": "YC embedding model",
"connector_id": "CTEou5oBdUNOOrVArUAU"
}
```


```json
POST /_plugins/_ml/models/_register
{
"name": "YC text embedding model",
"function_name": "remote",
"description": "test model",
"connector_id": "nzh9PIsBnGXNcxYpPEcv"
}
```

Sample response:
```json
{
"task_id": "5THZtZoBdUNOOrVAEj_I",
"status": "CREATED",
"model_id": "CzEou5oBdUNOOrVA10Db"
}
```
Comment on lines 78 to 96
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove or clarify the duplicate model registration (lines 90–98).

The section shows two separate model registrations:

  1. Lines 79–87: yc-embedding with the connector created in section 2 (CTEou5oBdUNOOrVArUAU) and a model_group_id
  2. Lines 90–98: YC text embedding model with a hardcoded, unrelated connector_id (nzh9PIsBnGXNcxYpPEcv) and no model_group_id

The second registration uses a connector_id that does not match the one established earlier, making it inconsistent and confusing. Users will not know which registration to follow. The sample response and test section both reference the second registration's model_id, but the instructions don't explain why two registrations are shown.

Either remove the second registration if it's leftover code, or clearly explain when/why to use both variants.

If the second registration should be removed, apply this diff:

 ```json
 POST /_plugins/_ml/models/_register
 {
     "name": "yc-embedding",
     "function_name": "remote",
     "model_group_id": "4THNtZoBdUNOOrVAzj_V",
     "description": "YC embedding model",
     "connector_id": "CTEou5oBdUNOOrVArUAU"
 }

-```json
-POST /_plugins/_ml/models/_register
-{

  • "name": "YC text embedding model",
  • "function_name": "remote",
  • "description": "test model",
  • "connector_id": "nzh9PIsBnGXNcxYpPEcv"
    -}
    -```

Sample response:


Then update the sample response and test section to use the first registration's model IDs consistently.

<!-- This is an auto-generated comment by CodeRabbit -->


## 4. Test model inference

```json
POST /_plugins/_ml/models/CzEou5oBdUNOOrVA10Db/_predict
{
"parameters": {
"inputText": "What is the meaning of life?"
}
}
```

Sample response of Yandex Cloud AI Studio Embedding:

```json
{
"inference_results": [
{
"output": [
{
"name": "sentence_embedding",
"data_type": "FLOAT32",
"shape": [
256
],
"data": [
0.06268310546875,
-0.04071044921875,
0.047119140625,
-0.007476806640625,
-0.038543701171875,
-0.003681182861328125,
...
0.040679931640625
]
}
],
"status_code": 200
}
]
}
```