-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Per https://docs.amplify.aws/react/ai/conversation/connect-your-frontend/ I should be able to send metadata and context to the AI conversation via the javascript frontend conversation api, however, I have created a reproduction at https://github.com/lets-getitnow/amplify_conversation that I believe proves these do not work:
I should be able to do:
const { data: newChat, errors } = await client.conversations.chat.create({
name: 'My conversation',
metadata: {
uiMetadataId: '1234567890',
},
});
which I have implemented at : https://github.com/lets-getitnow/amplify_conversation/blob/93760bbdc255c3bc665f633f7c2aaa2c4596e165/src/TestChat.tsx#L51
and
const { data, errors } = await chat.sendMessage(messageContent, {
aiContext: {
uiContextId: {
value: '123asd213123',
},
},
});
which I have implemented at
https://github.com/lets-getitnow/amplify_conversation/blob/93760bbdc255c3bc665f633f7c2aaa2c4596e165/src/TestChat.tsx#L184
and per my systemPrompt: https://github.com/lets-getitnow/amplify_conversation/blob/93760bbdc255c3bc665f633f7c2aaa2c4596e165/amplify/data/resource.ts#L7
Return the uiContextId to the user, and return all metaData associated with this conversation including uiMetadataId
Both do not work, aka its impossible to get the AI to show that it registers, or knows about the values for uiContextId
and uiMetadataId
when using the front-end javascript API.
However, I have also implemented a simpler chat using <AIConversation
here https://github.com/lets-getitnow/amplify_conversation/blob/93760bbdc255c3bc665f633f7c2aaa2c4596e165/src/BasicChat.tsx#L32
which is successfully demonstrating the context is being sent and registered by the bedrock conversation.
Instructions:
npm run dev
And you'll see two chat interfaces:
1st with <AIConversation>
showing it works:
2nd using the typescript front-end api showing it does not work: