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

Choose your framework/language

Gen1 DocsLegacy

Page updated Mar 26, 2026

コンテキスト

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

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

export default function Chat() {
const [
{
data: { messages },
isLoading,
},
sendMessage,
] = useAIConversation('chat');
function handleSendMessage(message) {
sendMessage({
...message,
// this can be any object that can be stringified
aiContext: {
currentTime: new Date().toLocaleTimeString()
}
})
}
return (
//...
)
}