diff --git a/google/cloud/aiplatform_v1/__init__.py b/google/cloud/aiplatform_v1/__init__.py index 033063ce65..25d488a51a 100644 --- a/google/cloud/aiplatform_v1/__init__.py +++ b/google/cloud/aiplatform_v1/__init__.py @@ -101,6 +101,7 @@ from .types.content import GroundingChunk from .types.content import GroundingMetadata from .types.content import GroundingSupport +from .types.content import LogprobsResult from .types.content import Part from .types.content import SafetyRating from .types.content import SafetySetting @@ -1423,6 +1424,7 @@ "ListTuningJobsRequest", "ListTuningJobsResponse", "LlmUtilityServiceClient", + "LogprobsResult", "LookupStudyRequest", "MachineSpec", "ManualBatchTuningParameters", diff --git a/google/cloud/aiplatform_v1/types/__init__.py b/google/cloud/aiplatform_v1/types/__init__.py index 7dd320b3ae..1b0b07ba17 100644 --- a/google/cloud/aiplatform_v1/types/__init__.py +++ b/google/cloud/aiplatform_v1/types/__init__.py @@ -42,6 +42,7 @@ GroundingChunk, GroundingMetadata, GroundingSupport, + LogprobsResult, Part, SafetyRating, SafetySetting, @@ -1060,6 +1061,7 @@ "GroundingChunk", "GroundingMetadata", "GroundingSupport", + "LogprobsResult", "Part", "SafetyRating", "SafetySetting", diff --git a/google/cloud/aiplatform_v1/types/content.py b/google/cloud/aiplatform_v1/types/content.py index a4f481577e..8045aaf393 100644 --- a/google/cloud/aiplatform_v1/types/content.py +++ b/google/cloud/aiplatform_v1/types/content.py @@ -40,6 +40,7 @@ "CitationMetadata", "Citation", "Candidate", + "LogprobsResult", "Segment", "GroundingChunk", "GroundingSupport", @@ -64,12 +65,15 @@ class HarmCategory(proto.Enum): HARM_CATEGORY_SEXUALLY_EXPLICIT (4): The harm category is sexually explicit content. + HARM_CATEGORY_CIVIC_INTEGRITY (5): + The harm category is civic integrity. """ HARM_CATEGORY_UNSPECIFIED = 0 HARM_CATEGORY_HATE_SPEECH = 1 HARM_CATEGORY_DANGEROUS_CONTENT = 2 HARM_CATEGORY_HARASSMENT = 3 HARM_CATEGORY_SEXUALLY_EXPLICIT = 4 + HARM_CATEGORY_CIVIC_INTEGRITY = 5 class Content(proto.Message): @@ -294,6 +298,15 @@ class GenerationConfig(proto.Message): This field is a member of `oneof`_ ``_max_output_tokens``. stop_sequences (MutableSequence[str]): Optional. Stop sequences. + response_logprobs (bool): + Optional. If true, export the logprobs + results in response. + + This field is a member of `oneof`_ ``_response_logprobs``. + logprobs (int): + Optional. Logit probabilities. + + This field is a member of `oneof`_ ``_logprobs``. presence_penalty (float): Optional. Positive penalties. @@ -457,6 +470,16 @@ class ManualRoutingMode(proto.Message): proto.STRING, number=6, ) + response_logprobs: bool = proto.Field( + proto.BOOL, + number=18, + optional=True, + ) + logprobs: int = proto.Field( + proto.INT32, + number=7, + optional=True, + ) presence_penalty: float = proto.Field( proto.FLOAT, number=8, @@ -734,6 +757,9 @@ class Candidate(proto.Message): avg_logprobs (float): Output only. Average log probability score of the candidate. + logprobs_result (google.cloud.aiplatform_v1.types.LogprobsResult): + Output only. Log-likelihood scores for the + response tokens and top tokens finish_reason (google.cloud.aiplatform_v1.types.Candidate.FinishReason): Output only. The reason why the model stopped generating tokens. If empty, the model has not @@ -822,6 +848,11 @@ class FinishReason(proto.Enum): proto.DOUBLE, number=9, ) + logprobs_result: "LogprobsResult" = proto.Field( + proto.MESSAGE, + number=10, + message="LogprobsResult", + ) finish_reason: FinishReason = proto.Field( proto.ENUM, number=3, @@ -849,6 +880,80 @@ class FinishReason(proto.Enum): ) +class LogprobsResult(proto.Message): + r"""Logprobs Result + + Attributes: + top_candidates (MutableSequence[google.cloud.aiplatform_v1.types.LogprobsResult.TopCandidates]): + Length = total number of decoding steps. + chosen_candidates (MutableSequence[google.cloud.aiplatform_v1.types.LogprobsResult.Candidate]): + Length = total number of decoding steps. The chosen + candidates may or may not be in top_candidates. + """ + + class Candidate(proto.Message): + r"""Candidate for the logprobs token and score. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + token (str): + The candidate’s token string value. + + This field is a member of `oneof`_ ``_token``. + token_id (int): + The candidate’s token id value. + + This field is a member of `oneof`_ ``_token_id``. + log_probability (float): + The candidate's log probability. + + This field is a member of `oneof`_ ``_log_probability``. + """ + + token: str = proto.Field( + proto.STRING, + number=1, + optional=True, + ) + token_id: int = proto.Field( + proto.INT32, + number=3, + optional=True, + ) + log_probability: float = proto.Field( + proto.FLOAT, + number=2, + optional=True, + ) + + class TopCandidates(proto.Message): + r"""Candidates with top log probabilities at each decoding step. + + Attributes: + candidates (MutableSequence[google.cloud.aiplatform_v1.types.LogprobsResult.Candidate]): + Sorted by log probability in descending + order. + """ + + candidates: MutableSequence["LogprobsResult.Candidate"] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="LogprobsResult.Candidate", + ) + + top_candidates: MutableSequence[TopCandidates] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=TopCandidates, + ) + chosen_candidates: MutableSequence[Candidate] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=Candidate, + ) + + class Segment(proto.Message): r"""Segment of the content. diff --git a/google/cloud/aiplatform_v1/types/openapi.py b/google/cloud/aiplatform_v1/types/openapi.py index a8a018c982..4372670391 100644 --- a/google/cloud/aiplatform_v1/types/openapi.py +++ b/google/cloud/aiplatform_v1/types/openapi.py @@ -131,6 +131,10 @@ class Schema(proto.Message): example (google.protobuf.struct_pb2.Value): Optional. Example of the object. Will only populated when the object is the root. + any_of (MutableSequence[google.cloud.aiplatform_v1.types.Schema]): + Optional. The value should be validated + against any (one or more) of the subschemas in + the list. """ type_: "Type" = proto.Field( @@ -223,6 +227,11 @@ class Schema(proto.Message): number=4, message=struct_pb2.Value, ) + any_of: MutableSequence["Schema"] = proto.RepeatedField( + proto.MESSAGE, + number=11, + message="Schema", + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/aiplatform_v1/types/prediction_service.py b/google/cloud/aiplatform_v1/types/prediction_service.py index fb4de9f4c0..d57e4de92e 100644 --- a/google/cloud/aiplatform_v1/types/prediction_service.py +++ b/google/cloud/aiplatform_v1/types/prediction_service.py @@ -709,6 +709,11 @@ class CountTokensRequest(proto.Message): A ``Tool`` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model. + generation_config (google.cloud.aiplatform_v1.types.GenerationConfig): + Optional. Generation config that the model + will use to generate the response. + + This field is a member of `oneof`_ ``_generation_config``. """ endpoint: str = proto.Field( @@ -740,6 +745,12 @@ class CountTokensRequest(proto.Message): number=6, message=tool.Tool, ) + generation_config: content.GenerationConfig = proto.Field( + proto.MESSAGE, + number=7, + optional=True, + message=content.GenerationConfig, + ) class CountTokensResponse(proto.Message): @@ -803,6 +814,17 @@ class GenerateContentRequest(proto.Message): tool_config (google.cloud.aiplatform_v1.types.ToolConfig): Optional. Tool config. This config is shared for all tools provided in the request. + labels (MutableMapping[str, str]): + Optional. The labels with user-defined + metadata for the request. It is used for billing + and reporting only. + + Label keys and values can be no longer than 63 + characters (Unicode codepoints) and can only + contain lowercase letters, numeric characters, + underscores, and dashes. International + characters are allowed. Label values are + optional. Label keys must start with a letter. safety_settings (MutableSequence[google.cloud.aiplatform_v1.types.SafetySetting]): Optional. Per request settings for blocking unsafe content. Enforced on @@ -836,6 +858,11 @@ class GenerateContentRequest(proto.Message): number=7, message=tool.ToolConfig, ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=10, + ) safety_settings: MutableSequence[content.SafetySetting] = proto.RepeatedField( proto.MESSAGE, number=3, @@ -854,6 +881,9 @@ class GenerateContentResponse(proto.Message): Attributes: candidates (MutableSequence[google.cloud.aiplatform_v1.types.Candidate]): Output only. Generated candidates. + model_version (str): + Output only. The model version used to + generate the response. prompt_feedback (google.cloud.aiplatform_v1.types.GenerateContentResponse.PromptFeedback): Output only. Content filter results for a prompt sent in the request. Note: Sent only in @@ -926,7 +956,8 @@ class UsageMetadata(proto.Message): candidates_token_count (int): Number of tokens in the response(s). total_token_count (int): - + Total token count for prompt and response + candidates. """ prompt_token_count: int = proto.Field( @@ -947,6 +978,10 @@ class UsageMetadata(proto.Message): number=2, message=content.Candidate, ) + model_version: str = proto.Field( + proto.STRING, + number=11, + ) prompt_feedback: PromptFeedback = proto.Field( proto.MESSAGE, number=3, diff --git a/google/cloud/aiplatform_v1beta1/__init__.py b/google/cloud/aiplatform_v1beta1/__init__.py index 1ee81a1e9b..1a05a7867d 100644 --- a/google/cloud/aiplatform_v1beta1/__init__.py +++ b/google/cloud/aiplatform_v1beta1/__init__.py @@ -123,6 +123,7 @@ from .types.content import GroundingChunk from .types.content import GroundingMetadata from .types.content import GroundingSupport +from .types.content import LogprobsResult from .types.content import Part from .types.content import SafetyRating from .types.content import SafetySetting @@ -822,6 +823,7 @@ from .types.pipeline_job import PipelineJobDetail from .types.pipeline_job import PipelineTaskDetail from .types.pipeline_job import PipelineTaskExecutorDetail +from .types.pipeline_job import PipelineTaskRerunConfig from .types.pipeline_job import PipelineTemplateMetadata from .types.pipeline_service import BatchCancelPipelineJobsOperationMetadata from .types.pipeline_service import BatchCancelPipelineJobsRequest @@ -893,6 +895,7 @@ from .types.schedule_service import UpdateScheduleRequest from .types.service_networking import PrivateServiceConnectConfig from .types.service_networking import PscAutomatedEndpoints +from .types.service_networking import PSCAutomationConfig from .types.service_networking import PscInterfaceConfig from .types.specialist_pool import SpecialistPool from .types.specialist_pool_service import CreateSpecialistPoolOperationMetadata @@ -1000,6 +1003,8 @@ from .types.types import Int64Array from .types.types import StringArray from .types.types import Tensor +from .types.ui_pipeline_spec import ArtifactTypeSchema +from .types.ui_pipeline_spec import RuntimeArtifact from .types.unmanaged_container_model import UnmanagedContainerModel from .types.user_action_reference import UserActionReference from .types.value import Value @@ -1106,6 +1111,7 @@ "AnnotationSpec", "ApiAuth", "Artifact", + "ArtifactTypeSchema", "AssignNotebookRuntimeOperationMetadata", "AssignNotebookRuntimeRequest", "Attribution", @@ -1644,6 +1650,7 @@ "ListTuningJobsRequest", "ListTuningJobsResponse", "LlmUtilityServiceClient", + "LogprobsResult", "LookupStudyRequest", "MachineSpec", "ManualBatchTuningParameters", @@ -1717,6 +1724,7 @@ "NotebookRuntimeTemplateRef", "NotebookRuntimeType", "NotebookServiceClient", + "PSCAutomationConfig", "PairwiseChoice", "PairwiseMetricInput", "PairwiseMetricInstance", @@ -1743,6 +1751,7 @@ "PipelineState", "PipelineTaskDetail", "PipelineTaskExecutorDetail", + "PipelineTaskRerunConfig", "PipelineTemplateMetadata", "PointwiseMetricInput", "PointwiseMetricInstance", @@ -1851,6 +1860,7 @@ "RougeMetricValue", "RougeResults", "RougeSpec", + "RuntimeArtifact", "RuntimeConfig", "SafetyInput", "SafetyInstance", diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py index ba3323f393..0e54d13c2c 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py @@ -1752,10 +1752,15 @@ async def sample_generate_content(): request (Optional[Union[google.cloud.aiplatform_v1beta1.types.GenerateContentRequest, dict]]): The request object. Request message for [PredictionService.GenerateContent]. model (:class:`str`): - Required. The name of the publisher model requested to - serve the prediction. Format: + Required. The fully qualified name of the publisher + model or tuned model endpoint to use. + + Publisher model format: ``projects/{project}/locations/{location}/publishers/*/models/*`` + Tuned model endpoint format: + ``projects/{project}/locations/{location}/endpoints/{endpoint}`` + This corresponds to the ``model`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1880,10 +1885,15 @@ async def sample_stream_generate_content(): request (Optional[Union[google.cloud.aiplatform_v1beta1.types.GenerateContentRequest, dict]]): The request object. Request message for [PredictionService.GenerateContent]. model (:class:`str`): - Required. The name of the publisher model requested to - serve the prediction. Format: + Required. The fully qualified name of the publisher + model or tuned model endpoint to use. + + Publisher model format: ``projects/{project}/locations/{location}/publishers/*/models/*`` + Tuned model endpoint format: + ``projects/{project}/locations/{location}/endpoints/{endpoint}`` + This corresponds to the ``model`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2004,9 +2014,9 @@ async def sample_chat_completions(): request (Optional[Union[google.cloud.aiplatform_v1beta1.types.ChatCompletionsRequest, dict]]): The request object. Request message for [PredictionService.ChatCompletions] endpoint (:class:`str`): - Required. The name of the Endpoint requested to serve + Required. The name of the endpoint requested to serve the prediction. Format: - ``projects/{project}/locations/{location}/endpoints/openapi`` + ``projects/{project}/locations/{location}/endpoints/{endpoint}`` This corresponds to the ``endpoint`` field on the ``request`` instance; if ``request`` is provided, this diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py index 3abcecebef..a7f2b7fcdb 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py @@ -2207,10 +2207,15 @@ def sample_generate_content(): request (Union[google.cloud.aiplatform_v1beta1.types.GenerateContentRequest, dict]): The request object. Request message for [PredictionService.GenerateContent]. model (str): - Required. The name of the publisher model requested to - serve the prediction. Format: + Required. The fully qualified name of the publisher + model or tuned model endpoint to use. + + Publisher model format: ``projects/{project}/locations/{location}/publishers/*/models/*`` + Tuned model endpoint format: + ``projects/{project}/locations/{location}/endpoints/{endpoint}`` + This corresponds to the ``model`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2332,10 +2337,15 @@ def sample_stream_generate_content(): request (Union[google.cloud.aiplatform_v1beta1.types.GenerateContentRequest, dict]): The request object. Request message for [PredictionService.GenerateContent]. model (str): - Required. The name of the publisher model requested to - serve the prediction. Format: + Required. The fully qualified name of the publisher + model or tuned model endpoint to use. + + Publisher model format: ``projects/{project}/locations/{location}/publishers/*/models/*`` + Tuned model endpoint format: + ``projects/{project}/locations/{location}/endpoints/{endpoint}`` + This corresponds to the ``model`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2453,9 +2463,9 @@ def sample_chat_completions(): request (Union[google.cloud.aiplatform_v1beta1.types.ChatCompletionsRequest, dict]): The request object. Request message for [PredictionService.ChatCompletions] endpoint (str): - Required. The name of the Endpoint requested to serve + Required. The name of the endpoint requested to serve the prediction. Format: - ``projects/{project}/locations/{location}/endpoints/openapi`` + ``projects/{project}/locations/{location}/endpoints/{endpoint}`` This corresponds to the ``endpoint`` field on the ``request`` instance; if ``request`` is provided, this diff --git a/google/cloud/aiplatform_v1beta1/types/__init__.py b/google/cloud/aiplatform_v1beta1/types/__init__.py index 92b8a80bb4..08ce598d35 100644 --- a/google/cloud/aiplatform_v1beta1/types/__init__.py +++ b/google/cloud/aiplatform_v1beta1/types/__init__.py @@ -48,6 +48,7 @@ GroundingChunk, GroundingMetadata, GroundingSupport, + LogprobsResult, Part, SafetyRating, SafetySetting, @@ -903,6 +904,7 @@ PipelineJobDetail, PipelineTaskDetail, PipelineTaskExecutorDetail, + PipelineTaskRerunConfig, PipelineTemplateMetadata, ) from .pipeline_service import ( @@ -998,6 +1000,7 @@ from .service_networking import ( PrivateServiceConnectConfig, PscAutomatedEndpoints, + PSCAutomationConfig, PscInterfaceConfig, ) from .specialist_pool import ( @@ -1132,6 +1135,10 @@ StringArray, Tensor, ) +from .ui_pipeline_spec import ( + ArtifactTypeSchema, + RuntimeArtifact, +) from .unmanaged_container_model import ( UnmanagedContainerModel, ) @@ -1222,6 +1229,7 @@ "GroundingChunk", "GroundingMetadata", "GroundingSupport", + "LogprobsResult", "Part", "SafetyRating", "SafetySetting", @@ -1905,6 +1913,7 @@ "PipelineJobDetail", "PipelineTaskDetail", "PipelineTaskExecutorDetail", + "PipelineTaskRerunConfig", "PipelineTemplateMetadata", "BatchCancelPipelineJobsOperationMetadata", "BatchCancelPipelineJobsRequest", @@ -1976,6 +1985,7 @@ "UpdateScheduleRequest", "PrivateServiceConnectConfig", "PscAutomatedEndpoints", + "PSCAutomationConfig", "PscInterfaceConfig", "SpecialistPool", "CreateSpecialistPoolOperationMetadata", @@ -2083,6 +2093,8 @@ "Int64Array", "StringArray", "Tensor", + "ArtifactTypeSchema", + "RuntimeArtifact", "UnmanagedContainerModel", "UserActionReference", "Value", diff --git a/google/cloud/aiplatform_v1beta1/types/content.py b/google/cloud/aiplatform_v1beta1/types/content.py index b6cb876fd0..3f6b68aee5 100644 --- a/google/cloud/aiplatform_v1beta1/types/content.py +++ b/google/cloud/aiplatform_v1beta1/types/content.py @@ -40,6 +40,7 @@ "CitationMetadata", "Citation", "Candidate", + "LogprobsResult", "Segment", "GroundingChunk", "GroundingSupport", @@ -64,12 +65,15 @@ class HarmCategory(proto.Enum): HARM_CATEGORY_SEXUALLY_EXPLICIT (4): The harm category is sexually explicit content. + HARM_CATEGORY_CIVIC_INTEGRITY (5): + The harm category is civic integrity. """ HARM_CATEGORY_UNSPECIFIED = 0 HARM_CATEGORY_HATE_SPEECH = 1 HARM_CATEGORY_DANGEROUS_CONTENT = 2 HARM_CATEGORY_HARASSMENT = 3 HARM_CATEGORY_SEXUALLY_EXPLICIT = 4 + HARM_CATEGORY_CIVIC_INTEGRITY = 5 class Content(proto.Message): @@ -294,6 +298,15 @@ class GenerationConfig(proto.Message): This field is a member of `oneof`_ ``_max_output_tokens``. stop_sequences (MutableSequence[str]): Optional. Stop sequences. + response_logprobs (bool): + Optional. If true, export the logprobs + results in response. + + This field is a member of `oneof`_ ``_response_logprobs``. + logprobs (int): + Optional. Logit probabilities. + + This field is a member of `oneof`_ ``_logprobs``. presence_penalty (float): Optional. Positive penalties. @@ -457,6 +470,16 @@ class ManualRoutingMode(proto.Message): proto.STRING, number=6, ) + response_logprobs: bool = proto.Field( + proto.BOOL, + number=18, + optional=True, + ) + logprobs: int = proto.Field( + proto.INT32, + number=7, + optional=True, + ) presence_penalty: float = proto.Field( proto.FLOAT, number=8, @@ -731,6 +754,9 @@ class Candidate(proto.Message): avg_logprobs (float): Output only. Average log probability score of the candidate. + logprobs_result (google.cloud.aiplatform_v1beta1.types.LogprobsResult): + Output only. Log-likelihood scores for the + response tokens and top tokens finish_reason (google.cloud.aiplatform_v1beta1.types.Candidate.FinishReason): Output only. The reason why the model stopped generating tokens. If empty, the model has not @@ -815,6 +841,11 @@ class FinishReason(proto.Enum): proto.DOUBLE, number=9, ) + logprobs_result: "LogprobsResult" = proto.Field( + proto.MESSAGE, + number=10, + message="LogprobsResult", + ) finish_reason: FinishReason = proto.Field( proto.ENUM, number=3, @@ -842,6 +873,80 @@ class FinishReason(proto.Enum): ) +class LogprobsResult(proto.Message): + r"""Logprobs Result + + Attributes: + top_candidates (MutableSequence[google.cloud.aiplatform_v1beta1.types.LogprobsResult.TopCandidates]): + Length = total number of decoding steps. + chosen_candidates (MutableSequence[google.cloud.aiplatform_v1beta1.types.LogprobsResult.Candidate]): + Length = total number of decoding steps. The chosen + candidates may or may not be in top_candidates. + """ + + class Candidate(proto.Message): + r"""Candidate for the logprobs token and score. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + token (str): + The candidate’s token string value. + + This field is a member of `oneof`_ ``_token``. + token_id (int): + The candidate’s token id value. + + This field is a member of `oneof`_ ``_token_id``. + log_probability (float): + The candidate's log probability. + + This field is a member of `oneof`_ ``_log_probability``. + """ + + token: str = proto.Field( + proto.STRING, + number=1, + optional=True, + ) + token_id: int = proto.Field( + proto.INT32, + number=3, + optional=True, + ) + log_probability: float = proto.Field( + proto.FLOAT, + number=2, + optional=True, + ) + + class TopCandidates(proto.Message): + r"""Candidates with top log probabilities at each decoding step. + + Attributes: + candidates (MutableSequence[google.cloud.aiplatform_v1beta1.types.LogprobsResult.Candidate]): + Sorted by log probability in descending + order. + """ + + candidates: MutableSequence["LogprobsResult.Candidate"] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="LogprobsResult.Candidate", + ) + + top_candidates: MutableSequence[TopCandidates] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=TopCandidates, + ) + chosen_candidates: MutableSequence[Candidate] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=Candidate, + ) + + class Segment(proto.Message): r"""Segment of the content. diff --git a/google/cloud/aiplatform_v1beta1/types/index_endpoint.py b/google/cloud/aiplatform_v1beta1/types/index_endpoint.py index ebed5dd179..89d91a6789 100644 --- a/google/cloud/aiplatform_v1beta1/types/index_endpoint.py +++ b/google/cloud/aiplatform_v1beta1/types/index_endpoint.py @@ -327,6 +327,11 @@ class DeployedIndex(proto.Message): Note: we only support up to 5 deployment groups(not including 'default'). + psc_automation_configs (MutableSequence[google.cloud.aiplatform_v1beta1.types.PSCAutomationConfig]): + Optional. If set for PSC deployed index, PSC connection will + be automatically created after deployment is done and the + endpoint information is populated in + private_endpoints.psc_automated_endpoints. """ id: str = proto.Field( @@ -383,6 +388,13 @@ class DeployedIndex(proto.Message): proto.STRING, number=11, ) + psc_automation_configs: MutableSequence[ + service_networking.PSCAutomationConfig + ] = proto.RepeatedField( + proto.MESSAGE, + number=19, + message=service_networking.PSCAutomationConfig, + ) class DeployedIndexAuthConfig(proto.Message): diff --git a/google/cloud/aiplatform_v1beta1/types/openapi.py b/google/cloud/aiplatform_v1beta1/types/openapi.py index 51b6ef9787..ca9b47319f 100644 --- a/google/cloud/aiplatform_v1beta1/types/openapi.py +++ b/google/cloud/aiplatform_v1beta1/types/openapi.py @@ -131,6 +131,10 @@ class Schema(proto.Message): example (google.protobuf.struct_pb2.Value): Optional. Example of the object. Will only populated when the object is the root. + any_of (MutableSequence[google.cloud.aiplatform_v1beta1.types.Schema]): + Optional. The value should be validated + against any (one or more) of the subschemas in + the list. """ type_: "Type" = proto.Field( @@ -223,6 +227,11 @@ class Schema(proto.Message): number=4, message=struct_pb2.Value, ) + any_of: MutableSequence["Schema"] = proto.RepeatedField( + proto.MESSAGE, + number=11, + message="Schema", + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/aiplatform_v1beta1/types/pipeline_job.py b/google/cloud/aiplatform_v1beta1/types/pipeline_job.py index a39e9bdd88..11e4a45bd6 100644 --- a/google/cloud/aiplatform_v1beta1/types/pipeline_job.py +++ b/google/cloud/aiplatform_v1beta1/types/pipeline_job.py @@ -25,6 +25,7 @@ from google.cloud.aiplatform_v1beta1.types import execution as gca_execution from google.cloud.aiplatform_v1beta1.types import pipeline_failure_policy from google.cloud.aiplatform_v1beta1.types import pipeline_state +from google.cloud.aiplatform_v1beta1.types import ui_pipeline_spec from google.cloud.aiplatform_v1beta1.types import value as gca_value from google.protobuf import struct_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore @@ -39,6 +40,7 @@ "PipelineJobDetail", "PipelineTaskDetail", "PipelineTaskExecutorDetail", + "PipelineTaskRerunConfig", }, ) @@ -154,6 +156,24 @@ class PipelineJob(proto.Message): Output only. Reserved for future use. satisfies_pzi (bool): Output only. Reserved for future use. + original_pipeline_job_id (int): + Output only. The original pipeline job id if + this pipeline job is a rerun of a previous + pipeline job. + pipeline_task_rerun_configs (MutableSequence[google.cloud.aiplatform_v1beta1.types.PipelineTaskRerunConfig]): + Output only. The rerun configs for each task + in the pipeline job. By default, the rerun will: + + 1. Use the same input artifacts as the original + run. + 2. Use the same input parameters as the original + run. + 3. Skip all the tasks that are already succeeded + in the original run. + 4. Rerun all the tasks that are not succeeded in + the original run. By providing this field, + users can override the default behavior and + specify the rerun config for each task. """ class RuntimeConfig(proto.Message): @@ -355,6 +375,17 @@ class InputArtifact(proto.Message): proto.BOOL, number=28, ) + original_pipeline_job_id: int = proto.Field( + proto.INT64, + number=29, + ) + pipeline_task_rerun_configs: MutableSequence[ + "PipelineTaskRerunConfig" + ] = proto.RepeatedField( + proto.MESSAGE, + number=30, + message="PipelineTaskRerunConfig", + ) class PipelineTemplateMetadata(proto.Message): @@ -717,4 +748,91 @@ class CustomJobDetail(proto.Message): ) +class PipelineTaskRerunConfig(proto.Message): + r"""User provided rerun config to submit a rerun pipelinejob. + This includes + 1. Which task to rerun + 2. User override input parameters and artifacts. + + Attributes: + task_id (int): + Output only. The system generated ID of the + task. Retrieved from original run. + task_name (str): + Output only. The name of the task. + inputs (google.cloud.aiplatform_v1beta1.types.PipelineTaskRerunConfig.Inputs): + Output only. The runtime input of the task + overridden by the user. + skip_task (bool): + Output only. Whether to skip this task. + Default value is False. + skip_downstream_tasks (bool): + Output only. Whether to skip downstream + tasks. Default value is False. + """ + + class ArtifactList(proto.Message): + r"""A list of artifact metadata. + + Attributes: + artifacts (MutableSequence[google.cloud.aiplatform_v1beta1.types.RuntimeArtifact]): + Output only. A list of artifact metadata. + """ + + artifacts: MutableSequence[ + ui_pipeline_spec.RuntimeArtifact + ] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=ui_pipeline_spec.RuntimeArtifact, + ) + + class Inputs(proto.Message): + r"""Runtime inputs data of the task. + + Attributes: + artifacts (MutableMapping[str, google.cloud.aiplatform_v1beta1.types.PipelineTaskRerunConfig.ArtifactList]): + Output only. Input artifacts. + parameter_values (MutableMapping[str, google.protobuf.struct_pb2.Value]): + Output only. Input parameters. + """ + + artifacts: MutableMapping[ + str, "PipelineTaskRerunConfig.ArtifactList" + ] = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=1, + message="PipelineTaskRerunConfig.ArtifactList", + ) + parameter_values: MutableMapping[str, struct_pb2.Value] = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=2, + message=struct_pb2.Value, + ) + + task_id: int = proto.Field( + proto.INT64, + number=1, + ) + task_name: str = proto.Field( + proto.STRING, + number=2, + ) + inputs: Inputs = proto.Field( + proto.MESSAGE, + number=3, + message=Inputs, + ) + skip_task: bool = proto.Field( + proto.BOOL, + number=4, + ) + skip_downstream_tasks: bool = proto.Field( + proto.BOOL, + number=5, + ) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/aiplatform_v1beta1/types/prediction_service.py b/google/cloud/aiplatform_v1beta1/types/prediction_service.py index 8aa2e75ecd..b90ae91873 100644 --- a/google/cloud/aiplatform_v1beta1/types/prediction_service.py +++ b/google/cloud/aiplatform_v1beta1/types/prediction_service.py @@ -765,6 +765,11 @@ class CountTokensRequest(proto.Message): A ``Tool`` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model. + generation_config (google.cloud.aiplatform_v1beta1.types.GenerationConfig): + Optional. Generation config that the model + will use to generate the response. + + This field is a member of `oneof`_ ``_generation_config``. """ endpoint: str = proto.Field( @@ -796,6 +801,12 @@ class CountTokensRequest(proto.Message): number=6, message=tool.Tool, ) + generation_config: content.GenerationConfig = proto.Field( + proto.MESSAGE, + number=7, + optional=True, + message=content.GenerationConfig, + ) class CountTokensResponse(proto.Message): @@ -828,9 +839,14 @@ class GenerateContentRequest(proto.Message): Attributes: model (str): - Required. The name of the publisher model requested to serve - the prediction. Format: + Required. The fully qualified name of the publisher model or + tuned model endpoint to use. + + Publisher model format: ``projects/{project}/locations/{location}/publishers/*/models/*`` + + Tuned model endpoint format: + ``projects/{project}/locations/{location}/endpoints/{endpoint}`` contents (MutableSequence[google.cloud.aiplatform_v1beta1.types.Content]): Required. The content of the current conversation with the model. @@ -861,6 +877,17 @@ class GenerateContentRequest(proto.Message): tool_config (google.cloud.aiplatform_v1beta1.types.ToolConfig): Optional. Tool config. This config is shared for all tools provided in the request. + labels (MutableMapping[str, str]): + Optional. The labels with user-defined + metadata for the request. It is used for billing + and reporting only. + + Label keys and values can be no longer than 63 + characters (Unicode codepoints) and can only + contain lowercase letters, numeric characters, + underscores, and dashes. International + characters are allowed. Label values are + optional. Label keys must start with a letter. safety_settings (MutableSequence[google.cloud.aiplatform_v1beta1.types.SafetySetting]): Optional. Per request settings for blocking unsafe content. Enforced on @@ -898,6 +925,11 @@ class GenerateContentRequest(proto.Message): number=7, message=tool.ToolConfig, ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=10, + ) safety_settings: MutableSequence[content.SafetySetting] = proto.RepeatedField( proto.MESSAGE, number=3, @@ -916,6 +948,9 @@ class GenerateContentResponse(proto.Message): Attributes: candidates (MutableSequence[google.cloud.aiplatform_v1beta1.types.Candidate]): Output only. Generated candidates. + model_version (str): + Output only. The model version used to + generate the response. prompt_feedback (google.cloud.aiplatform_v1beta1.types.GenerateContentResponse.PromptFeedback): Output only. Content filter results for a prompt sent in the request. Note: Sent only in @@ -988,7 +1023,8 @@ class UsageMetadata(proto.Message): candidates_token_count (int): Number of tokens in the response(s). total_token_count (int): - + Total token count for prompt and response + candidates. cached_content_token_count (int): Output only. Number of tokens in the cached part in the input (the cached content). @@ -1016,6 +1052,10 @@ class UsageMetadata(proto.Message): number=2, message=content.Candidate, ) + model_version: str = proto.Field( + proto.STRING, + number=11, + ) prompt_feedback: PromptFeedback = proto.Field( proto.MESSAGE, number=3, @@ -1033,9 +1073,9 @@ class ChatCompletionsRequest(proto.Message): Attributes: endpoint (str): - Required. The name of the Endpoint requested to serve the + Required. The name of the endpoint requested to serve the prediction. Format: - ``projects/{project}/locations/{location}/endpoints/openapi`` + ``projects/{project}/locations/{location}/endpoints/{endpoint}`` http_body (google.api.httpbody_pb2.HttpBody): Optional. The prediction input. Supports HTTP headers and arbitrary data payload. diff --git a/google/cloud/aiplatform_v1beta1/types/service_networking.py b/google/cloud/aiplatform_v1beta1/types/service_networking.py index 4e094c1470..3a9b57420c 100644 --- a/google/cloud/aiplatform_v1beta1/types/service_networking.py +++ b/google/cloud/aiplatform_v1beta1/types/service_networking.py @@ -23,6 +23,7 @@ __protobuf__ = proto.module( package="google.cloud.aiplatform.v1beta1", manifest={ + "PSCAutomationConfig", "PrivateServiceConnectConfig", "PscAutomatedEndpoints", "PscInterfaceConfig", @@ -30,6 +31,33 @@ ) +class PSCAutomationConfig(proto.Message): + r"""PSC config that is used to automatically create forwarding + rule via ServiceConnectionMap. + + Attributes: + project_id (str): + Required. Project id used to create + forwarding rule. + network (str): + Required. The full name of the Google Compute Engine + `network `__. + `Format `__: + ``projects/{project}/global/networks/{network}``. Where + {project} is a project number, as in '12345', and {network} + is network name. + """ + + project_id: str = proto.Field( + proto.STRING, + number=1, + ) + network: str = proto.Field( + proto.STRING, + number=2, + ) + + class PrivateServiceConnectConfig(proto.Message): r"""Represents configuration for private service connect. diff --git a/google/cloud/aiplatform_v1beta1/types/ui_pipeline_spec.py b/google/cloud/aiplatform_v1beta1/types/ui_pipeline_spec.py new file mode 100644 index 0000000000..5c43d9f9a2 --- /dev/null +++ b/google/cloud/aiplatform_v1beta1/types/ui_pipeline_spec.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from __future__ import annotations + +from typing import MutableMapping, MutableSequence + +import proto # type: ignore + +from google.cloud.aiplatform_v1beta1.types import value as gca_value +from google.protobuf import struct_pb2 # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.aiplatform.v1beta1", + manifest={ + "ArtifactTypeSchema", + "RuntimeArtifact", + }, +) + + +class ArtifactTypeSchema(proto.Message): + r"""The definition of a artifact type in MLMD. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + schema_title (str): + The name of the type. The format of the title must be: + ``.``. Examples: + + - ``aiplatform.Model`` + - ``acme.CustomModel`` When this field is set, the type + must be pre-registered in the MLMD store. + + This field is a member of `oneof`_ ``kind``. + schema_uri (str): + Points to a YAML file stored on Cloud Storage describing the + format. Deprecated. Use + [PipelineArtifactTypeSchema.schema_title][] or + [PipelineArtifactTypeSchema.instance_schema][] instead. + + This field is a member of `oneof`_ ``kind``. + instance_schema (str): + Contains a raw YAML string, describing the + format of the properties of the type. + + This field is a member of `oneof`_ ``kind``. + schema_version (str): + The schema version of the artifact. If the + value is not set, it defaults to the latest + version in the system. + """ + + schema_title: str = proto.Field( + proto.STRING, + number=1, + oneof="kind", + ) + schema_uri: str = proto.Field( + proto.STRING, + number=2, + oneof="kind", + ) + instance_schema: str = proto.Field( + proto.STRING, + number=3, + oneof="kind", + ) + schema_version: str = proto.Field( + proto.STRING, + number=4, + ) + + +class RuntimeArtifact(proto.Message): + r"""The definition of a runtime artifact. + + Attributes: + name (str): + The name of an artifact. + type_ (google.cloud.aiplatform_v1beta1.types.ArtifactTypeSchema): + The type of the artifact. + uri (str): + The URI of the artifact. + properties (MutableMapping[str, google.cloud.aiplatform_v1beta1.types.Value]): + The properties of the artifact. Deprecated. Use + [RuntimeArtifact.metadata][google.cloud.aiplatform.v1beta1.RuntimeArtifact.metadata] + instead. + custom_properties (MutableMapping[str, google.cloud.aiplatform_v1beta1.types.Value]): + The custom properties of the artifact. Deprecated. Use + [RuntimeArtifact.metadata][google.cloud.aiplatform.v1beta1.RuntimeArtifact.metadata] + instead. + metadata (google.protobuf.struct_pb2.Struct): + Properties of the Artifact. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + type_: "ArtifactTypeSchema" = proto.Field( + proto.MESSAGE, + number=2, + message="ArtifactTypeSchema", + ) + uri: str = proto.Field( + proto.STRING, + number=3, + ) + properties: MutableMapping[str, gca_value.Value] = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=4, + message=gca_value.Value, + ) + custom_properties: MutableMapping[str, gca_value.Value] = proto.MapField( + proto.STRING, + proto.MESSAGE, + number=5, + message=gca_value.Value, + ) + metadata: struct_pb2.Struct = proto.Field( + proto.MESSAGE, + number=6, + message=struct_pb2.Struct, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json index 1f69bd7517..73e7446dc0 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-aiplatform", - "version": "1.67.1" + "version": "0.1.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json index a1fa9d0b12..fe605eb31b 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-aiplatform", - "version": "1.67.1" + "version": "0.1.0" }, "snippets": [ { diff --git a/tests/unit/gapic/aiplatform_v1/test_prediction_service.py b/tests/unit/gapic/aiplatform_v1/test_prediction_service.py index 1b062cfbb8..56a3a2dfc1 100644 --- a/tests/unit/gapic/aiplatform_v1/test_prediction_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_prediction_service.py @@ -4126,7 +4126,9 @@ def test_generate_content(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.generate_content), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = prediction_service.GenerateContentResponse() + call.return_value = prediction_service.GenerateContentResponse( + model_version="model_version_value", + ) response = client.generate_content(request) # Establish that the underlying gRPC stub method was called. @@ -4137,6 +4139,7 @@ def test_generate_content(request_type, transport: str = "grpc"): # Establish that the response is the type that we expect. assert isinstance(response, prediction_service.GenerateContentResponse) + assert response.model_version == "model_version_value" def test_generate_content_empty_call(): @@ -4236,7 +4239,9 @@ async def test_generate_content_empty_call_async(): with mock.patch.object(type(client.transport.generate_content), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - prediction_service.GenerateContentResponse() + prediction_service.GenerateContentResponse( + model_version="model_version_value", + ) ) response = await client.generate_content() call.assert_called() @@ -4304,7 +4309,9 @@ async def test_generate_content_async( with mock.patch.object(type(client.transport.generate_content), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - prediction_service.GenerateContentResponse() + prediction_service.GenerateContentResponse( + model_version="model_version_value", + ) ) response = await client.generate_content(request) @@ -4316,6 +4323,7 @@ async def test_generate_content_async( # Establish that the response is the type that we expect. assert isinstance(response, prediction_service.GenerateContentResponse) + assert response.model_version == "model_version_value" @pytest.mark.asyncio @@ -6951,7 +6959,9 @@ def test_generate_content_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = prediction_service.GenerateContentResponse() + return_value = prediction_service.GenerateContentResponse( + model_version="model_version_value", + ) # Wrap the value into a proper Response obj response_value = Response() @@ -6966,6 +6976,7 @@ def test_generate_content_rest(request_type): # Establish that the response is the type that we expect. assert isinstance(response, prediction_service.GenerateContentResponse) + assert response.model_version == "model_version_value" def test_generate_content_rest_use_cached_wrapped_rpc(): @@ -7266,7 +7277,9 @@ def test_stream_generate_content_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = prediction_service.GenerateContentResponse() + return_value = prediction_service.GenerateContentResponse( + model_version="model_version_value", + ) # Wrap the value into a proper Response obj response_value = Response() @@ -7288,6 +7301,7 @@ def test_stream_generate_content_rest(request_type): # Establish that the response is the type that we expect. assert isinstance(response, prediction_service.GenerateContentResponse) + assert response.model_version == "model_version_value" def test_stream_generate_content_rest_use_cached_wrapped_rpc(): diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py index c42560846a..98eb0a48c7 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py @@ -3394,6 +3394,7 @@ def test_import_extension_rest(request_type): "max_length": 1063, "pattern": "pattern_value", "example": {}, + "any_of": {}, }, "response": {}, }, @@ -4585,6 +4586,7 @@ def test_update_extension_rest(request_type): "max_length": 1063, "pattern": "pattern_value", "example": {}, + "any_of": {}, }, "response": {}, }, diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py index e648c041b4..bb52d0d34c 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py @@ -3456,6 +3456,7 @@ def test_create_cached_content_rest(request_type): "max_length": 1063, "pattern": "pattern_value", "example": {}, + "any_of": {}, }, "response": {}, } @@ -4278,6 +4279,7 @@ def test_update_cached_content_rest(request_type): "max_length": 1063, "pattern": "pattern_value", "example": {}, + "any_of": {}, }, "response": {}, } diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py index 230617a9f2..b52c5f17d9 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py @@ -4705,6 +4705,9 @@ def test_create_index_endpoint_rest(request_type): "reserved_ip_ranges_value2", ], "deployment_group": "deployment_group_value", + "psc_automation_configs": [ + {"project_id": "project_id_value", "network": "network_value"} + ], } ], "etag": "etag_value", @@ -5896,6 +5899,9 @@ def test_update_index_endpoint_rest(request_type): "reserved_ip_ranges_value2", ], "deployment_group": "deployment_group_value", + "psc_automation_configs": [ + {"project_id": "project_id_value", "network": "network_value"} + ], } ], "etag": "etag_value", @@ -7324,6 +7330,9 @@ def test_mutate_deployed_index_rest(request_type): "reserved_ip_ranges_value2", ], "deployment_group": "deployment_group_value", + "psc_automation_configs": [ + {"project_id": "project_id_value", "network": "network_value"} + ], } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py index ddc484f2aa..0b9bdfee3b 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py @@ -78,6 +78,7 @@ from google.cloud.aiplatform_v1beta1.types import ( training_pipeline as gca_training_pipeline, ) +from google.cloud.aiplatform_v1beta1.types import ui_pipeline_spec from google.cloud.aiplatform_v1beta1.types import value from google.cloud.location import locations_pb2 from google.iam.v1 import iam_policy_pb2 # type: ignore @@ -3415,6 +3416,7 @@ def test_create_pipeline_job(request_type, transport: str = "grpc"): preflight_validations=True, satisfies_pzs=True, satisfies_pzi=True, + original_pipeline_job_id=2512, ) response = client.create_pipeline_job(request) @@ -3437,6 +3439,7 @@ def test_create_pipeline_job(request_type, transport: str = "grpc"): assert response.preflight_validations is True assert response.satisfies_pzs is True assert response.satisfies_pzi is True + assert response.original_pipeline_job_id == 2512 def test_create_pipeline_job_empty_call(): @@ -3558,6 +3561,7 @@ async def test_create_pipeline_job_empty_call_async(): preflight_validations=True, satisfies_pzs=True, satisfies_pzi=True, + original_pipeline_job_id=2512, ) ) response = await client.create_pipeline_job() @@ -3640,6 +3644,7 @@ async def test_create_pipeline_job_async( preflight_validations=True, satisfies_pzs=True, satisfies_pzi=True, + original_pipeline_job_id=2512, ) ) response = await client.create_pipeline_job(request) @@ -3663,6 +3668,7 @@ async def test_create_pipeline_job_async( assert response.preflight_validations is True assert response.satisfies_pzs is True assert response.satisfies_pzi is True + assert response.original_pipeline_job_id == 2512 @pytest.mark.asyncio @@ -3873,6 +3879,7 @@ def test_get_pipeline_job(request_type, transport: str = "grpc"): preflight_validations=True, satisfies_pzs=True, satisfies_pzi=True, + original_pipeline_job_id=2512, ) response = client.get_pipeline_job(request) @@ -3895,6 +3902,7 @@ def test_get_pipeline_job(request_type, transport: str = "grpc"): assert response.preflight_validations is True assert response.satisfies_pzs is True assert response.satisfies_pzi is True + assert response.original_pipeline_job_id == 2512 def test_get_pipeline_job_empty_call(): @@ -4006,6 +4014,7 @@ async def test_get_pipeline_job_empty_call_async(): preflight_validations=True, satisfies_pzs=True, satisfies_pzi=True, + original_pipeline_job_id=2512, ) ) response = await client.get_pipeline_job() @@ -4085,6 +4094,7 @@ async def test_get_pipeline_job_async( preflight_validations=True, satisfies_pzs=True, satisfies_pzi=True, + original_pipeline_job_id=2512, ) ) response = await client.get_pipeline_job(request) @@ -4108,6 +4118,7 @@ async def test_get_pipeline_job_async( assert response.preflight_validations is True assert response.satisfies_pzs is True assert response.satisfies_pzi is True + assert response.original_pipeline_job_id == 2512 @pytest.mark.asyncio @@ -8427,6 +8438,16 @@ def test_create_pipeline_job_rest(request_type): "preflight_validations": True, "satisfies_pzs": True, "satisfies_pzi": True, + "original_pipeline_job_id": 2512, + "pipeline_task_rerun_configs": [ + { + "task_id": 735, + "task_name": "task_name_value", + "inputs": {"artifacts": {}, "parameter_values": {}}, + "skip_task": True, + "skip_downstream_tasks": True, + } + ], } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -8512,6 +8533,7 @@ def get_message_fields(field): preflight_validations=True, satisfies_pzs=True, satisfies_pzi=True, + original_pipeline_job_id=2512, ) # Wrap the value into a proper Response obj @@ -8538,6 +8560,7 @@ def get_message_fields(field): assert response.preflight_validations is True assert response.satisfies_pzs is True assert response.satisfies_pzi is True + assert response.original_pipeline_job_id == 2512 def test_create_pipeline_job_rest_use_cached_wrapped_rpc(): @@ -8854,6 +8877,7 @@ def test_get_pipeline_job_rest(request_type): preflight_validations=True, satisfies_pzs=True, satisfies_pzi=True, + original_pipeline_job_id=2512, ) # Wrap the value into a proper Response obj @@ -8880,6 +8904,7 @@ def test_get_pipeline_job_rest(request_type): assert response.preflight_validations is True assert response.satisfies_pzs is True assert response.satisfies_pzi is True + assert response.original_pipeline_job_id == 2512 def test_get_pipeline_job_rest_use_cached_wrapped_rpc(): diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py index 8e68ac830a..34296a82fd 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py @@ -4508,7 +4508,9 @@ def test_generate_content(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.generate_content), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = prediction_service.GenerateContentResponse() + call.return_value = prediction_service.GenerateContentResponse( + model_version="model_version_value", + ) response = client.generate_content(request) # Establish that the underlying gRPC stub method was called. @@ -4519,6 +4521,7 @@ def test_generate_content(request_type, transport: str = "grpc"): # Establish that the response is the type that we expect. assert isinstance(response, prediction_service.GenerateContentResponse) + assert response.model_version == "model_version_value" def test_generate_content_empty_call(): @@ -4620,7 +4623,9 @@ async def test_generate_content_empty_call_async(): with mock.patch.object(type(client.transport.generate_content), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - prediction_service.GenerateContentResponse() + prediction_service.GenerateContentResponse( + model_version="model_version_value", + ) ) response = await client.generate_content() call.assert_called() @@ -4688,7 +4693,9 @@ async def test_generate_content_async( with mock.patch.object(type(client.transport.generate_content), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - prediction_service.GenerateContentResponse() + prediction_service.GenerateContentResponse( + model_version="model_version_value", + ) ) response = await client.generate_content(request) @@ -4700,6 +4707,7 @@ async def test_generate_content_async( # Establish that the response is the type that we expect. assert isinstance(response, prediction_service.GenerateContentResponse) + assert response.model_version == "model_version_value" @pytest.mark.asyncio @@ -8014,7 +8022,9 @@ def test_generate_content_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = prediction_service.GenerateContentResponse() + return_value = prediction_service.GenerateContentResponse( + model_version="model_version_value", + ) # Wrap the value into a proper Response obj response_value = Response() @@ -8029,6 +8039,7 @@ def test_generate_content_rest(request_type): # Establish that the response is the type that we expect. assert isinstance(response, prediction_service.GenerateContentResponse) + assert response.model_version == "model_version_value" def test_generate_content_rest_use_cached_wrapped_rpc(): @@ -8329,7 +8340,9 @@ def test_stream_generate_content_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = prediction_service.GenerateContentResponse() + return_value = prediction_service.GenerateContentResponse( + model_version="model_version_value", + ) # Wrap the value into a proper Response obj response_value = Response() @@ -8351,6 +8364,7 @@ def test_stream_generate_content_rest(request_type): # Establish that the response is the type that we expect. assert isinstance(response, prediction_service.GenerateContentResponse) + assert response.model_version == "model_version_value" def test_stream_generate_content_rest_use_cached_wrapped_rpc(): diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py index 551b7d1ee6..c4ffde8062 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py @@ -83,6 +83,7 @@ from google.cloud.aiplatform_v1beta1.types import schedule from google.cloud.aiplatform_v1beta1.types import schedule as gca_schedule from google.cloud.aiplatform_v1beta1.types import schedule_service +from google.cloud.aiplatform_v1beta1.types import ui_pipeline_spec from google.cloud.aiplatform_v1beta1.types import value from google.cloud.location import locations_pb2 from google.iam.v1 import iam_policy_pb2 # type: ignore @@ -4174,6 +4175,16 @@ def test_create_schedule_rest(request_type): "preflight_validations": True, "satisfies_pzs": True, "satisfies_pzi": True, + "original_pipeline_job_id": 2512, + "pipeline_task_rerun_configs": [ + { + "task_id": 735, + "task_name": "task_name_value", + "inputs": {"artifacts": {}, "parameter_values": {}}, + "skip_task": True, + "skip_downstream_tasks": True, + } + ], }, "pipeline_job_id": "pipeline_job_id_value", }, @@ -6465,6 +6476,16 @@ def test_update_schedule_rest(request_type): "preflight_validations": True, "satisfies_pzs": True, "satisfies_pzi": True, + "original_pipeline_job_id": 2512, + "pipeline_task_rerun_configs": [ + { + "task_id": 735, + "task_name": "task_name_value", + "inputs": {"artifacts": {}, "parameter_values": {}}, + "skip_task": True, + "skip_downstream_tasks": True, + } + ], }, "pipeline_job_id": "pipeline_job_id_value", },