Skip to content

Commit 1589f66

Browse files
gcf-owl-bot[bot]copybara-github
authored andcommitted
Copybara import of the project:
-- 255d3de by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: feat: add Gen AI logging public preview API PiperOrigin-RevId: 743220774 Source-Link: googleapis/googleapis@3b446a9 Source-Link: googleapis/googleapis-gen@52443a8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTI0NDNhOGRmZDc0MGZmZDU4OTY1YzI3ZjExMzI4NGQyNGZmYTU2ZiJ9 -- 32983cd by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md COPYBARA_INTEGRATE_REVIEW=#5139 from googleapis:owl-bot-copy ee83524 PiperOrigin-RevId: 743328858
1 parent 73db48d commit 1589f66

20 files changed

+7320
-3072
lines changed

google/cloud/aiplatform_v1beta1/__init__.py

+8
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,23 @@
223223
from .types.endpoint import FasterDeploymentConfig
224224
from .types.endpoint import PredictRequestResponseLoggingConfig
225225
from .types.endpoint import PrivateEndpoints
226+
from .types.endpoint import PublisherModelConfig
226227
from .types.endpoint import RolloutOptions
227228
from .types.endpoint_service import CreateEndpointOperationMetadata
228229
from .types.endpoint_service import CreateEndpointRequest
229230
from .types.endpoint_service import DeleteEndpointRequest
230231
from .types.endpoint_service import DeployModelOperationMetadata
231232
from .types.endpoint_service import DeployModelRequest
232233
from .types.endpoint_service import DeployModelResponse
234+
from .types.endpoint_service import FetchPublisherModelConfigRequest
233235
from .types.endpoint_service import GetEndpointRequest
234236
from .types.endpoint_service import ListEndpointsRequest
235237
from .types.endpoint_service import ListEndpointsResponse
236238
from .types.endpoint_service import MutateDeployedModelOperationMetadata
237239
from .types.endpoint_service import MutateDeployedModelRequest
238240
from .types.endpoint_service import MutateDeployedModelResponse
241+
from .types.endpoint_service import SetPublisherModelConfigOperationMetadata
242+
from .types.endpoint_service import SetPublisherModelConfigRequest
239243
from .types.endpoint_service import UndeployModelOperationMetadata
240244
from .types.endpoint_service import UndeployModelRequest
241245
from .types.endpoint_service import UndeployModelResponse
@@ -1661,6 +1665,7 @@
16611665
"FetchExamplesResponse",
16621666
"FetchFeatureValuesRequest",
16631667
"FetchFeatureValuesResponse",
1668+
"FetchPublisherModelConfigRequest",
16641669
"FileData",
16651670
"FileStatus",
16661671
"FilterSplit",
@@ -2051,6 +2056,7 @@
20512056
"PscAutomatedEndpoints",
20522057
"PscInterfaceConfig",
20532058
"PublisherModel",
2059+
"PublisherModelConfig",
20542060
"PublisherModelView",
20552061
"PurgeArtifactsMetadata",
20562062
"PurgeArtifactsRequest",
@@ -2197,6 +2203,8 @@
21972203
"Session",
21982204
"SessionEvent",
21992205
"SessionServiceClient",
2206+
"SetPublisherModelConfigOperationMetadata",
2207+
"SetPublisherModelConfigRequest",
22002208
"SharePointSources",
22012209
"ShieldedVmConfig",
22022210
"SlackSource",

google/cloud/aiplatform_v1beta1/gapic_metadata.json

+30
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,11 @@
468468
"deploy_model"
469469
]
470470
},
471+
"FetchPublisherModelConfig": {
472+
"methods": [
473+
"fetch_publisher_model_config"
474+
]
475+
},
471476
"GetEndpoint": {
472477
"methods": [
473478
"get_endpoint"
@@ -483,6 +488,11 @@
483488
"mutate_deployed_model"
484489
]
485490
},
491+
"SetPublisherModelConfig": {
492+
"methods": [
493+
"set_publisher_model_config"
494+
]
495+
},
486496
"UndeployModel": {
487497
"methods": [
488498
"undeploy_model"
@@ -518,6 +528,11 @@
518528
"deploy_model"
519529
]
520530
},
531+
"FetchPublisherModelConfig": {
532+
"methods": [
533+
"fetch_publisher_model_config"
534+
]
535+
},
521536
"GetEndpoint": {
522537
"methods": [
523538
"get_endpoint"
@@ -533,6 +548,11 @@
533548
"mutate_deployed_model"
534549
]
535550
},
551+
"SetPublisherModelConfig": {
552+
"methods": [
553+
"set_publisher_model_config"
554+
]
555+
},
536556
"UndeployModel": {
537557
"methods": [
538558
"undeploy_model"
@@ -568,6 +588,11 @@
568588
"deploy_model"
569589
]
570590
},
591+
"FetchPublisherModelConfig": {
592+
"methods": [
593+
"fetch_publisher_model_config"
594+
]
595+
},
571596
"GetEndpoint": {
572597
"methods": [
573598
"get_endpoint"
@@ -583,6 +608,11 @@
583608
"mutate_deployed_model"
584609
]
585610
},
611+
"SetPublisherModelConfig": {
612+
"methods": [
613+
"set_publisher_model_config"
614+
]
615+
},
586616
"UndeployModel": {
587617
"methods": [
588618
"undeploy_model"

google/cloud/aiplatform_v1beta1/services/endpoint_service/async_client.py

+253
Original file line numberDiff line numberDiff line change
@@ -1613,6 +1613,259 @@ async def sample_mutate_deployed_model():
16131613
# Done; return the response.
16141614
return response
16151615

1616+
async def set_publisher_model_config(
1617+
self,
1618+
request: Optional[
1619+
Union[endpoint_service.SetPublisherModelConfigRequest, dict]
1620+
] = None,
1621+
*,
1622+
name: Optional[str] = None,
1623+
publisher_model_config: Optional[endpoint.PublisherModelConfig] = None,
1624+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1625+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1626+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1627+
) -> operation_async.AsyncOperation:
1628+
r"""Sets (creates or updates) configs of publisher
1629+
models. For example, sets the request/response logging
1630+
config.
1631+
1632+
.. code-block:: python
1633+
1634+
# This snippet has been automatically generated and should be regarded as a
1635+
# code template only.
1636+
# It will require modifications to work:
1637+
# - It may require correct/in-range values for request initialization.
1638+
# - It may require specifying regional endpoints when creating the service
1639+
# client as shown in:
1640+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1641+
from google.cloud import aiplatform_v1beta1
1642+
1643+
async def sample_set_publisher_model_config():
1644+
# Create a client
1645+
client = aiplatform_v1beta1.EndpointServiceAsyncClient()
1646+
1647+
# Initialize request argument(s)
1648+
request = aiplatform_v1beta1.SetPublisherModelConfigRequest(
1649+
name="name_value",
1650+
)
1651+
1652+
# Make the request
1653+
operation = client.set_publisher_model_config(request=request)
1654+
1655+
print("Waiting for operation to complete...")
1656+
1657+
response = (await operation).result()
1658+
1659+
# Handle the response
1660+
print(response)
1661+
1662+
Args:
1663+
request (Optional[Union[google.cloud.aiplatform_v1beta1.types.SetPublisherModelConfigRequest, dict]]):
1664+
The request object. Request message for
1665+
[EndpointService.SetPublisherModelConfig][google.cloud.aiplatform.v1beta1.EndpointService.SetPublisherModelConfig].
1666+
name (:class:`str`):
1667+
Required. The name of the publisher model, in the format
1668+
of
1669+
``projects/{project}/locations/{location}/publishers/{publisher}/models/{model}``.
1670+
1671+
This corresponds to the ``name`` field
1672+
on the ``request`` instance; if ``request`` is provided, this
1673+
should not be set.
1674+
publisher_model_config (:class:`google.cloud.aiplatform_v1beta1.types.PublisherModelConfig`):
1675+
Required. The publisher model config.
1676+
This corresponds to the ``publisher_model_config`` field
1677+
on the ``request`` instance; if ``request`` is provided, this
1678+
should not be set.
1679+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1680+
should be retried.
1681+
timeout (float): The timeout for this request.
1682+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1683+
sent along with the request as metadata. Normally, each value must be of type `str`,
1684+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
1685+
be of type `bytes`.
1686+
1687+
Returns:
1688+
google.api_core.operation_async.AsyncOperation:
1689+
An object representing a long-running operation.
1690+
1691+
The result type for the operation will be
1692+
:class:`google.cloud.aiplatform_v1beta1.types.PublisherModelConfig`
1693+
This message contains configs of a publisher model.
1694+
1695+
"""
1696+
# Create or coerce a protobuf request object.
1697+
# - Quick check: If we got a request object, we should *not* have
1698+
# gotten any keyword arguments that map to the request.
1699+
flattened_params = [name, publisher_model_config]
1700+
has_flattened_params = (
1701+
len([param for param in flattened_params if param is not None]) > 0
1702+
)
1703+
if request is not None and has_flattened_params:
1704+
raise ValueError(
1705+
"If the `request` argument is set, then none of "
1706+
"the individual field arguments should be set."
1707+
)
1708+
1709+
# - Use the request object if provided (there's no risk of modifying the input as
1710+
# there are no flattened fields), or create one.
1711+
if not isinstance(request, endpoint_service.SetPublisherModelConfigRequest):
1712+
request = endpoint_service.SetPublisherModelConfigRequest(request)
1713+
1714+
# If we have keyword arguments corresponding to fields on the
1715+
# request, apply these.
1716+
if name is not None:
1717+
request.name = name
1718+
if publisher_model_config is not None:
1719+
request.publisher_model_config = publisher_model_config
1720+
1721+
# Wrap the RPC method; this adds retry and timeout information,
1722+
# and friendly error handling.
1723+
rpc = self._client._transport._wrapped_methods[
1724+
self._client._transport.set_publisher_model_config
1725+
]
1726+
1727+
# Certain fields should be provided within the metadata header;
1728+
# add these here.
1729+
metadata = tuple(metadata) + (
1730+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1731+
)
1732+
1733+
# Validate the universe domain.
1734+
self._client._validate_universe_domain()
1735+
1736+
# Send the request.
1737+
response = await rpc(
1738+
request,
1739+
retry=retry,
1740+
timeout=timeout,
1741+
metadata=metadata,
1742+
)
1743+
1744+
# Wrap the response in an operation future.
1745+
response = operation_async.from_gapic(
1746+
response,
1747+
self._client._transport.operations_client,
1748+
endpoint.PublisherModelConfig,
1749+
metadata_type=endpoint_service.SetPublisherModelConfigOperationMetadata,
1750+
)
1751+
1752+
# Done; return the response.
1753+
return response
1754+
1755+
async def fetch_publisher_model_config(
1756+
self,
1757+
request: Optional[
1758+
Union[endpoint_service.FetchPublisherModelConfigRequest, dict]
1759+
] = None,
1760+
*,
1761+
name: Optional[str] = None,
1762+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1763+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1764+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1765+
) -> endpoint.PublisherModelConfig:
1766+
r"""Fetches the configs of publisher models.
1767+
1768+
.. code-block:: python
1769+
1770+
# This snippet has been automatically generated and should be regarded as a
1771+
# code template only.
1772+
# It will require modifications to work:
1773+
# - It may require correct/in-range values for request initialization.
1774+
# - It may require specifying regional endpoints when creating the service
1775+
# client as shown in:
1776+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1777+
from google.cloud import aiplatform_v1beta1
1778+
1779+
async def sample_fetch_publisher_model_config():
1780+
# Create a client
1781+
client = aiplatform_v1beta1.EndpointServiceAsyncClient()
1782+
1783+
# Initialize request argument(s)
1784+
request = aiplatform_v1beta1.FetchPublisherModelConfigRequest(
1785+
name="name_value",
1786+
)
1787+
1788+
# Make the request
1789+
response = await client.fetch_publisher_model_config(request=request)
1790+
1791+
# Handle the response
1792+
print(response)
1793+
1794+
Args:
1795+
request (Optional[Union[google.cloud.aiplatform_v1beta1.types.FetchPublisherModelConfigRequest, dict]]):
1796+
The request object. Request message for
1797+
[EndpointService.FetchPublisherModelConfig][google.cloud.aiplatform.v1beta1.EndpointService.FetchPublisherModelConfig].
1798+
name (:class:`str`):
1799+
Required. The name of the publisher model, in the format
1800+
of
1801+
``projects/{project}/locations/{location}/publishers/{publisher}/models/{model}``.
1802+
1803+
This corresponds to the ``name`` field
1804+
on the ``request`` instance; if ``request`` is provided, this
1805+
should not be set.
1806+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1807+
should be retried.
1808+
timeout (float): The timeout for this request.
1809+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1810+
sent along with the request as metadata. Normally, each value must be of type `str`,
1811+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
1812+
be of type `bytes`.
1813+
1814+
Returns:
1815+
google.cloud.aiplatform_v1beta1.types.PublisherModelConfig:
1816+
This message contains configs of a
1817+
publisher model.
1818+
1819+
"""
1820+
# Create or coerce a protobuf request object.
1821+
# - Quick check: If we got a request object, we should *not* have
1822+
# gotten any keyword arguments that map to the request.
1823+
flattened_params = [name]
1824+
has_flattened_params = (
1825+
len([param for param in flattened_params if param is not None]) > 0
1826+
)
1827+
if request is not None and has_flattened_params:
1828+
raise ValueError(
1829+
"If the `request` argument is set, then none of "
1830+
"the individual field arguments should be set."
1831+
)
1832+
1833+
# - Use the request object if provided (there's no risk of modifying the input as
1834+
# there are no flattened fields), or create one.
1835+
if not isinstance(request, endpoint_service.FetchPublisherModelConfigRequest):
1836+
request = endpoint_service.FetchPublisherModelConfigRequest(request)
1837+
1838+
# If we have keyword arguments corresponding to fields on the
1839+
# request, apply these.
1840+
if name is not None:
1841+
request.name = name
1842+
1843+
# Wrap the RPC method; this adds retry and timeout information,
1844+
# and friendly error handling.
1845+
rpc = self._client._transport._wrapped_methods[
1846+
self._client._transport.fetch_publisher_model_config
1847+
]
1848+
1849+
# Certain fields should be provided within the metadata header;
1850+
# add these here.
1851+
metadata = tuple(metadata) + (
1852+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1853+
)
1854+
1855+
# Validate the universe domain.
1856+
self._client._validate_universe_domain()
1857+
1858+
# Send the request.
1859+
response = await rpc(
1860+
request,
1861+
retry=retry,
1862+
timeout=timeout,
1863+
metadata=metadata,
1864+
)
1865+
1866+
# Done; return the response.
1867+
return response
1868+
16161869
async def list_operations(
16171870
self,
16181871
request: Optional[operations_pb2.ListOperationsRequest] = None,

0 commit comments

Comments
 (0)