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

# Gemini Embedding 2 Preview

> Gemini Embedding 2 Preview: テキスト埋め込みモデル。MixRouteでのリクエスト例とパラメータ。

Gemini Embedding 2 Previewは、Googleのテキスト埋め込みモデルです。

MixRouteのネイティブGeminiエンドポイントを通じて`gemini-embedding-2-preview`を呼び出します。OpenAI互換エンドポイントにも対応しています。

## 主な機能

* Gemini embedContent - ネイティブのGemini埋め込みエンドポイント
* 埋め込みベクトル - テキストを数値ベクトルに変換します
* バッチ入力 - 文字列または文字列の配列を受け付ける
* 類似性を利用するワークフロー - 検索やクラスタリングにベクトルを使用します

## 簡単な使用例

### Gemini embedContent

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/models/gemini-embedding-2-preview:embedContent" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "content": {
        "parts": [
          {
            "text": "MixRoute model API"
          }
        ]
      }
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    response = requests.post(
        "https://api.mixroute.ai/v1/models/gemini-embedding-2-preview:embedContent",
        headers={"Authorization": "Bearer YOUR_API_KEY"},
        json={'content': {'parts': [{'text': 'MixRoute model API'}]}},
    )

    print(response.json())
    ```
  </Tab>
</Tabs>

### OpenAI互換の埋め込み

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/embeddings" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "gemini-embedding-2-preview",
      "input": "MixRoute model API"
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    response = requests.post(
        "https://api.mixroute.ai/v1/embeddings",
        headers={"Authorization": "Bearer YOUR_API_KEY"},
        json={'model': 'gemini-embedding-2-preview', 'input': 'MixRoute model API'},
    )

    print(response.json())
    ```
  </Tab>
</Tabs>

## パラメータ

### Gemini embedContent

| パラメーター | 型 | 必須 | 説明 |
| - | - | - | - |
| `content` | object | はい | partsから構成されるテキストコンテンツ。 |
| `taskType` | string | いいえ | 対応している場合に指定する埋め込みタスクの種類。 |
| `outputDimensionality` | integer | いいえ | 対応している場合に要求する出力の次元数。 |

### OpenAI互換の埋め込み

| パラメーター | 型 | 必須 | 説明 |
| - | - | - | - |
| `model` | string | はい | `gemini-embedding-2-preview`である必要があります。 |
| `input` | string \| array | はい | 埋め込みに変換するテキスト。 |
| `dimensions` | integer | いいえ | 対応している場合に指定する次元数。 |


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