---
title: "POST /v1/{+parent}/memories:generate"
method: POST
path: "/v1/{+parent}/memories:generate"
tags: ["projects"]
---

# POST /v1/{+parent}/memories:generate

`POST /v1/{+parent}/memories:generate`

Generate memories.

## Path parameters

- `parent` string, required

## Request body

- GoogleCloudAiplatformV1GenerateMemoriesRequest — Request message for MemoryBankService.GenerateMemories. Maximum size is 8 MB.
  - `directContentsSource` GoogleCloudAiplatformV1GenerateMemoriesRequestDirectContentsSource — Defines a direct source of content from which to generate the memories.
    - `events` GoogleCloudAiplatformV1GenerateMemoriesRequestDirectContentsSourceEvent[] — Required. The source content (i.e. chat history) to generate memories from.
      - `content` GoogleCloudAiplatformV1Content — The structured data content of a message. A Content message contains a `role` field, which indicates the producer of the content, and a `parts` field, which contains the multi-part data of the message.
        - `parts` GoogleCloudAiplatformV1Part[] — Required. A list of Part objects that make up a single message. Parts of a message can have different MIME types. A Content message must have at least one Part.
          - `fileData` GoogleCloudAiplatformV1FileData — URI-based data. A FileData message contains a URI pointing to data of a specific media type. It is used to represent images, audio, and video stored in Google Cloud Storage.
            - `mimeType` string — Required. The IANA standard MIME type of the source data.
            - `fileUri` string — Required. The URI of the file in Google Cloud Storage.
            - `displayName` string — Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server side tools (`code_execution`, `google_search`, and `url_context`) are enabled.
          - `executableCode` GoogleCloudAiplatformV1ExecutableCode — Code generated by the model that is meant to be executed, and the result returned to the model. Generated when using the `CodeExecution` tool, in which the code will be automatically executed, and a corresponding CodeExecutionResult will also be generated.
            - `language` 'LANGUAGE_UNSPECIFIED' | 'PYTHON' — Required. Programming language of the `code`.
            - `code` string — Required. The code to be executed.
          - `codeExecutionResult` GoogleCloudAiplatformV1CodeExecutionResult — Result of executing the ExecutableCode. Generated only when the `CodeExecution` tool is used.
            - `outcome` 'OUTCOME_UNSPECIFIED' | 'OUTCOME_OK' | 'OUTCOME_FAILED' | 'OUTCOME_DEADLINE_EXCEEDED' — Required. Outcome of the code execution.
            - `output` string — Optional. Contains stdout when code execution is successful, stderr or other description otherwise.
          - `functionResponse` GoogleCloudAiplatformV1FunctionResponse — The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a `FunctionCall` made based on model prediction.
            - `name` string — Required. The name of the function to call. Matches FunctionDeclaration.name and FunctionCall.name.
            - `response` object — Required. The function response in JSON object format. Use "output" key to specify function output and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as function output.
            - `parts` GoogleCloudAiplatformV1FunctionResponsePart[] — Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types.
              - …
            - `scheduling` 'SCHEDULING_UNSPECIFIED' | 'SILENT' | 'WHEN_IDLE' | 'INTERRUPT' — Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE.
          - `mediaResolution` GoogleCloudAiplatformV1PartMediaResolution — per part media resolution. Media resolution for the input media.
            - `level` 'MEDIA_RESOLUTION_UNSPECIFIED' | 'MEDIA_RESOLUTION_LOW' | 'MEDIA_RESOLUTION_MEDIUM' | 'MEDIA_RESOLUTION_HIGH' | 'MEDIA_RESOLUTION_ULTRA_HIGH' — The tokenization quality used for given media.
          - `thought` boolean — Optional. Indicates whether the `part` represents the model's thought process or reasoning.
          - `text` string — Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example `@my-repo` will be converted to and sent as `**my-repo**` by the IDE agent.
          - `functionCall` GoogleCloudAiplatformV1FunctionCall — A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values.
            - `name` string — Optional. The name of the function to call. Matches FunctionDeclaration.name.
            - `willContinue` boolean — Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow.
            - `args` object — Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details.
            - `partialArgs` GoogleCloudAiplatformV1PartialArg[] — Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally.
              - …
          - `thoughtSignature` string, byte — Optional. An opaque signature for the thought so it can be reused in subsequent requests.
          - `inlineData` GoogleCloudAiplatformV1Blob — A content blob. A Blob contains data of a specific media type. It is used to represent images, audio, and video.
            - `data` string, byte — Required. The raw bytes of the data.
            - `mimeType` string — Required. The IANA standard MIME type of the source data.
            - `displayName` string — Optional. The display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server-side tools (`code_execution`, `google_search`, and `url_context`) are enabled.
          - `videoMetadata` GoogleCloudAiplatformV1VideoMetadata — Provides metadata for a video, including the start and end offsets for clipping and the frame rate.
            - `fps` number, double — Optional. The frame rate of the video sent to the model. If not specified, the default value is 1.0. The valid range is (0.0, 24.0].
            - `startOffset` string, google-duration — Optional. The start offset of the video.
            - `endOffset` string, google-duration — Optional. The end offset of the video.
        - `role` string — Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'.
  - `disableConsolidation` boolean — Optional. If true, generated memories will not be consolidated with existing memories; all generated memories will be added as new memories regardless of whether they are duplicates of or contradictory to existing memories. By default, memory consolidation is enabled.
  - `allowedTopics` GoogleCloudAiplatformV1MemoryTopicId[] — Optional. Restricts memory generation to a subset of memory topics.
    - `customMemoryTopicLabel` string — Optional. Represents the custom memory topic label.
    - `managedMemoryTopic` 'MANAGED_TOPIC_ENUM_UNSPECIFIED' | 'USER_PERSONAL_INFO' | 'USER_PREFERENCES' | 'KEY_CONVERSATION_DETAILS' | 'EXPLICIT_INSTRUCTIONS' — Optional. Represents the managed memory topic.
  - `revisionExpireTime` string, google-datetime — Optional. Timestamp of when the revision is considered expired. If not set, the memory revision will be kept until manually deleted.
  - `revisionLabels` object — Optional. Labels to be applied to the generated memory revisions. For example, you can use this to label a revision with its data source.
  - `metadata` object — Optional. User-provided metadata for the generated memories. This is not generated by Memory Bank.
  - `vertexSessionSource` GoogleCloudAiplatformV1GenerateMemoriesRequestVertexSessionSource — Defines an Agent Engine Session from which to generate the memories. If `scope` is not provided, the scope will be extracted from the Session (i.e. {"user_id": sesison.user_id}).
    - `startTime` string, google-datetime — Optional. Time range to define which session events should be used to generate memories. Start time (inclusive) of the time range. If not set, the start time is unbounded.
    - `session` string — Required. The resource name of the Session to generate memories for. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}`
    - `endTime` string, google-datetime — Optional. End time (exclusive) of the time range. If not set, the end time is unbounded.
  - `directMemoriesSource` GoogleCloudAiplatformV1GenerateMemoriesRequestDirectMemoriesSource — Defines a direct source of memories that should be uploaded to Memory Bank with consolidation.
    - `directMemories` GoogleCloudAiplatformV1GenerateMemoriesRequestDirectMemoriesSourceDirectMemory[] — Required. The direct memories to upload to Memory Bank. At most 5 direct memories are allowed per request.
      - `fact` string — Required. The fact to consolidate with existing memories.
      - `topics` GoogleCloudAiplatformV1MemoryTopicId[] — Optional. The topics that the consolidated memories should be associated with.
        - `customMemoryTopicLabel` string — Optional. Represents the custom memory topic label.
        - `managedMemoryTopic` 'MANAGED_TOPIC_ENUM_UNSPECIFIED' | 'USER_PERSONAL_INFO' | 'USER_PREFERENCES' | 'KEY_CONVERSATION_DETAILS' | 'EXPLICIT_INSTRUCTIONS' — Optional. Represents the managed memory topic.
  - `scope` object — Optional. The scope of the memories that should be generated. Memories will be consolidated across memories with the same scope. Must be provided unless the scope is defined in the source content. If `scope` is provided, it will override the scope defined in the source content. Scope values cannot contain the wildcard character '*'.
  - `revisionTtl` string, google-duration — Optional. The TTL for the revision. The expiration time is computed: now + TTL.
  - `disableMemoryRevisions` boolean — Optional. If true, no revisions will be created for this request.
  - `metadataMergeStrategy` 'METADATA_MERGE_STRATEGY_UNSPECIFIED' | 'OVERWRITE' | 'MERGE' | 'REQUIRE_EXACT_MATCH' — Optional. The strategy to use when applying metadata to existing memories.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/aiplatform.md) · [All operations](https://skmtc.net/google/apis/aiplatform/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/aiplatform/revisions/b608d71b91f0/schema)
