Agent Platform API . memoryBanks

Instance Methods

memories()

Returns the memories Resource.

operations()

Returns the operations Resource.

close()

Close httplib2 connections.

ingestEvents(parent, body=None, x__xgafv=None)

Ingests events for a Memory Bank.

Method Details

close()
Close httplib2 connections.
ingestEvents(parent, body=None, x__xgafv=None)
Ingests events for a Memory Bank.

Args:
  parent: string, Required. The resource name of the ReasoningEngine to ingest events to. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}` (required)
  body: object, The request body.
    The object takes the form of:

{ # Request message for MemoryBankService.IngestEvents.
  "directContentsSource": { # Ingest events directly from the request. # Ingest events directly from the request.
    "events": [ # Required. The events to ingest.
      { # A single event to ingest.
        "content": { # 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. # Required. The content of the event.
          "parts": [ # 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.
            { # A datatype containing media that is part of a multi-part Content message. A `Part` consists of data which has an associated datatype. A `Part` can only contain one of the accepted types in `Part.data`. For media types that are not text, `Part` must have a fixed IANA MIME type identifying the type and subtype of the media if `inline_data` or `file_data` field is filled with raw bytes.
              "audioTranscription": { # The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate `Part` with its own `AudioTranscription` carrying the `speaker_label`. # Optional. Audio (input or output) transcription. This is only set when this `Part` contains audio data.
                "speakerLabel": "A String", # Optional. A label identifying the speaker of this audio segment (e.g. `spk_1`, `spk_2`). Present when `diarization` is set.
                "text": "A String", # Required. The transcription text of this audio segment.
                "words": [ # Optional. Detailed word-level transcriptions and timing details. Present when `word_timestamp` is set.
                  { # Information about a single recognized word.
                    "endOffset": "A String", # Optional. End offset in time of the word relative to the start of the audio.
                    "startOffset": "A String", # Optional. Start offset in time of the word relative to the start of the audio.
                    "word": "A String", # Required. Transcript of the word.
                  },
                ],
              },
              "codeExecutionResult": { # Result of executing the ExecutableCode. Generated only when the `CodeExecution` tool is used. # Optional. The result of executing the ExecutableCode.
                "id": "A String", # Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id.
                "outcome": "A String", # Required. Outcome of the code execution.
                "output": "A String", # Optional. Contains stdout when code execution is successful, stderr or other description otherwise.
              },
              "executableCode": { # 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. # Optional. Code generated by the model that is intended to be executed.
                "code": "A String", # Required. The code to be executed.
                "id": "A String", # Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`.
                "language": "A String", # Required. Programming language of the `code`.
              },
              "fileData": { # 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. # Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage.
                "displayName": "A 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.
                "fileUri": "A String", # Required. The URI of the file in Google Cloud Storage.
                "mimeType": "A String", # Required. The IANA standard MIME type of the source data.
              },
              "functionCall": { # 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. # Optional. A predicted function call returned from the model. This contains the name of the function to call and the arguments to pass to the function.
                "args": { # Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details.
                  "a_key": "", # Properties of the object.
                },
                "id": "A String", # Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`.
                "name": "A String", # Optional. The name of the function to call. Matches FunctionDeclaration.name.
                "partialArgs": [ # Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally.
                  { # Partial argument value of the function call.
                    "boolValue": True or False, # Optional. Represents a boolean value.
                    "jsonPath": "A String", # Required. A JSON Path (RFC 9535) to the argument being streamed. https://datatracker.ietf.org/doc/html/rfc9535. e.g. "$.foo.bar[0].data".
                    "nullValue": "A String", # Optional. Represents a null value.
                    "numberValue": 3.14, # Optional. Represents a double value.
                    "stringValue": "A String", # Optional. Represents a string value.
                    "willContinue": True or False, # Optional. Whether this is not the last part of the same json_path. If true, another PartialArg message for the current json_path is expected to follow.
                  },
                ],
                "willContinue": True or False, # Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow.
              },
              "functionResponse": { # 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. # Optional. The result of a function call. This is used to provide the model with the result of a function call that it predicted.
                "id": "A String", # Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.
                "name": "A String", # Required. The name of the function to call. Matches FunctionDeclaration.name and FunctionCall.name.
                "parts": [ # Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types.
                  { # A datatype containing media that is part of a `FunctionResponse` message. A `FunctionResponsePart` consists of data which has an associated datatype. A `FunctionResponsePart` can only contain one of the accepted types in `FunctionResponsePart.data`. A `FunctionResponsePart` must have a fixed IANA MIME type identifying the type and subtype of the media if the `inline_data` field is filled with raw bytes.
                    "fileData": { # URI based data for function response. # URI based data.
                      "displayName": "A String", # Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.
                      "fileUri": "A String", # Required. URI.
                      "mimeType": "A String", # Required. The IANA standard MIME type of the source data.
                    },
                    "inlineData": { # Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field. # Inline media bytes.
                      "data": "A String", # Required. Raw bytes.
                      "displayName": "A String", # Optional. 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 currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.
                      "mimeType": "A String", # Required. The IANA standard MIME type of the source data.
                    },
                  },
                ],
                "response": { # 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.
                  "a_key": "", # Properties of the object.
                },
                "scheduling": "A String", # 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.
              },
              "inlineData": { # A content blob. A Blob contains data of a specific media type. It is used to represent images, audio, and video. # Optional. The inline data content of the part. This can be used to include images, audio, or video in a request.
                "data": "A String", # Required. The raw bytes of the data.
                "displayName": "A 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.
                "mimeType": "A String", # Required. The IANA standard MIME type of the source data.
              },
              "mediaResolution": { # per part media resolution. Media resolution for the input media. # per part media resolution. Media resolution for the input media.
                "level": "A String", # The tokenization quality used for given media.
              },
              "text": "A 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.
              "thought": True or False, # Optional. Indicates whether the `part` represents the model's thought process or reasoning.
              "thoughtSignature": "A String", # Optional. An opaque signature for the thought so it can be reused in subsequent requests.
              "videoMetadata": { # Provides metadata for a video, including the start and end offsets for clipping and the frame rate. # Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data.
                "endOffset": "A String", # Optional. The end offset of the video.
                "fps": 3.14, # 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": "A String", # Optional. The start offset of the video.
              },
            },
          ],
          "role": "A String", # Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'.
        },
        "eventId": "A String", # Optional. A unique identifier for the event. If an event with the same event_id is ingested multiple times, it will be de-duplicated.
        "eventTime": "A String", # Optional. The time at which the event occurred. If provided, this timestamp will be used for ordering events within a stream. If not provided, the server-side ingestion time will be used.
      },
    ],
  },
  "disableMemoryRevisions": True or False, # Optional. If true, no revisions will be created for this request.
  "forceFlush": True or False, # Optional. Forces a flush of all pending events in the stream and triggers memory generation immediately bypassing any conditions configured in the `generation_trigger_config`.
  "generationTriggerConfig": { # Represents configuration for triggering generation. # Optional. Configuration for triggering memory generation from this ingestion. If not set, then the stream will be force flushed immediately.
    "generationRule": { # Represents the active rule that determines when to flush the buffer. # Optional. Represents the active rule that determines when to flush the buffer. If not set, then the stream will be force flushed immediately.
      "eventCount": 42, # Optional. Specifies to trigger generation when the event count reaches this limit.
      "fixedInterval": "A String", # Optional. Specifies to trigger generation at a fixed interval. The duration must have a minute-level granularity.
      "idleDuration": "A String", # Optional. Specifies to trigger generation if the stream is inactive for the specified duration after the most recent event. The duration must have a minute-level granularity.
      "overlapEventCount": 42, # Optional. Re-include the last N already-processed events in the next window.
    },
  },
  "metadata": { # Optional. User-provided metadata for the generated memories. This is not generated by Memory Bank.
    "a_key": { # Memory metadata.
      "boolValue": True or False, # Represents a boolean value.
      "doubleValue": 3.14, # Represents a double value.
      "stringValue": "A String", # Represents a string value.
      "timestampValue": "A String", # Represents a timestamp value. When filtering on timestamp values, only the seconds field will be compared.
    },
  },
  "metadataMergeStrategy": "A String", # Optional. The strategy to use when applying metadata to existing memories.
  "revisionExpireTime": "A String", # Optional. Timestamp of when the revision is considered expired. If not set, the memory revision will be kept until manually deleted.
  "revisionLabels": { # Optional. Labels to be applied to the generated memory revisions. For example, you can use this to label a revision with its data source.
    "a_key": "A String",
  },
  "revisionTtl": "A String", # Optional. The TTL for the revision. The expiration time is computed: now + TTL.
  "scope": { # Required. The scope of the memories that should be generated from the stream. Memories will be consolidated across memories with the same scope. Scope values cannot contain the wildcard character '*'.
    "a_key": "A String",
  },
  "streamId": "A String", # Optional. The ID of the stream to ingest events into. If not provided, a new one will be created.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # This resource represents a long-running operation that is the result of a network API call.
  "done": True or False, # If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
  "error": { # The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). # The error result of the operation in case of failure or cancellation.
    "code": 42, # The status code, which should be an enum value of google.rpc.Code.
    "details": [ # A list of messages that carry the error details. There is a common set of message types for APIs to use.
      {
        "a_key": "", # Properties of the object. Contains field @type with type URL.
      },
    ],
    "message": "A String", # A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
  },
  "metadata": { # Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
    "a_key": "", # Properties of the object. Contains field @type with type URL.
  },
  "name": "A String", # The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
  "response": { # The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
    "a_key": "", # Properties of the object. Contains field @type with type URL.
  },
}