#Limitation in <AIConversation.responseComponents />: Can't define inputSchema for items in array

3 messages · Page 1 of 1 (latest)

weak sentinel
#
  1. Should we be able to define the properties of items in an array for responseComponents?
responseComponents={{
          JiraIssueCard: {
            description: "Used to display a list of Jira issues",
            component: ({ tickets }) => {
              return <JiraIssueCard tickets={tickets} />;
            },
            props: {
              tickets: {
                type: "array",
                // items is NOT an accepted value here to define items in array
                // items: {
                    // type: "object",
                    // properties: {
                      // name : { type: string } ,
                      // assignee: {
                        // type: "object",
                        // properties: {
                          // name: { type: "string" },
                          // avatarUrl: { type: "string" },
                        // },
                      // },
                    // },
                  // },
                required: true,
                description:
                  "Jira issues with issue name, assignee name and asignee avatar url for display",
              },
            },
          }
        }}
  1. Why do we have to define the input schema twice (once in the data/resource.ts query schema and once in responseComponents component props) in order to store the toolUse contentBlock? Why isn't the shape of our toolUse defined by the query definition in our data.schema?
#

My workaround... override handleSendMessage

  return (
    <Authenticator>
      <AIConversation
        handleSendMessage={(params) =>
          handleSendMessage(
            {
              ...params,
              toolConfiguration: {
                tools: {
                  ...params.toolConfiguration?.tools,
                  AMPLIFY_UI_JiraIssueCard: {
                    description: "List Jira issues",
                    inputSchema: {
                      json: {
                        type: "object",
                        properties: {
                          tickets: {
                            type: "array",
                            items: {
                              type: "object",
                              properties: {
                                assignee: {
                                  type: "object",
                                  properties: {
                                    name: { type: "string" },
                                    avatarUrl: { type: "string" },
                                  },
                                },
                              },
                            },
                          },
                        },
                      },
                    },
                  },
                },
              },
            }
          )
        }
        responseComponents={{
          JiraIssueCard: {
            description: "Used to display a list of Jira issues",
            component: ({ tickets }) => {
              return <JiraIssueCard tickets={tickets} />;
            },
            props: {
              tickets: {
                type: "array",
                required: true,
                description:
                  "Jira issues with key, name, description, status, priority, and assignee for display",
              },
            },
          }
        }}
      />
    </Authenticator>
  );`
#

My workaround is to override inputSchema in handleSendMessage