> 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-jp/deploy/supported-models/paligemma2.md).

# PaliGemma 2

PaliGemma 2 は Google の vision-language model です。画像とテキストプロンプトを受け取り、テキスト応答を返します。PaliGemma 2 は、当社の [Serverless Hosted API](/roboflow/roboflow-jp/deploy/serverless-hosted-api-v2.md), [Dedicated Deployments](/roboflow/roboflow-jp/deploy/dedicated-deployments.md)、および [self-hosted Inference](https://inference.roboflow.com/).

## コードサンプル

インストールしてください [Inference SDK](https://inference.roboflow.com/):

```bash
pip install inference-sdk
```

あなたの [Roboflow API Key](https://app.roboflow.com/settings/api) を `API_KEY` environment variable。サンプルは、事前学習済みの `paligemma2-3b-pt-224` caption prompt 付きの checkpoint。

```python
import os
import urllib.request
from inference_sdk import InferenceHTTPClient

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

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.getenv("API_KEY"),
)
result = client.infer_lmm(
    image_path,
    model_id="paligemma2-3b-pt-224",
    prompt="caption en",
    max_new_tokens=64,
)
print(result["response"])
```

上記のコードは、モデルの応答をターミナルに出力します:

```
その人は本当に犬好きです。
```

{% hint style="info" %}
設定 `api_url` をデプロイ先に合わせてください:

* `https://serverless.roboflow.com` は Serverless Hosted API 用です。
* `http://localhost:9001` ローカル [Inference](https://inference.roboflow.com/) サーバー用です。
* あなたの [Dedicated Deployment](/roboflow/roboflow-jp/deploy/dedicated-deployments.md) の URL はプライベートエンドポイント用です。
  {% endhint %}

Roboflow で独自の PaliGemma 2 checkpoint を学習し、その `workspace/project/version` identifier で呼び出せます。次を [Inference ドキュメント](https://inference.roboflow.com/) 追加の prompt format とサポートされている checkpoint について。


---

# 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-jp/deploy/supported-models/paligemma2.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.
