# Chats prompting

> Chats prompting - チャットは、会話の履歴とコンテキストを保持しながら、プロンプトを通じてLLMと対話する方法を提供します。
> チャットを使用すると、LLMアプリケーションとマルチターン会話を行うことができ、各プロンプトで会話内の以前のメッセージを参照できます。

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-07-15T05:55:44.622030+00:00` (UTC).

## Primary page

- [Chats prompting](https://docs.datarobot.com/ja/docs/api/dev-learning/python/genai/chats-prompting.html.md): Full documentation for this topic (Markdown sidecar).

## Sections on this page

- [チャットの作成](https://docs.datarobot.com/ja/docs/api/dev-learning/python/genai/chats-prompting.html.md#create-a-chat): In-page section heading.
- [チャットへのプロンプトの送信](https://docs.datarobot.com/ja/docs/api/dev-learning/python/genai/chats-prompting.html.md#submit-prompts-to-a-chat): In-page section heading.
- [チャット履歴の取得](https://docs.datarobot.com/ja/docs/api/dev-learning/python/genai/chats-prompting.html.md#retrieve-chat-history): In-page section heading.
- [チャットの管理](https://docs.datarobot.com/ja/docs/api/dev-learning/python/genai/chats-prompting.html.md#manage-chats): In-page section heading.
- [チャット情報の取得](https://docs.datarobot.com/ja/docs/api/dev-learning/python/genai/chats-prompting.html.md#get-chat-information): In-page section heading.

## Documentation content

[チャット](https://docs.datarobot.com/ja/docs/api/reference/sdk/gen-prompting.html.md#datarobot.models.genai.chat.Chat) は、会話の履歴とコンテキストを保持しながら、プロンプトを通じてLLMと対話する方法を提供します。 チャットを使用すると、LLMアプリケーションとマルチターン会話を行うことができ、各プロンプトで会話内の以前のメッセージを参照できます。

## チャットの作成

LLMブループリントから新しいチャットを作成します。 チャットを作成する際は、以下を指定する必要があります。

- name ：チャットのわかりやすい名前。
- llm_blueprint ：チャットに関連付けるLLMブループリントIDまたは LLMBlueprint オブジェクト。

```
import datarobot as dr
blueprint = dr.genai.LLMBlueprint.get(blueprint_id)
chat = dr.genai.Chat.create(
    name="Customer Support Chat",
    llm_blueprint=blueprint_id
)
chat 
```

## チャットへのプロンプトの送信

[datarobot.ChatPrompt.submit()](https://docs.datarobot.com/ja/docs/api/reference/sdk/gen-prompting.html.md#datarobot.models.genai.chat_prompt.ChatPrompt.submit) を使用して、プロンプトを送信し、回答を受け取ります。

```
chat = dr.genai.Chat.get(chat_id)
prompt = dr.genai.ChatPrompt.create(
    chat=chat.id,
    text="What is your return policy?"
)
prompt.result_text 
```

会話履歴を保持したまま、フォローアッププロンプトを送信します。

```
followup = dr.genai.ChatPrompt.create(
    chat=chat.id,
    text="How long does it take to process a return?"
)
print(f"Response: {followup.result_text}") 
```

## チャット履歴の取得

[datarobot.ChatPrompt.list()](https://docs.datarobot.com/ja/docs/api/reference/sdk/gen-prompting.html.md#datarobot.models.genai.chat_prompt.ChatPrompt.list) を使用して、チャット内のすべてのプロンプトを取得します。

```
chat = dr.genai.Chat.get(chat_id)
prompts = dr.genai.ChatPrompt.list(chat=chat.id)
for prompt in prompts:
    prompt.text
    prompt.result_text 
```

LLMブループリントでプロンプトをフィルターします。

```
blueprint = dr.genai.LLMBlueprint.get(blueprint_id)
blueprint_prompts = dr.genai.ChatPrompt.list(llm_blueprint=blueprint.id) 
```

プレイグラウンドでプロンプトをフィルターします。

```
playground = dr.genai.Playground.get(playground_id)
playground_prompts = dr.genai.ChatPrompt.list(playground=playground.id) 
```

## チャットの管理

すべてのチャットをリストします。

```
all_chats = dr.genai.Chat.list()
print(f"Found {len(all_chats)} chat(s):")
for chat in all_chats:
    print(f"  - {chat.name} (ID: {chat.id})") 
```

LLMブループリントでフィルターします。

```
blueprint = dr.genai.LLMBlueprint.get(blueprint_id)
blueprint_chats = dr.genai.Chat.list(llm_blueprint=blueprint.id) 
```

チャット名を更新します。

```
chat = dr.genai.Chat.get(chat_id)
chat.update(name="Updated Chat Name") 
```

チャットを削除します。

```
chat.delete() 
```

## チャット情報の取得

チャットの詳細を取得します。

```
chat = dr.genai.Chat.get(chat_id)
print(f"Name: {chat.name}")
print(f"LLM Blueprint: {chat.llm_blueprint_id}")
print(f"Is frozen: {chat.is_frozen}")
print(f"Prompts count: {chat.prompts_count}")
print(f"Warning: {chat.warning}") 
```
