create_event
async
¶
create_event(
space_id: SpaceId,
actor_id: ActorId,
payload: EventPayload,
*,
config_overrides: Optional[AsyncOpenSearchMemoryClientConfig] = None,
session_id: Optional[SessionId] = None,
event_timestamp: Optional[EventTimestamp] = None,
metadata: Optional[MetadataMap] = None,
client_token: Optional[ClientToken] = None,
infer: Optional[bool] = None,
) -> CreateEventOutput
Submits an event (conversation turns, structured data, or a PDF document stored in Amazon S3) to a session in a space.
The operation returns as soon as the event is saved. GetEvent and ListEvents return it immediately. SearchEvents returns it after it's indexed. SearchMemories returns memories extracted from it only after a strategy's extraction trigger fires and the memories are indexed.
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.
Parameters:
-
space_id(SpaceId) –The ID of the space that owns the event, for example
sp-02864597b164. -
actor_id(ActorId) –The ID of the actor (end user or agent) that the event belongs to.
-
session_id(Optional[SessionId], default:None) –The session the event belongs to. Send every event of one conversation with the same session ID, so that
SUMMARYstrategies summarize the conversation as one session. If you omit it, the service generates a session ID and returns it. -
event_timestamp(Optional[EventTimestamp], default:None) –When the event occurred. The default is the time that the service receives the request.
-
payload(EventPayload) –The event content. Set exactly one union member.
-
metadata(Optional[MetadataMap], default:None) –Metadata tags to store with the event. Memories derived from the event carry the same tags. Keys that begin with
x-amz-, the keysdocumentS3SourceanddocumentS3Url, and other keys that the service uses internally are reserved: a request that sets one fails withValidationException, and the message names the key.A space can use at most 50 distinct metadata keys across all of its events and memories. A request that would add a key beyond that fails with
ValidationException. Reuse an existing key instead. -
client_token(Optional[ClientToken], default:None) –A unique, case-sensitive identifier that makes the request idempotent. Within 2 hours of the first request, a retry with the same token and the same request, including the same
sessionId, returns the same event. If you omitsessionId, the service generates a new one on each attempt, so a retry fails withConflictException. Reusing the token with different request content also fails withConflictException.eventTimestampisn't compared. After 2 hours, the token starts a new event. -
infer(Optional[bool], default:None) –Specifies whether to extract memories from this event. The default is
true. Set it tofalseto store the event without extraction: the service skips strategies that infer memories, and still indexes the event's turns forSearchEvents. A document submitted as ablobis still extracted.
Raises:
-
AccessDeniedException–You don't have sufficient access to perform this operation. To use this operation, you must have AWS Identity and Access Management (IAM) permissions for the operation, and on the resource it acts on. If the space uses a customer managed AWS Key Management Service (AWS KMS) key, you must also have permission to use the key.
-
ConflictException–The request conflicts with the current state of the resource. For example, the space is being created, updated, or deleted, a space with the same name already exists, or you reused a client token with different parameters. Wait for the space to finish being created, updated, or deleted, or use a different name or client token, and then retry.
-
InternalServerException–The service couldn't process the request because of an internal error. Retry the request.
-
ResourceNotFoundException–The specified resource doesn't exist. Check the IDs in the request.
-
ThrottlingException–The service throttled the request. Retry the request with exponential backoff.
-
ValidationException–The request isn't valid. The
reason,message, andfieldListmembers describe the problem. Fix the request, and then try again. -
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_opensearchmemory/_services/async_open_search_memory.py
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 | |