Need to configure your backend?See Build a Backend →
コンテキスト
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" }})