OpenSearchMemory / Client / get_event

get_event

OpenSearchMemory.Client.get_event(**kwargs)

Gets an event by ID, including its payload.

If the space uses a customer managed AWS KMS key, the call can also fail because of the key. It fails with AccessDeniedException if you aren’t allowed to use the key, and with ThrottlingException if AWS KMS throttles the request. It fails with ValidationException if the key is disabled, pending deletion, or deleted.

See also: AWS API Documentation

Request Syntax

response = client.get_event(
    spaceId='string',
    eventId='string',
    actorId='string',
    sessionId='string'
)
Parameters:
  • spaceId (string) –

    [REQUIRED]

    The ID of the space.

  • eventId (string) –

    [REQUIRED]

    The event’s ID, as returned by CreateEvent, ListEvents, or SearchEvents.

  • actorId (string) – The actor the event must belong to. Omit it to skip this check. If it doesn’t match the stored event, the call fails with ResourceNotFoundException, as if the event did not exist.

  • sessionId (string) – The session the event must belong to. Omit it to skip this check. If it doesn’t match the stored event, the call fails with ResourceNotFoundException, as if the event did not exist.

Return type:

dict

Returns:

Response Syntax

{
    'event': {
        'eventId': 'string',
        'spaceId': 'string',
        'actorId': 'string',
        'sessionId': 'string',
        'payload': {
            'conversational': {
                'unified': {
                    'source': {
                        'object': {
                            'messages': [
                                {
                                    'role': 'USER'|'ASSISTANT'|'SYSTEM',
                                    'content': {
                                        'text': 'string'
                                    }
                                },
                            ]
                        }
                    }
                }
            },
            'structuredData': {
                'source': {
                    'json': {...}|[...]|123|123.4|'string'|True|None
                }
            },
            'blob': {
                'contentType': 'application/pdf'|'image/png'|'image/jpeg',
                'source': {
                    's3Location': {
                        'uri': 'string'
                    }
                }
            }
        },
        'metadata': {
            'string': 'string'
        },
        'eventTimestamp': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) –

    • event (dict) –

      The event, including its payload.

      • eventId (string) –

        The event’s ID.

      • spaceId (string) –

        The ID of the space.

      • actorId (string) –

        The ID of the actor the event belongs to.

      • sessionId (string) –

        The ID of the session the event belongs to.

      • payload (dict) –

        The event’s content, as submitted to CreateEvent.

        Note

        This is a Tagged Union structure. Only one of the following top level keys will be set: conversational, structuredData, blob. 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'}
        
        • conversational (dict) –

          Conversation turns.

          Note

          This is a Tagged Union structure. Only one of the following top level keys will be set: unified. 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'}
          
          • unified (dict) –

            Conversation turns in the service’s own format.

            • source (dict) –

              The conversation.

              Note

              This is a Tagged Union structure. Only one of the following top level keys will be set: object. 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'}
              
              • object (dict) –

                The conversation turns.

                • messages (list) –

                  The conversation turns, in order. The order matters for extraction.

                  • (dict) –

                    A conversation turn.

                    • role (string) –

                      The author of the turn.

                    • content (dict) –

                      The content of the turn.

                      • text (string) –

                        The text of the turn.

        • structuredData (dict) –

          Structured (non-conversational) content, for example a deployment result that an agent should remember.

          • source (dict) –

            The structured content.

            Note

            This is a Tagged Union structure. Only one of the following top level keys will be set: json. 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'}
            
            • json (document) –

              The structured content, as a JSON object of at most 1 MiB when serialized as UTF-8, nested at most 10 levels deep.

        • blob (dict) –

          A document stored in Amazon S3, such as a PDF.

          • contentType (string) –

            The document’s media type. Only application/pdf is supported. Any other value fails with ValidationException.

          • source (dict) –

            The location of the document.

            Note

            This is a Tagged Union structure. Only one of the following top level keys will be set: s3Location. 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'}
            
            • s3Location (dict) –

              The S3 object holding the document.

              • uri (string) –

                The object’s S3 URI, for example s3://bucket/key. The bucket must be in the space’s Region. You need s3:GetObject on the object, and kms:Decrypt on its key if the object uses SSE-KMS. The event doesn’t store the object itself.

      • metadata (dict) –

        The event’s metadata tags, as supplied to CreateEvent. May be empty.

        • (string) –

          A metadata key: letters, digits, hyphens ( -), and underscores ( _). Dots are not allowed, because a query uses dots to separate nested field names.

          • (string) –

            The value of a metadata entry.

      • eventTimestamp (datetime) –

        The time the event occurred.

Exceptions