Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions google/cloud/aiplatform_v1beta1/types/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,13 +668,39 @@ class PublisherModelConfig(proto.Message):
logging_config (google.cloud.aiplatform_v1beta1.types.PredictRequestResponseLoggingConfig):
The prediction request/response logging
config.
data_sharing_enabled_provider (google.cloud.aiplatform_v1beta1.types.PublisherModelConfig.ModelProvider):
Optional. The model provider (publisher) for
which the customer has enabled data sharing. For
publisher models that are configured to require
data sharing, a prediction request is only
allowed when the model's publisher matches this
provider. Otherwise, the request is rejected.
"""

class ModelProvider(proto.Enum):
r"""A model provider (publisher) that prediction data may be
shared with.

Values:
MODEL_PROVIDER_UNSPECIFIED (0):
Unspecified model provider.
ANTHROPIC (1):
Anthropic.
"""

MODEL_PROVIDER_UNSPECIFIED = 0
ANTHROPIC = 1

logging_config: "PredictRequestResponseLoggingConfig" = proto.Field(
proto.MESSAGE,
number=3,
message="PredictRequestResponseLoggingConfig",
)
data_sharing_enabled_provider: ModelProvider = proto.Field(
proto.ENUM,
number=4,
enum=ModelProvider,
)


class ClientConnectionConfig(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-aiplatform",
"version": "1.158.0"
"version": "0.0.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-aiplatform",
"version": "1.158.0"
"version": "0.0.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4553,6 +4553,7 @@ def test_fetch_publisher_model_config(request_type, transport: str = 'grpc'):
'__call__') as call:
# Designate an appropriate return value for the call.
call.return_value = endpoint.PublisherModelConfig(
data_sharing_enabled_provider=endpoint.PublisherModelConfig.ModelProvider.ANTHROPIC,
)
response = client.fetch_publisher_model_config(request)

Expand All @@ -4564,6 +4565,7 @@ def test_fetch_publisher_model_config(request_type, transport: str = 'grpc'):

# Establish that the response is the type that we expect.
assert isinstance(response, endpoint.PublisherModelConfig)
assert response.data_sharing_enabled_provider == endpoint.PublisherModelConfig.ModelProvider.ANTHROPIC


def test_fetch_publisher_model_config_non_empty_request_with_auto_populated_field():
Expand Down Expand Up @@ -4681,6 +4683,7 @@ async def test_fetch_publisher_model_config_async(request_type, transport: str =
'__call__') as call:
# Designate an appropriate return value for the call.
call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(endpoint.PublisherModelConfig(
data_sharing_enabled_provider=endpoint.PublisherModelConfig.ModelProvider.ANTHROPIC,
))
response = await client.fetch_publisher_model_config(request)

Expand All @@ -4692,6 +4695,7 @@ async def test_fetch_publisher_model_config_async(request_type, transport: str =

# Establish that the response is the type that we expect.
assert isinstance(response, endpoint.PublisherModelConfig)
assert response.data_sharing_enabled_provider == endpoint.PublisherModelConfig.ModelProvider.ANTHROPIC

def test_fetch_publisher_model_config_field_headers():
client = EndpointServiceClient(
Expand Down Expand Up @@ -7413,6 +7417,7 @@ async def test_fetch_publisher_model_config_empty_call_grpc_asyncio():
'__call__') as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(endpoint.PublisherModelConfig(
data_sharing_enabled_provider=endpoint.PublisherModelConfig.ModelProvider.ANTHROPIC,
))
await client.fetch_publisher_model_config(request=None)

Expand Down Expand Up @@ -8667,6 +8672,7 @@ def test_fetch_publisher_model_config_rest_call_success(request_type):
with mock.patch.object(type(client.transport._session), 'request') as req:
# Designate an appropriate value for the returned response.
return_value = endpoint.PublisherModelConfig(
data_sharing_enabled_provider=endpoint.PublisherModelConfig.ModelProvider.ANTHROPIC,
)

# Wrap the value into a proper Response obj
Expand All @@ -8683,6 +8689,7 @@ def test_fetch_publisher_model_config_rest_call_success(request_type):

# Establish that the response is the type that we expect.
assert isinstance(response, endpoint.PublisherModelConfig)
assert response.data_sharing_enabled_provider == endpoint.PublisherModelConfig.ModelProvider.ANTHROPIC


@pytest.mark.parametrize("null_interceptor", [True, False])
Expand Down Expand Up @@ -10836,6 +10843,7 @@ async def test_fetch_publisher_model_config_rest_asyncio_call_success(request_ty
with mock.patch.object(type(client.transport._session), 'request') as req:
# Designate an appropriate value for the returned response.
return_value = endpoint.PublisherModelConfig(
data_sharing_enabled_provider=endpoint.PublisherModelConfig.ModelProvider.ANTHROPIC,
)

# Wrap the value into a proper Response obj
Expand All @@ -10852,6 +10860,7 @@ async def test_fetch_publisher_model_config_rest_asyncio_call_success(request_ty

# Establish that the response is the type that we expect.
assert isinstance(response, endpoint.PublisherModelConfig)
assert response.data_sharing_enabled_provider == endpoint.PublisherModelConfig.ModelProvider.ANTHROPIC


@pytest.mark.asyncio
Expand Down
Loading