From a451fa374f670d2540f654866eb1091948efaf79 Mon Sep 17 00:00:00 2001 From: Jeff Scudder Date: Sat, 17 Jan 2026 15:56:33 -0800 Subject: [PATCH] feat: Update data types from discovery doc. PiperOrigin-RevId: 857645392 --- vertexai/_genai/evals.py | 14 ++ vertexai/_genai/types/__init__.py | 14 ++ vertexai/_genai/types/common.py | 395 +++++++++++++++++++----------- 3 files changed, 285 insertions(+), 138 deletions(-) diff --git a/vertexai/_genai/evals.py b/vertexai/_genai/evals.py index b4b1d7f2a9..4f3c5b6083 100644 --- a/vertexai/_genai/evals.py +++ b/vertexai/_genai/evals.py @@ -130,6 +130,13 @@ def _CustomCodeExecutionSpec_from_vertex( getv(from_object, ["evaluation_function"]), ) + if getv(from_object, ["evaluationFunction"]) is not None: + setv( + to_object, + ["evaluation_function"], + getv(from_object, ["evaluationFunction"]), + ) + return to_object @@ -145,6 +152,13 @@ def _CustomCodeExecutionSpec_to_vertex( getv(from_object, ["remote_custom_function"]), ) + if getv(from_object, ["evaluation_function"]) is not None: + setv( + to_object, + ["evaluationFunction"], + getv(from_object, ["evaluation_function"]), + ) + return to_object diff --git a/vertexai/_genai/types/__init__.py b/vertexai/_genai/types/__init__.py index 904c390edf..2d9cd7578c 100644 --- a/vertexai/_genai/types/__init__.py +++ b/vertexai/_genai/types/__init__.py @@ -388,6 +388,7 @@ from .common import ExecuteSandboxEnvironmentResponse from .common import ExecuteSandboxEnvironmentResponseDict from .common import ExecuteSandboxEnvironmentResponseOrDict +from .common import Framework from .common import GcsSource from .common import GcsSourceDict from .common import GcsSourceOrDict @@ -869,6 +870,12 @@ from .common import SchemaPromptInstanceVariableValue from .common import SchemaPromptInstanceVariableValueDict from .common import SchemaPromptInstanceVariableValueOrDict +from .common import SchemaPromptSpecAppBuilderData +from .common import SchemaPromptSpecAppBuilderDataDict +from .common import SchemaPromptSpecAppBuilderDataLinkedResource +from .common import SchemaPromptSpecAppBuilderDataLinkedResourceDict +from .common import SchemaPromptSpecAppBuilderDataLinkedResourceOrDict +from .common import SchemaPromptSpecAppBuilderDataOrDict from .common import SchemaPromptSpecMultimodalPrompt from .common import SchemaPromptSpecMultimodalPromptDict from .common import SchemaPromptSpecMultimodalPromptOrDict @@ -1753,6 +1760,12 @@ "SchemaPromptSpecMultimodalPrompt", "SchemaPromptSpecMultimodalPromptDict", "SchemaPromptSpecMultimodalPromptOrDict", + "SchemaPromptSpecAppBuilderDataLinkedResource", + "SchemaPromptSpecAppBuilderDataLinkedResourceDict", + "SchemaPromptSpecAppBuilderDataLinkedResourceOrDict", + "SchemaPromptSpecAppBuilderData", + "SchemaPromptSpecAppBuilderDataDict", + "SchemaPromptSpecAppBuilderDataOrDict", "SchemaPromptSpecPartList", "SchemaPromptSpecPartListDict", "SchemaPromptSpecPartListOrDict", @@ -1933,6 +1946,7 @@ "Language", "MachineConfig", "State", + "Framework", "EvaluationItemType", "SamplingMethod", "RubricContentType", diff --git a/vertexai/_genai/types/common.py b/vertexai/_genai/types/common.py index 736b2fc178..a5f3e5668a 100644 --- a/vertexai/_genai/types/common.py +++ b/vertexai/_genai/types/common.py @@ -293,6 +293,17 @@ class State(_common.CaseInSensitiveEnum): """Sandbox runtime has been deleted.""" +class Framework(_common.CaseInSensitiveEnum): + """Framework used to build the application.""" + + FRAMEWORK_UNSPECIFIED = "FRAMEWORK_UNSPECIFIED" + """Unspecified framework.""" + REACT = "REACT" + """React framework.""" + ANGULAR = "ANGULAR" + """Angular framework.""" + + class EvaluationItemType(_common.CaseInSensitiveEnum): """The type of the EvaluationItem.""" @@ -950,6 +961,10 @@ def evaluate(instance: dict[str, Any]) -> float: Instance is the evaluation instance, any fields populated in the instance are available to the function as instance[field_name].""", ) + evaluation_function: Optional[str] = Field( + default=None, + description="""Required. Python function. Expected user to define the following function, e.g.: def evaluate(instance: dict[str, Any]) -> float: Please include this function signature in the code snippet. Instance is the evaluation instance, any fields populated in the instance are available to the function as instance[field_name]. Example: Example input: ``` instance= EvaluationInstance( response=EvaluationInstance.InstanceData(text="The answer is 4."), reference=EvaluationInstance.InstanceData(text="4") ) ``` Example converted input: ``` { 'response': {'text': 'The answer is 4.'}, 'reference': {'text': '4'} } ``` Example python function: ``` def evaluate(instance: dict[str, Any]) -> float: if instance'response' == instance'reference': return 1.0 return 0.0 ``` CustomCodeExecutionSpec is also supported in Batch Evaluation (EvalDataset RPC) and Tuning Evaluation. Each line in the input jsonl file will be converted to dict[str, Any] and passed to the evaluation function.""", + ) class CustomCodeExecutionSpecDict(TypedDict, total=False): @@ -963,6 +978,9 @@ def evaluate(instance: dict[str, Any]) -> float: Instance is the evaluation instance, any fields populated in the instance are available to the function as instance[field_name].""" + evaluation_function: Optional[str] + """Required. Python function. Expected user to define the following function, e.g.: def evaluate(instance: dict[str, Any]) -> float: Please include this function signature in the code snippet. Instance is the evaluation instance, any fields populated in the instance are available to the function as instance[field_name]. Example: Example input: ``` instance= EvaluationInstance( response=EvaluationInstance.InstanceData(text="The answer is 4."), reference=EvaluationInstance.InstanceData(text="4") ) ``` Example converted input: ``` { 'response': {'text': 'The answer is 4.'}, 'reference': {'text': '4'} } ``` Example python function: ``` def evaluate(instance: dict[str, Any]) -> float: if instance'response' == instance'reference': return 1.0 return 0.0 ``` CustomCodeExecutionSpec is also supported in Batch Evaluation (EvalDataset RPC) and Tuning Evaluation. Each line in the input jsonl file will be converted to dict[str, Any] and passed to the evaluation function.""" + CustomCodeExecutionSpecOrDict = Union[ CustomCodeExecutionSpec, CustomCodeExecutionSpecDict @@ -4157,7 +4175,7 @@ class MachineSpec(_common.BaseModel): accelerator_count: Optional[int] = Field( default=None, - description="""The number of accelerators to attach to the machine.""", + description="""The number of accelerators to attach to the machine. For accelerator optimized machine types (https://cloud.google.com/compute/docs/accelerator-optimized-machines), One may set the accelerator_count from 1 to N for machine with N GPUs. If accelerator_count is less than or equal to N / 2, Vertex will co-schedule the replicas of the model into the same VM to save cost. For example, if the machine type is a3-highgpu-8g, which has 8 H100 GPUs, one can set accelerator_count to 1 to 8. If accelerator_count is 1, 2, 3, or 4, Vertex will co-schedule 8, 4, 2, or 2 replicas of the model into the same VM to save cost. When co-scheduling, CPU, memory and storage on the VM will be distributed to replicas on the VM. For example, one can expect a co-scheduled replica requesting 2 GPUs out of a 8-GPU VM will receive 25% of the CPU, memory and storage of the VM. Note that the feature is not compatible with multihost_gpu_node_count. When multihost_gpu_node_count is set, the co-scheduling will not be enabled.""", ) accelerator_type: Optional[AcceleratorType] = Field( default=None, @@ -4171,6 +4189,10 @@ class MachineSpec(_common.BaseModel): default=None, description="""Immutable. The type of the machine. See the [list of machine types supported for prediction](https://cloud.google.com/vertex-ai/docs/predictions/configure-compute#machine-types) See the [list of machine types supported for custom training](https://cloud.google.com/vertex-ai/docs/training/configure-compute#machine-types). For DeployedModel this field is optional, and the default value is `n1-standard-2`. For BatchPredictionJob or as part of WorkerPoolSpec this field is required.""", ) + min_gpu_driver_version: Optional[str] = Field( + default=None, + description="""Optional. Immutable. The minimum GPU driver version that this machine requires. For example, "535.104.06". If not specified, the default GPU driver version will be used by the underlying infrastructure.""", + ) multihost_gpu_node_count: Optional[int] = Field( default=None, description="""Optional. Immutable. The number of nodes per replica for multihost GPU deployments.""", @@ -4189,7 +4211,7 @@ class MachineSpecDict(TypedDict, total=False): """Specification of a single machine.""" accelerator_count: Optional[int] - """The number of accelerators to attach to the machine.""" + """The number of accelerators to attach to the machine. For accelerator optimized machine types (https://cloud.google.com/compute/docs/accelerator-optimized-machines), One may set the accelerator_count from 1 to N for machine with N GPUs. If accelerator_count is less than or equal to N / 2, Vertex will co-schedule the replicas of the model into the same VM to save cost. For example, if the machine type is a3-highgpu-8g, which has 8 H100 GPUs, one can set accelerator_count to 1 to 8. If accelerator_count is 1, 2, 3, or 4, Vertex will co-schedule 8, 4, 2, or 2 replicas of the model into the same VM to save cost. When co-scheduling, CPU, memory and storage on the VM will be distributed to replicas on the VM. For example, one can expect a co-scheduled replica requesting 2 GPUs out of a 8-GPU VM will receive 25% of the CPU, memory and storage of the VM. Note that the feature is not compatible with multihost_gpu_node_count. When multihost_gpu_node_count is set, the co-scheduling will not be enabled.""" accelerator_type: Optional[AcceleratorType] """Immutable. The type of accelerator(s) that may be attached to the machine as per accelerator_count.""" @@ -4200,6 +4222,9 @@ class MachineSpecDict(TypedDict, total=False): machine_type: Optional[str] """Immutable. The type of the machine. See the [list of machine types supported for prediction](https://cloud.google.com/vertex-ai/docs/predictions/configure-compute#machine-types) See the [list of machine types supported for custom training](https://cloud.google.com/vertex-ai/docs/training/configure-compute#machine-types). For DeployedModel this field is optional, and the default value is `n1-standard-2`. For BatchPredictionJob or as part of WorkerPoolSpec this field is required.""" + min_gpu_driver_version: Optional[str] + """Optional. Immutable. The minimum GPU driver version that this machine requires. For example, "535.104.06". If not specified, the default GPU driver version will be used by the underlying infrastructure.""" + multihost_gpu_node_count: Optional[int] """Optional. Immutable. The number of nodes per replica for multihost GPU deployments.""" @@ -4686,7 +4711,7 @@ class ReasoningEngineSpecDeploymentSpec(_common.BaseModel): ) container_concurrency: Optional[int] = Field( default=None, - description="""Optional. The maximum number of concurrent requests that can be handled by the application. Defaults to 8.""", + description="""Optional. Concurrency for each container and agent server. Recommended value: 2 * cpu + 1. Defaults to 9.""", ) env: Optional[list[EnvVar]] = Field( default=None, @@ -4698,14 +4723,14 @@ class ReasoningEngineSpecDeploymentSpec(_common.BaseModel): ) min_instances: Optional[int] = Field( default=None, - description="""Optional. The minimum number of application instances that will be kept running at all times. Defaults to 1.""", + description="""Optional. The minimum number of application instances that will be kept running at all times. Defaults to 1. Range: [0, 10].""", ) psc_interface_config: Optional[PscInterfaceConfig] = Field( default=None, description="""Optional. Configuration for PSC-I.""" ) resource_limits: Optional[dict[str, str]] = Field( default=None, - description="""Optional. Resource limits for each container. Only 'cpu' and 'memory' keys are supported. Defaults to {"cpu": "4", "memory": "4Gi"}. * The only supported values for CPU are '1', '2', '4', and '8'. For more information, go to https://cloud.google.com/run/docs/configuring/cpu. * For supported 'memory' values and syntax, go to https://cloud.google.com/run/docs/configuring/memory-limits""", + description="""Optional. Resource limits for each container. Only 'cpu' and 'memory' keys are supported. Defaults to {"cpu": "4", "memory": "4Gi"}. * The only supported values for CPU are '1', '2', '4', '6' and '8'. For more information, go to https://cloud.google.com/run/docs/configuring/cpu. * The only supported values for memory are '1Gi', '2Gi', ... '32 Gi'. * For required cpu on different memory values, go to https://cloud.google.com/run/docs/configuring/memory-limits""", ) secret_env: Optional[list[SecretEnvVar]] = Field( default=None, @@ -4720,7 +4745,7 @@ class ReasoningEngineSpecDeploymentSpecDict(TypedDict, total=False): """The agent server mode.""" container_concurrency: Optional[int] - """Optional. The maximum number of concurrent requests that can be handled by the application. Defaults to 8.""" + """Optional. Concurrency for each container and agent server. Recommended value: 2 * cpu + 1. Defaults to 9.""" env: Optional[list[EnvVarDict]] """Optional. Environment variables to be set with the Reasoning Engine deployment. The environment variables can be updated through the UpdateReasoningEngine API.""" @@ -4729,13 +4754,13 @@ class ReasoningEngineSpecDeploymentSpecDict(TypedDict, total=False): """Optional. The maximum number of application instances that can be launched to handle increased traffic. Defaults to 100. Range: [1, 1000]. If VPC-SC or PSC-I is enabled, the acceptable range is [1, 100].""" min_instances: Optional[int] - """Optional. The minimum number of application instances that will be kept running at all times. Defaults to 1.""" + """Optional. The minimum number of application instances that will be kept running at all times. Defaults to 1. Range: [0, 10].""" psc_interface_config: Optional[PscInterfaceConfigDict] """Optional. Configuration for PSC-I.""" resource_limits: Optional[dict[str, str]] - """Optional. Resource limits for each container. Only 'cpu' and 'memory' keys are supported. Defaults to {"cpu": "4", "memory": "4Gi"}. * The only supported values for CPU are '1', '2', '4', and '8'. For more information, go to https://cloud.google.com/run/docs/configuring/cpu. * For supported 'memory' values and syntax, go to https://cloud.google.com/run/docs/configuring/memory-limits""" + """Optional. Resource limits for each container. Only 'cpu' and 'memory' keys are supported. Defaults to {"cpu": "4", "memory": "4Gi"}. * The only supported values for CPU are '1', '2', '4', '6' and '8'. For more information, go to https://cloud.google.com/run/docs/configuring/cpu. * The only supported values for memory are '1Gi', '2Gi', ... '32 Gi'. * For required cpu on different memory values, go to https://cloud.google.com/run/docs/configuring/memory-limits""" secret_env: Optional[list[SecretEnvVarDict]] """Optional. Environment variables where the value is a secret in Cloud Secret Manager. To use this feature, add 'Secret Manager Secret Accessor' role (roles/secretmanager.secretAccessor) to AI Platform Reasoning Engine Service Agent.""" @@ -4759,7 +4784,7 @@ class ReasoningEngineSpecPackageSpec(_common.BaseModel): ) python_version: Optional[str] = Field( default=None, - description="""Optional. The Python version. Currently support 3.8, 3.9, 3.10, 3.11. If not specified, default value is 3.10.""", + description="""Optional. The Python version. Supported values are 3.9, 3.10, 3.11, 3.12, 3.13. If not specified, the default value is 3.10.""", ) requirements_gcs_uri: Optional[str] = Field( default=None, @@ -4777,7 +4802,7 @@ class ReasoningEngineSpecPackageSpecDict(TypedDict, total=False): """Optional. The Cloud Storage URI of the pickled python object.""" python_version: Optional[str] - """Optional. The Python version. Currently support 3.8, 3.9, 3.10, 3.11. If not specified, default value is 3.10.""" + """Optional. The Python version. Supported values are 3.9, 3.10, 3.11, 3.12, 3.13. If not specified, the default value is 3.10.""" requirements_gcs_uri: Optional[str] """Optional. The Cloud Storage URI of the `requirements.txt` file""" @@ -4837,7 +4862,7 @@ class ReasoningEngineSpecSourceCodeSpecDeveloperConnectSource(_common.BaseModel) config: Optional[ReasoningEngineSpecSourceCodeSpecDeveloperConnectConfig] = Field( default=None, - description="""Required. The Developer Connect configuration thats defines the specific repository, revision, and directory to use as the source code root.""", + description="""Required. The Developer Connect configuration that defines the specific repository, revision, and directory to use as the source code root.""", ) @@ -4847,7 +4872,7 @@ class ReasoningEngineSpecSourceCodeSpecDeveloperConnectSourceDict( """Specifies source code to be fetched from a Git repository managed through the Developer Connect service.""" config: Optional[ReasoningEngineSpecSourceCodeSpecDeveloperConnectConfigDict] - """Required. The Developer Connect configuration thats defines the specific repository, revision, and directory to use as the source code root.""" + """Required. The Developer Connect configuration that defines the specific repository, revision, and directory to use as the source code root.""" ReasoningEngineSpecSourceCodeSpecDeveloperConnectSourceOrDict = Union[ @@ -4861,7 +4886,7 @@ class ReasoningEngineSpecSourceCodeSpecInlineSource(_common.BaseModel): source_archive: Optional[bytes] = Field( default=None, - description="""Required. Input only. The application source code archive, provided as a compressed tarball (.tar.gz) file.""", + description="""Required. Input only. The application source code archive. It must be a compressed tarball (.tar.gz) file.""", ) @@ -4869,7 +4894,7 @@ class ReasoningEngineSpecSourceCodeSpecInlineSourceDict(TypedDict, total=False): """Specifies source code provided as a byte stream.""" source_archive: Optional[bytes] - """Required. Input only. The application source code archive, provided as a compressed tarball (.tar.gz) file.""" + """Required. Input only. The application source code archive. It must be a compressed tarball (.tar.gz) file.""" ReasoningEngineSpecSourceCodeSpecInlineSourceOrDict = Union[ @@ -4883,11 +4908,11 @@ class ReasoningEngineSpecSourceCodeSpecPythonSpec(_common.BaseModel): entrypoint_module: Optional[str] = Field( default=None, - description="""Optional. The Python module to load as the entrypoint, specified as a fully qualified module name. For example: path.to.agent. If not specified, defaults to "agent". The project root will be added to Python sys.path, allowing imports to be specified relative to the root.""", + description="""Optional. The Python module to load as the entrypoint, specified as a fully qualified module name. For example: path.to.agent. If not specified, defaults to "agent". The project root will be added to Python sys.path, allowing imports to be specified relative to the root. This field should not be set if the source is `agent_config_source`.""", ) entrypoint_object: Optional[str] = Field( default=None, - description="""Optional. The name of the callable object within the `entrypoint_module` to use as the application If not specified, defaults to "root_agent".""", + description="""Optional. The name of the callable object within the `entrypoint_module` to use as the application If not specified, defaults to "root_agent". This field should not be set if the source is `agent_config_source`.""", ) requirements_file: Optional[str] = Field( default=None, @@ -4903,10 +4928,10 @@ class ReasoningEngineSpecSourceCodeSpecPythonSpecDict(TypedDict, total=False): """Specification for running a Python application from source.""" entrypoint_module: Optional[str] - """Optional. The Python module to load as the entrypoint, specified as a fully qualified module name. For example: path.to.agent. If not specified, defaults to "agent". The project root will be added to Python sys.path, allowing imports to be specified relative to the root.""" + """Optional. The Python module to load as the entrypoint, specified as a fully qualified module name. For example: path.to.agent. If not specified, defaults to "agent". The project root will be added to Python sys.path, allowing imports to be specified relative to the root. This field should not be set if the source is `agent_config_source`.""" entrypoint_object: Optional[str] - """Optional. The name of the callable object within the `entrypoint_module` to use as the application If not specified, defaults to "root_agent".""" + """Optional. The name of the callable object within the `entrypoint_module` to use as the application If not specified, defaults to "root_agent". This field should not be set if the source is `agent_config_source`.""" requirements_file: Optional[str] """Optional. The path to the requirements file, relative to the source root. If not specified, defaults to "requirements.txt".""" @@ -4961,6 +4986,10 @@ class ReasoningEngineSpecSourceCodeSpecDict(TypedDict, total=False): class ReasoningEngineSpec(_common.BaseModel): """The specification of an agent engine.""" + agent_card: Optional[dict[str, Any]] = Field( + default=None, + description="""Optional. The A2A Agent Card for the agent (if available). It follows the specification at https://a2a-protocol.org/latest/specification/#5-agent-discovery-the-agent-card.""", + ) agent_framework: Optional[str] = Field( default=None, description="""Optional. The OSS agent framework used to develop the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", "llama-index", "custom".""", @@ -4998,6 +5027,9 @@ class ReasoningEngineSpec(_common.BaseModel): class ReasoningEngineSpecDict(TypedDict, total=False): """The specification of an agent engine.""" + agent_card: Optional[dict[str, Any]] + """Optional. The A2A Agent Card for the agent (if available). It follows the specification at https://a2a-protocol.org/latest/specification/#5-agent-discovery-the-agent-card.""" + agent_framework: Optional[str] """Optional. The OSS agent framework used to develop the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", "llama-index", "custom".""" @@ -5180,13 +5212,13 @@ class MemoryBankCustomizationConfigGenerateMemoriesExampleDict(TypedDict, total= class MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic(_common.BaseModel): """A custom memory topic defined by the developer.""" - label: Optional[str] = Field( - default=None, description="""Required. The label of the topic.""" - ) description: Optional[str] = Field( default=None, description="""Required. Description of the memory topic. This should explain what information should be extracted for this topic.""", ) + label: Optional[str] = Field( + default=None, description="""Required. The label of the topic.""" + ) class MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicDict( @@ -5194,12 +5226,12 @@ class MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicDict( ): """A custom memory topic defined by the developer.""" - label: Optional[str] - """Required. The label of the topic.""" - description: Optional[str] """Required. Description of the memory topic. This should explain what information should be extracted for this topic.""" + label: Optional[str] + """Required. The label of the topic.""" + MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopicOrDict = Union[ MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic, @@ -5268,6 +5300,10 @@ class MemoryBankCustomizationConfigMemoryTopicDict(TypedDict, total=False): class MemoryBankCustomizationConfig(_common.BaseModel): """Configuration for organizing memories for a particular scope.""" + enable_third_person_memories: Optional[bool] = Field( + default=None, + description="""Optional. If true, then the memories will be generated in the third person (i.e. "The user generates memories with Memory Bank."). By default, the memories will be generated in the first person (i.e. "I generate memories with Memory Bank.")""", + ) generate_memories_examples: Optional[ list[MemoryBankCustomizationConfigGenerateMemoriesExample] ] = Field( @@ -5282,15 +5318,14 @@ class MemoryBankCustomizationConfig(_common.BaseModel): default=None, description="""Optional. The scope keys (i.e. 'user_id') for which to use this config. A request's scope must include all of the provided keys for the config to be used (order does not matter). If empty, then the config will be used for all requests that do not have a more specific config. Only one default config is allowed per Memory Bank.""", ) - enable_third_person_memories: Optional[bool] = Field( - default=None, - description="""Optional. If true, then the memories will be generated in the third person (i.e. "The user generates memories with Memory Bank."). By default, the memories will be generated in the first person (i.e. "I generate memories with Memory Bank.")""", - ) class MemoryBankCustomizationConfigDict(TypedDict, total=False): """Configuration for organizing memories for a particular scope.""" + enable_third_person_memories: Optional[bool] + """Optional. If true, then the memories will be generated in the third person (i.e. "The user generates memories with Memory Bank."). By default, the memories will be generated in the first person (i.e. "I generate memories with Memory Bank.")""" + generate_memories_examples: Optional[ list[MemoryBankCustomizationConfigGenerateMemoriesExampleDict] ] @@ -5302,9 +5337,6 @@ class MemoryBankCustomizationConfigDict(TypedDict, total=False): scope_keys: Optional[list[str]] """Optional. The scope keys (i.e. 'user_id') for which to use this config. A request's scope must include all of the provided keys for the config to be used (order does not matter). If empty, then the config will be used for all requests that do not have a more specific config. Only one default config is allowed per Memory Bank.""" - enable_third_person_memories: Optional[bool] - """Optional. If true, then the memories will be generated in the third person (i.e. "The user generates memories with Memory Bank."). By default, the memories will be generated in the first person (i.e. "I generate memories with Memory Bank.")""" - MemoryBankCustomizationConfigOrDict = Union[ MemoryBankCustomizationConfig, MemoryBankCustomizationConfigDict @@ -5448,6 +5480,10 @@ class ReasoningEngineContextSpecMemoryBankConfig(_common.BaseModel): default=None, description="""Optional. Configuration for how to customize Memory Bank behavior for a particular scope.""", ) + disable_memory_revisions: Optional[bool] = Field( + default=None, + description="""If true, no memory revisions will be created for any requests to the Memory Bank.""", + ) generation_config: Optional[ ReasoningEngineContextSpecMemoryBankConfigGenerationConfig ] = Field( @@ -5464,10 +5500,6 @@ class ReasoningEngineContextSpecMemoryBankConfig(_common.BaseModel): default=None, description="""Optional. Configuration for automatic TTL ("time-to-live") of the memories in the Memory Bank. If not set, TTL will not be applied automatically. The TTL can be explicitly set by modifying the `expire_time` of each Memory resource.""", ) - disable_memory_revisions: Optional[bool] = Field( - default=None, - description="""If true, no memory revisions will be created for any requests to the Memory Bank.""", - ) class ReasoningEngineContextSpecMemoryBankConfigDict(TypedDict, total=False): @@ -5476,6 +5508,9 @@ class ReasoningEngineContextSpecMemoryBankConfigDict(TypedDict, total=False): customization_configs: Optional[list[MemoryBankCustomizationConfigDict]] """Optional. Configuration for how to customize Memory Bank behavior for a particular scope.""" + disable_memory_revisions: Optional[bool] + """If true, no memory revisions will be created for any requests to the Memory Bank.""" + generation_config: Optional[ ReasoningEngineContextSpecMemoryBankConfigGenerationConfigDict ] @@ -5489,9 +5524,6 @@ class ReasoningEngineContextSpecMemoryBankConfigDict(TypedDict, total=False): ttl_config: Optional[ReasoningEngineContextSpecMemoryBankConfigTtlConfigDict] """Optional. Configuration for automatic TTL ("time-to-live") of the memories in the Memory Bank. If not set, TTL will not be applied automatically. The TTL can be explicitly set by modifying the `expire_time` of each Memory resource.""" - disable_memory_revisions: Optional[bool] - """If true, no memory revisions will be created for any requests to the Memory Bank.""" - ReasoningEngineContextSpecMemoryBankConfigOrDict = Union[ ReasoningEngineContextSpecMemoryBankConfig, @@ -6757,26 +6789,6 @@ class _CreateAgentEngineMemoryRequestParametersDict(TypedDict, total=False): class Memory(_common.BaseModel): """A memory.""" - expire_time: Optional[datetime.datetime] = Field( - default=None, - description="""Optional. Timestamp of when this resource is considered expired. This is *always* provided on output when `expiration` is set on input, regardless of whether `expire_time` or `ttl` was provided.""", - ) - ttl: Optional[str] = Field( - default=None, - description="""Optional. Input only. The TTL for this resource. The expiration time is computed: now + TTL.""", - ) - revision_expire_time: Optional[datetime.datetime] = Field( - default=None, - description="""Optional. Input only. Timestamp of when the revision is considered expired. If not set, the memory revision will be kept until manually deleted.""", - ) - revision_ttl: Optional[str] = Field( - default=None, - description="""Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL.""", - ) - disable_memory_revisions: Optional[bool] = Field( - default=None, - description="""Optional. Input only. If true, no revision will be created for this request.""", - ) create_time: Optional[datetime.datetime] = Field( default=None, description="""Output only. Timestamp when this Memory was created.""", @@ -6784,78 +6796,105 @@ class Memory(_common.BaseModel): description: Optional[str] = Field( default=None, description="""Optional. Description of the Memory.""" ) + disable_memory_revisions: Optional[bool] = Field( + default=None, + description="""Optional. Input only. If true, no revision will be created for this request.""", + ) display_name: Optional[str] = Field( default=None, description="""Optional. Display name of the Memory.""" ) + expire_time: Optional[datetime.datetime] = Field( + default=None, + description="""Optional. Timestamp of when this resource is considered expired. This is *always* provided on output when `expiration` is set on input, regardless of whether `expire_time` or `ttl` was provided.""", + ) fact: Optional[str] = Field( default=None, description="""Required. Semantic knowledge extracted from the source content.""", ) + metadata: Optional[dict[str, "MemoryMetadataValue"]] = Field( + default=None, + description="""Optional. User-provided metadata for the Memory. This information was provided when creating, updating, or generating the Memory. It was not generated by Memory Bank.""", + ) name: Optional[str] = Field( default=None, description="""Identifier. The resource name of the Memory. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}`""", ) - scope: Optional[dict[str, str]] = Field( + revision_expire_time: Optional[datetime.datetime] = Field( default=None, - description="""Required. Immutable. The scope of the Memory. Memories are isolated within their scope. The scope is defined when creating or generating memories. Scope values cannot contain the wildcard character '*'.""", + description="""Optional. Input only. Timestamp of when the revision is considered expired. If not set, the memory revision will be kept until manually deleted.""", ) - update_time: Optional[datetime.datetime] = Field( + revision_labels: Optional[dict[str, str]] = Field( default=None, - description="""Output only. Timestamp when this Memory was most recently updated.""", + description="""Optional. Input only. The labels to apply to the Memory Revision created as a result of this request.""", + ) + revision_ttl: Optional[str] = Field( + default=None, + description="""Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL.""", + ) + scope: Optional[dict[str, str]] = Field( + default=None, + description="""Required. Immutable. The scope of the Memory. Memories are isolated within their scope. The scope is defined when creating or generating memories. Scope values cannot contain the wildcard character '*'.""", ) topics: Optional[list[MemoryTopicId]] = Field( default=None, description="""Optional. The Topics of the Memory.""" ) - metadata: Optional[dict[str, "MemoryMetadataValue"]] = Field( + ttl: Optional[str] = Field( default=None, - description="""Optional. User-provided metadata for the Memory. This information was provided when creating, updating, or generating the Memory. It was not generated by Memory Bank.""", + description="""Optional. Input only. The TTL for this resource. The expiration time is computed: now + TTL.""", + ) + update_time: Optional[datetime.datetime] = Field( + default=None, + description="""Output only. Timestamp when this Memory was most recently updated.""", ) class MemoryDict(TypedDict, total=False): """A memory.""" - expire_time: Optional[datetime.datetime] - """Optional. Timestamp of when this resource is considered expired. This is *always* provided on output when `expiration` is set on input, regardless of whether `expire_time` or `ttl` was provided.""" - - ttl: Optional[str] - """Optional. Input only. The TTL for this resource. The expiration time is computed: now + TTL.""" - - revision_expire_time: Optional[datetime.datetime] - """Optional. Input only. Timestamp of when the revision is considered expired. If not set, the memory revision will be kept until manually deleted.""" - - revision_ttl: Optional[str] - """Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL.""" - - disable_memory_revisions: Optional[bool] - """Optional. Input only. If true, no revision will be created for this request.""" - create_time: Optional[datetime.datetime] """Output only. Timestamp when this Memory was created.""" description: Optional[str] """Optional. Description of the Memory.""" + disable_memory_revisions: Optional[bool] + """Optional. Input only. If true, no revision will be created for this request.""" + display_name: Optional[str] """Optional. Display name of the Memory.""" + expire_time: Optional[datetime.datetime] + """Optional. Timestamp of when this resource is considered expired. This is *always* provided on output when `expiration` is set on input, regardless of whether `expire_time` or `ttl` was provided.""" + fact: Optional[str] """Required. Semantic knowledge extracted from the source content.""" + metadata: Optional[dict[str, "MemoryMetadataValueDict"]] + """Optional. User-provided metadata for the Memory. This information was provided when creating, updating, or generating the Memory. It was not generated by Memory Bank.""" + name: Optional[str] """Identifier. The resource name of the Memory. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}`""" + revision_expire_time: Optional[datetime.datetime] + """Optional. Input only. Timestamp of when the revision is considered expired. If not set, the memory revision will be kept until manually deleted.""" + + revision_labels: Optional[dict[str, str]] + """Optional. Input only. The labels to apply to the Memory Revision created as a result of this request.""" + + revision_ttl: Optional[str] + """Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL.""" + scope: Optional[dict[str, str]] """Required. Immutable. The scope of the Memory. Memories are isolated within their scope. The scope is defined when creating or generating memories. Scope values cannot contain the wildcard character '*'.""" - update_time: Optional[datetime.datetime] - """Output only. Timestamp when this Memory was most recently updated.""" - topics: Optional[list[MemoryTopicIdDict]] """Optional. The Topics of the Memory.""" - metadata: Optional[dict[str, "MemoryMetadataValueDict"]] - """Optional. User-provided metadata for the Memory. This information was provided when creating, updating, or generating the Memory. It was not generated by Memory Bank.""" + ttl: Optional[str] + """Optional. Input only. The TTL for this resource. The expiration time is computed: now + TTL.""" + + update_time: Optional[datetime.datetime] + """Output only. Timestamp when this Memory was most recently updated.""" MemoryOrDict = Union[Memory, MemoryDict] @@ -7673,30 +7712,30 @@ class RetrieveMemoriesRequestSimpleRetrievalParamsDict(TypedDict, total=False): class MemoryMetadataValue(_common.BaseModel): """Memory metadata.""" + bool_value: Optional[bool] = Field(default=None, description="""Boolean value.""") + double_value: Optional[float] = Field(default=None, description="""Double value.""") + string_value: Optional[str] = Field(default=None, description="""String value.""") timestamp_value: Optional[datetime.datetime] = Field( default=None, description="""Timestamp value. When filtering on timestamp values, only the seconds field will be compared.""", ) - double_value: Optional[float] = Field(default=None, description="""Double value.""") - bool_value: Optional[bool] = Field(default=None, description="""Boolean value.""") - string_value: Optional[str] = Field(default=None, description="""String value.""") class MemoryMetadataValueDict(TypedDict, total=False): """Memory metadata.""" - timestamp_value: Optional[datetime.datetime] - """Timestamp value. When filtering on timestamp values, only the seconds field will be compared.""" + bool_value: Optional[bool] + """Boolean value.""" double_value: Optional[float] """Double value.""" - bool_value: Optional[bool] - """Boolean value.""" - string_value: Optional[str] """String value.""" + timestamp_value: Optional[datetime.datetime] + """Timestamp value. When filtering on timestamp values, only the seconds field will be compared.""" + MemoryMetadataValueOrDict = Union[MemoryMetadataValue, MemoryMetadataValueDict] @@ -7704,16 +7743,16 @@ class MemoryMetadataValueDict(TypedDict, total=False): class MemoryFilter(_common.BaseModel): """Filter to apply when retrieving memories.""" - op: Optional[Operator] = Field( + key: Optional[str] = Field( default=None, - description="""Operator to apply to the filter. If not set, then EQUAL will be used.""", + description="""Key of the filter. For example, "author" would apply to `metadata` entries with the key "author".""", ) negate: Optional[bool] = Field( default=None, description="""If true, the filter will be negated.""" ) - key: Optional[str] = Field( + op: Optional[Operator] = Field( default=None, - description="""Key of the filter. For example, "author" would apply to `metadata` entries with the key "author".""", + description="""Operator to apply to the filter. If not set, then EQUAL will be used.""", ) value: Optional[MemoryMetadataValue] = Field( default=None, description="""Value to compare to.""" @@ -7723,14 +7762,14 @@ class MemoryFilter(_common.BaseModel): class MemoryFilterDict(TypedDict, total=False): """Filter to apply when retrieving memories.""" - op: Optional[Operator] - """Operator to apply to the filter. If not set, then EQUAL will be used.""" + key: Optional[str] + """Key of the filter. For example, "author" would apply to `metadata` entries with the key "author".""" negate: Optional[bool] """If true, the filter will be negated.""" - key: Optional[str] - """Key of the filter. For example, "author" would apply to `metadata` entries with the key "author".""" + op: Optional[Operator] + """Operator to apply to the filter. If not set, then EQUAL will be used.""" value: Optional[MemoryMetadataValueDict] """Value to compare to.""" @@ -8411,10 +8450,6 @@ class IntermediateExtractedMemoryDict(TypedDict, total=False): class MemoryRevision(_common.BaseModel): """A memory revision.""" - name: Optional[str] = Field( - default=None, - description="""Identifier. The resource name of the Memory Revision. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{memory_revision}`""", - ) create_time: Optional[datetime.datetime] = Field( default=None, description="""Output only. Timestamp when this Memory Revision was created.""", @@ -8423,6 +8458,10 @@ class MemoryRevision(_common.BaseModel): default=None, description="""Output only. Timestamp of when this resource is considered expired.""", ) + extracted_memories: Optional[list[IntermediateExtractedMemory]] = Field( + default=None, + description="""Output only. The extracted memories from the source content before consolidation when the memory was updated via GenerateMemories. This information was used to modify an existing Memory via Consolidation.""", + ) fact: Optional[str] = Field( default=None, description="""Output only. The fact of the Memory Revision. This corresponds to the `fact` field of the parent Memory at the time of revision creation.""", @@ -8431,32 +8470,32 @@ class MemoryRevision(_common.BaseModel): default=None, description="""Output only. The labels of the Memory Revision. These labels are applied to the MemoryRevision when it is created based on `GenerateMemoriesRequest.revision_labels`.""", ) - extracted_memories: Optional[list[IntermediateExtractedMemory]] = Field( + name: Optional[str] = Field( default=None, - description="""Output only. The extracted memories from the source content before consolidation when the memory was updated via GenerateMemories. This information was used to modify an existing Memory via Consolidation.""", + description="""Identifier. The resource name of the Memory Revision. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{memory_revision}`""", ) class MemoryRevisionDict(TypedDict, total=False): """A memory revision.""" - name: Optional[str] - """Identifier. The resource name of the Memory Revision. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{memory_revision}`""" - create_time: Optional[datetime.datetime] """Output only. Timestamp when this Memory Revision was created.""" expire_time: Optional[datetime.datetime] """Output only. Timestamp of when this resource is considered expired.""" + extracted_memories: Optional[list[IntermediateExtractedMemoryDict]] + """Output only. The extracted memories from the source content before consolidation when the memory was updated via GenerateMemories. This information was used to modify an existing Memory via Consolidation.""" + fact: Optional[str] """Output only. The fact of the Memory Revision. This corresponds to the `fact` field of the parent Memory at the time of revision creation.""" labels: Optional[dict[str, str]] """Output only. The labels of the Memory Revision. These labels are applied to the MemoryRevision when it is created based on `GenerateMemoriesRequest.revision_labels`.""" - extracted_memories: Optional[list[IntermediateExtractedMemoryDict]] - """Output only. The extracted memories from the source content before consolidation when the memory was updated via GenerateMemories. This information was used to modify an existing Memory via Consolidation.""" + name: Optional[str] + """Identifier. The resource name of the Memory Revision. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{memory_revision}`""" MemoryRevisionOrDict = Union[MemoryRevision, MemoryRevisionDict] @@ -9350,36 +9389,37 @@ class _CreateAgentEngineSessionRequestParametersDict(TypedDict, total=False): class Session(_common.BaseModel): """A session.""" - expire_time: Optional[datetime.datetime] = Field( - default=None, - description="""Optional. Timestamp of when this session is considered expired. This is *always* provided on output, regardless of what was sent on input.""", - ) - ttl: Optional[str] = Field( - default=None, description="""Optional. Input only. The TTL for this session.""" - ) - name: Optional[str] = Field( - default=None, - description="""Identifier. The resource name of the session. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}'.""", - ) create_time: Optional[datetime.datetime] = Field( default=None, description="""Output only. Timestamp when the session was created.""", ) - update_time: Optional[datetime.datetime] = Field( - default=None, - description="""Output only. Timestamp when the session was updated.""", - ) display_name: Optional[str] = Field( default=None, description="""Optional. The display name of the session.""" ) + expire_time: Optional[datetime.datetime] = Field( + default=None, + description="""Optional. Timestamp of when this session is considered expired. This is *always* provided on output, regardless of what was sent on input. The minimum value is 24 hours from the time of creation.""", + ) labels: Optional[dict[str, str]] = Field( default=None, description="""The labels with user-defined metadata to organize your Sessions. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels.""", ) + name: Optional[str] = Field( + default=None, + description="""Identifier. The resource name of the session. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}'.""", + ) session_state: Optional[dict[str, Any]] = Field( default=None, description="""Optional. Session specific memory which stores key conversation points.""", ) + ttl: Optional[str] = Field( + default=None, + description="""Optional. Input only. The TTL for this session. The minimum value is 24 hours.""", + ) + update_time: Optional[datetime.datetime] = Field( + default=None, + description="""Output only. Timestamp when the session was updated.""", + ) user_id: Optional[str] = Field( default=None, description="""Required. Immutable. String id provided by the user""", @@ -9389,30 +9429,30 @@ class Session(_common.BaseModel): class SessionDict(TypedDict, total=False): """A session.""" - expire_time: Optional[datetime.datetime] - """Optional. Timestamp of when this session is considered expired. This is *always* provided on output, regardless of what was sent on input.""" - - ttl: Optional[str] - """Optional. Input only. The TTL for this session.""" - - name: Optional[str] - """Identifier. The resource name of the session. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}'.""" - create_time: Optional[datetime.datetime] """Output only. Timestamp when the session was created.""" - update_time: Optional[datetime.datetime] - """Output only. Timestamp when the session was updated.""" - display_name: Optional[str] """Optional. The display name of the session.""" + expire_time: Optional[datetime.datetime] + """Optional. Timestamp of when this session is considered expired. This is *always* provided on output, regardless of what was sent on input. The minimum value is 24 hours from the time of creation.""" + labels: Optional[dict[str, str]] """The labels with user-defined metadata to organize your Sessions. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels.""" + name: Optional[str] + """Identifier. The resource name of the session. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}'.""" + session_state: Optional[dict[str, Any]] """Optional. Session specific memory which stores key conversation points.""" + ttl: Optional[str] + """Optional. Input only. The TTL for this session. The minimum value is 24 hours.""" + + update_time: Optional[datetime.datetime] + """Output only. Timestamp when the session was updated.""" + user_id: Optional[str] """Required. Immutable. String id provided by the user""" @@ -11233,6 +11273,79 @@ class SchemaPromptSpecMultimodalPromptDict(TypedDict, total=False): ] +class SchemaPromptSpecAppBuilderDataLinkedResource(_common.BaseModel): + """A linked resource attached to the application by the user.""" + + display_name: Optional[str] = Field( + default=None, + description="""A user-friendly name for the data source shown in the UI.""", + ) + name: Optional[str] = Field( + default=None, + description="""The unique resource name of the data source. The format is determined by the 'type' field. For type "SAVED_PROMPT": projects/{project}/locations/{location}/datasets/{dataset} For type "AI_AGENT": projects/{project}/locations/{location}/agents/{agent}""", + ) + type: Optional[str] = Field( + default=None, + description="""The type of the linked resource. e.g., "SAVED_PROMPT", "AI_AGENT" This string corresponds to the name of the LinkedResourceType enum member. See: google3/cloud/console/web/ai/platform/llm/prompts/build/services/specs_repository_service/linked_resources/linked_resource.ts""", + ) + + +class SchemaPromptSpecAppBuilderDataLinkedResourceDict(TypedDict, total=False): + """A linked resource attached to the application by the user.""" + + display_name: Optional[str] + """A user-friendly name for the data source shown in the UI.""" + + name: Optional[str] + """The unique resource name of the data source. The format is determined by the 'type' field. For type "SAVED_PROMPT": projects/{project}/locations/{location}/datasets/{dataset} For type "AI_AGENT": projects/{project}/locations/{location}/agents/{agent}""" + + type: Optional[str] + """The type of the linked resource. e.g., "SAVED_PROMPT", "AI_AGENT" This string corresponds to the name of the LinkedResourceType enum member. See: google3/cloud/console/web/ai/platform/llm/prompts/build/services/specs_repository_service/linked_resources/linked_resource.ts""" + + +SchemaPromptSpecAppBuilderDataLinkedResourceOrDict = Union[ + SchemaPromptSpecAppBuilderDataLinkedResource, + SchemaPromptSpecAppBuilderDataLinkedResourceDict, +] + + +class SchemaPromptSpecAppBuilderData(_common.BaseModel): + """Defines data for an application builder.""" + + code_repository_state: Optional[str] = Field( + default=None, + description="""Serialized state of the code repository. This string will typically contain a JSON representation of the UI's CodeRepositoryService state (files, folders, content, and any metadata). The UI is responsible for serialization and deserialization.""", + ) + framework: Optional[Framework] = Field( + default=None, + description="""Optional. Framework used to build the application.""", + ) + linked_resources: Optional[list[SchemaPromptSpecAppBuilderDataLinkedResource]] = ( + Field( + default=None, + description="""Linked resources attached to the application by the user.""", + ) + ) + + +class SchemaPromptSpecAppBuilderDataDict(TypedDict, total=False): + """Defines data for an application builder.""" + + code_repository_state: Optional[str] + """Serialized state of the code repository. This string will typically contain a JSON representation of the UI's CodeRepositoryService state (files, folders, content, and any metadata). The UI is responsible for serialization and deserialization.""" + + framework: Optional[Framework] + """Optional. Framework used to build the application.""" + + linked_resources: Optional[list[SchemaPromptSpecAppBuilderDataLinkedResourceDict]] + """Linked resources attached to the application by the user.""" + + +SchemaPromptSpecAppBuilderDataOrDict = Union[ + SchemaPromptSpecAppBuilderData, SchemaPromptSpecAppBuilderDataDict +] + + class SchemaPromptSpecPartList(_common.BaseModel): """Represents a prompt spec part list.""" @@ -11259,6 +11372,9 @@ class SchemaPromptSpecStructuredPrompt(_common.BaseModel): context: Optional[genai_types.Content] = Field( default=None, description="""Preamble: The context of the prompt.""" ) + app_builder_data: Optional[SchemaPromptSpecAppBuilderData] = Field( + default=None, description="""Data for app builder use case.""" + ) examples: Optional[list[SchemaPromptSpecPartList]] = Field( default=None, description="""Preamble: A set of examples for expected model response.""", @@ -11294,6 +11410,9 @@ class SchemaPromptSpecStructuredPromptDict(TypedDict, total=False): context: Optional[genai_types.ContentDict] """Preamble: The context of the prompt.""" + app_builder_data: Optional[SchemaPromptSpecAppBuilderDataDict] + """Data for app builder use case.""" + examples: Optional[list[SchemaPromptSpecPartListDict]] """Preamble: A set of examples for expected model response."""