QApps / Client / predict_q_app

predict_q_app#

QApps.Client.predict_q_app(**kwargs)#

Generates an Amazon Q App definition based on either a conversation or a problem statement provided as input.The resulting app definition can be used to call CreateQApp. This API doesn’t create Amazon Q Apps directly.

See also: AWS API Documentation

Request Syntax

response = client.predict_q_app(
    instanceId='string',
    options={
        'conversation': [
            {
                'body': 'string',
                'type': 'USER'|'SYSTEM'
            },
        ],
        'problemStatement': 'string'
    }
)
Parameters:
  • instanceId (string) –

    [REQUIRED]

    The unique identifier of the Amazon Q Business application environment instance.

  • options (dict) –

    The input to generate the Q App definition from, either a conversation or problem statement.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: conversation, problemStatement.

    • conversation (list) –

      A conversation to use as input for generating the Q App definition.

      • (dict) –

        A message in a conversation, used as input for generating an Amazon Q App definition.

        • body (string) – [REQUIRED]

          The text content of the conversation message.

        • type (string) – [REQUIRED]

          The type of the conversation message.

    • problemStatement (string) –

      A problem statement to use as input for generating the Q App definition.

Return type:

dict

Returns:

Response Syntax

{
    'app': {
        'title': 'string',
        'description': 'string',
        'appDefinition': {
            'cards': [
                {
                    'textInput': {
                        'title': 'string',
                        'id': 'string',
                        'type': 'text-input'|'q-query'|'file-upload'|'q-plugin',
                        'placeholder': 'string',
                        'defaultValue': 'string'
                    },
                    'qQuery': {
                        'title': 'string',
                        'id': 'string',
                        'type': 'text-input'|'q-query'|'file-upload'|'q-plugin',
                        'prompt': 'string',
                        'outputSource': 'approved-sources'|'llm',
                        'attributeFilter': {
                            'andAllFilters': [
                                {'... recursive ...'},
                            ],
                            'orAllFilters': [
                                {'... recursive ...'},
                            ],
                            'notFilter': {'... recursive ...'},
                            'equalsTo': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'containsAll': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'containsAny': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'greaterThan': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'greaterThanOrEquals': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'lessThan': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'lessThanOrEquals': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            }
                        }
                    },
                    'qPlugin': {
                        'title': 'string',
                        'id': 'string',
                        'type': 'text-input'|'q-query'|'file-upload'|'q-plugin',
                        'prompt': 'string',
                        'pluginId': 'string'
                    },
                    'fileUpload': {
                        'title': 'string',
                        'id': 'string',
                        'type': 'text-input'|'q-query'|'file-upload'|'q-plugin',
                        'filename': 'string',
                        'fileId': 'string',
                        'allowOverride': True|False
                    }
                },
            ],
            'initialPrompt': 'string'
        }
    },
    'problemStatement': 'string'
}

Response Structure

  • (dict) –

    • app (dict) –

      The generated Q App definition.

      • title (string) –

        The title of the generated Q App definition.

      • description (string) –

        The description of the generated Q App definition.

      • appDefinition (dict) –

        The definition specifying the cards and flow of the generated Q App.

        • cards (list) –

          The cards that make up the Q App definition.

          • (dict) –

            The properties defining an input card in an Amazon Q App.

            Note

            This is a Tagged Union structure. Only one of the following top level keys will be set: textInput, qQuery, qPlugin, fileUpload. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

            'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
            
            • textInput (dict) –

              A container for the properties of the text input card.

              • title (string) –

                The title or label of the text input card.

              • id (string) –

                The unique identifier of the text input card.

              • type (string) –

                The type of the card.

              • placeholder (string) –

                The placeholder text to display in the text input field.

              • defaultValue (string) –

                The default value to pre-populate in the text input field.

            • qQuery (dict) –

              A container for the properties of the query input card.

              • title (string) –

                The title or label of the query card.

              • id (string) –

                The unique identifier of the query card.

              • type (string) –

                The type of the card.

              • prompt (string) –

                The prompt or instructions displayed for the query card.

              • outputSource (string) –

                The source or type of output to generate for the query card.

              • attributeFilter (dict) –

                Turns on filtering of responses based on document attributes or metadata fields.

                • andAllFilters (list) –

                  Performs a logical AND operation on all supplied filters.

                  • (dict) –

                    The filter criteria used on responses based on document attributes or metadata fields.

                • orAllFilters (list) –

                  Performs a logical OR operation on all supplied filters.

                  • (dict) –

                    The filter criteria used on responses based on document attributes or metadata fields.

                • notFilter (dict) –

                  Performs a logical NOT operation on all supplied filters.

                • equalsTo (dict) –

                  Performs an equals operation on two document attributes or metadata fields. Supported for the following document attribute value types: dateValue, longValue, stringListValue and stringValue.

                  • name (string) –

                    The identifier for the attribute.

                  • value (dict) –

                    The value of the attribute.

                    Note

                    This is a Tagged Union structure. Only one of the following top level keys will be set: stringValue, stringListValue, longValue, dateValue. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

                    'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
                    
                    • stringValue (string) –

                      A string.

                    • stringListValue (list) –

                      A list of strings.

                      • (string) –

                    • longValue (integer) –

                      A long integer value.

                    • dateValue (datetime) –

                      A date expressed as an ISO 8601 string.

                      It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                • containsAll (dict) –

                  Returns true when a document contains all the specified document attributes or metadata fields. Supported for the following document attribute value types: stringListValue.

                  • name (string) –

                    The identifier for the attribute.

                  • value (dict) –

                    The value of the attribute.

                    Note

                    This is a Tagged Union structure. Only one of the following top level keys will be set: stringValue, stringListValue, longValue, dateValue. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

                    'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
                    
                    • stringValue (string) –

                      A string.

                    • stringListValue (list) –

                      A list of strings.

                      • (string) –

                    • longValue (integer) –

                      A long integer value.

                    • dateValue (datetime) –

                      A date expressed as an ISO 8601 string.

                      It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                • containsAny (dict) –

                  Returns true when a document contains any of the specified document attributes or metadata fields. Supported for the following document attribute value types: stringListValue.

                  • name (string) –

                    The identifier for the attribute.

                  • value (dict) –

                    The value of the attribute.

                    Note

                    This is a Tagged Union structure. Only one of the following top level keys will be set: stringValue, stringListValue, longValue, dateValue. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

                    'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
                    
                    • stringValue (string) –

                      A string.

                    • stringListValue (list) –

                      A list of strings.

                      • (string) –

                    • longValue (integer) –

                      A long integer value.

                    • dateValue (datetime) –

                      A date expressed as an ISO 8601 string.

                      It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                • greaterThan (dict) –

                  Performs a greater than operation on two document attributes or metadata fields. Supported for the following document attribute value types: dateValue and longValue.

                  • name (string) –

                    The identifier for the attribute.

                  • value (dict) –

                    The value of the attribute.

                    Note

                    This is a Tagged Union structure. Only one of the following top level keys will be set: stringValue, stringListValue, longValue, dateValue. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

                    'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
                    
                    • stringValue (string) –

                      A string.

                    • stringListValue (list) –

                      A list of strings.

                      • (string) –

                    • longValue (integer) –

                      A long integer value.

                    • dateValue (datetime) –

                      A date expressed as an ISO 8601 string.

                      It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                • greaterThanOrEquals (dict) –

                  Performs a greater than or equals operation on two document attributes or metadata fields. Supported for the following document attribute value types: dateValue and longValue.

                  • name (string) –

                    The identifier for the attribute.

                  • value (dict) –

                    The value of the attribute.

                    Note

                    This is a Tagged Union structure. Only one of the following top level keys will be set: stringValue, stringListValue, longValue, dateValue. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

                    'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
                    
                    • stringValue (string) –

                      A string.

                    • stringListValue (list) –

                      A list of strings.

                      • (string) –

                    • longValue (integer) –

                      A long integer value.

                    • dateValue (datetime) –

                      A date expressed as an ISO 8601 string.

                      It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                • lessThan (dict) –

                  Performs a less than operation on two document attributes or metadata fields. Supported for the following document attribute value types: dateValue and longValue.

                  • name (string) –

                    The identifier for the attribute.

                  • value (dict) –

                    The value of the attribute.

                    Note

                    This is a Tagged Union structure. Only one of the following top level keys will be set: stringValue, stringListValue, longValue, dateValue. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

                    'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
                    
                    • stringValue (string) –

                      A string.

                    • stringListValue (list) –

                      A list of strings.

                      • (string) –

                    • longValue (integer) –

                      A long integer value.

                    • dateValue (datetime) –

                      A date expressed as an ISO 8601 string.

                      It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                • lessThanOrEquals (dict) –

                  Performs a less than or equals operation on two document attributes or metadata fields.Supported for the following document attribute value type: dateValue and longValue.

                  • name (string) –

                    The identifier for the attribute.

                  • value (dict) –

                    The value of the attribute.

                    Note

                    This is a Tagged Union structure. Only one of the following top level keys will be set: stringValue, stringListValue, longValue, dateValue. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

                    'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
                    
                    • stringValue (string) –

                      A string.

                    • stringListValue (list) –

                      A list of strings.

                      • (string) –

                    • longValue (integer) –

                      A long integer value.

                    • dateValue (datetime) –

                      A date expressed as an ISO 8601 string.

                      It’s important for the time zone to be included in the ISO 8601 date-time format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

            • qPlugin (dict) –

              A container for the properties of the plugin input card.

              • title (string) –

                The title or label of the plugin card.

              • id (string) –

                The unique identifier of the plugin card.

              • type (string) –

                The type of the card.

              • prompt (string) –

                The prompt or instructions displayed for the plugin card.

              • pluginId (string) –

                The unique identifier of the plugin used by the card.

            • fileUpload (dict) –

              A container for the properties of the file upload input card.

              • title (string) –

                The title or label of the file upload card.

              • id (string) –

                The unique identifier of the file upload card.

              • type (string) –

                The type of the card.

              • filename (string) –

                The default filename to use for the file upload card.

              • fileId (string) –

                The identifier of a pre-uploaded file associated with the card.

              • allowOverride (boolean) –

                A flag indicating if the user can override the default file for the upload card.

        • initialPrompt (string) –

          The initial prompt displayed when the Q App is started.

    • problemStatement (string) –

      The problem statement extracted from the input conversation, if provided.

Exceptions

  • QApps.Client.exceptions.AccessDeniedException

  • QApps.Client.exceptions.ValidationException

  • QApps.Client.exceptions.InternalServerException

  • QApps.Client.exceptions.UnauthorizedException

  • QApps.Client.exceptions.ThrottlingException