Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.
Gen1 DocsLegacy

Page updated Mar 26, 2026

コンテキスト

LLMがユーザーの質問に対して高品質の回答を提供するには、適切な情報が必要です。この情報は、ユーザーまたはアプリケーションの状態に基づく、コンテキスト的なものである場合があります。これを可能にするために、ユーザーメッセージと共にaiContextをLLMに送信できます。これは、役立つ可能性のある構造化されていないデータまたは構造化されたデータの任意の形式です。

注:aiContextはチャット中に利用でき、LLMに渡されますが、metadataはチャットで利用できず、LLMに渡されません。

import { generateClient } from "aws-amplify/data";
import type { Schema } from "../amplify/data/resource";
const client = generateClient<Schema>({ authMode: 'userPool' });
const { data: conversation } = await client.conversations.chat.create();
conversation.sendMessage({
content: [{ text: "hello" }],
// aiContext can be any shape
aiContext: {
username: "danny"
}
})