Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"gs://google-cloud-aiplatform/schema/dataset/metadata/multimodal_1.0.0.yaml"
)
BIGQUERY_TABLE_NAME = "vertex-sdk-dev.multimodal_dataset.test-table"
DATASET = "8810841321427173376"
DATASET = "projects/vertex-sdk-dev/locations/us-central1/datasets/8810841321427173376"


def test_assemble_dataset(client):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"gs://google-cloud-aiplatform/schema/dataset/metadata/multimodal_1.0.0.yaml"
)
BIGQUERY_TABLE_NAME = "vertex-sdk-dev.multimodal_dataset.test-table"
DATASET = "8810841321427173376"
DATASET = "projects/vertex-sdk-dev/locations/us-central1/datasets/8810841321427173376"


def test_assess_dataset(client):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ def test_delete_dataset(client):
},
}
)
name = dataset.name.split("/datasets/")[1]

operation = client.datasets._delete_multimodal_dataset(
name=name,
name=dataset.name,
)
assert isinstance(operation, types.MultimodalDatasetOperation)
assert operation.done
Expand All @@ -53,10 +52,9 @@ def test_delete_dataset_with_public_method(client):
},
}
)
name = dataset.name.split("/datasets/")[1]

operation = client.datasets.delete_multimodal_dataset(
name=name,
name=dataset.name,
)
assert isinstance(operation, types.MultimodalDatasetOperation)
assert operation.done
Expand All @@ -82,13 +80,12 @@ async def test_delete_dataset_async(client):
},
}
)
name = dataset.name.split("/datasets/")[1]

operation = await client.aio.datasets._delete_multimodal_dataset(
name=name,
name=dataset.name,
)
assert isinstance(operation, types.MultimodalDatasetOperation)
assert operation
assert operation.done


@pytest.mark.asyncio
Expand All @@ -103,10 +100,9 @@ async def test_delete_dataset_with_public_method_async(client):
},
}
)
name = dataset.name.split("/datasets/")[1]

operation = await client.aio.datasets.delete_multimodal_dataset(
name=name,
name=dataset.name,
)
assert isinstance(operation, types.MultimodalDatasetOperation)
assert operation.done
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
import pytest

BIGQUERY_TABLE_NAME = "vertex-sdk-dev.multimodal_dataset.test-table"
DATASET = "8810841321427173376"
DATASET = "projects/964831358985/locations/us-central1/datasets/8810841321427173376"


def test_get_dataset(client):
dataset = client.datasets._get_multimodal_dataset(
name=DATASET,
)
assert isinstance(dataset, types.MultimodalDataset)
assert dataset.name.endswith(DATASET)
assert dataset.name == DATASET
assert dataset.display_name == "test-display-name"


Expand All @@ -37,7 +37,7 @@ def test_get_dataset_from_public_method(client):
name=DATASET,
)
assert isinstance(dataset, types.MultimodalDataset)
assert dataset.name.endswith(DATASET)
assert dataset.name == DATASET
assert dataset.display_name == "test-display-name"


Expand All @@ -55,7 +55,7 @@ async def test_get_dataset_async(client):
name=DATASET,
)
assert isinstance(dataset, types.MultimodalDataset)
assert dataset.name.endswith(DATASET)
assert dataset.name == DATASET
assert dataset.display_name == "test-display-name"


Expand All @@ -65,5 +65,5 @@ async def test_get_dataset_from_public_method_async(client):
name=DATASET,
)
assert isinstance(dataset, types.MultimodalDataset)
assert dataset.name.endswith(DATASET)
assert dataset.name == DATASET
assert dataset.display_name == "test-display-name"
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"gs://google-cloud-aiplatform/schema/dataset/metadata/multimodal_1.0.0.yaml"
)
BIGQUERY_TABLE_NAME = "vertex-sdk-dev.multimodal_dataset.test-table"
DATASET = "8810841321427173376"
DATASET = "projects/vertex-sdk-dev/locations/us-central1/datasets/8810841321427173376"


def test_update_dataset(client):
Expand Down
68 changes: 36 additions & 32 deletions vertexai/_genai/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ def _assemble_multimodal_dataset(
request_dict = _AssembleDatasetParameters_to_vertex(parameter_model)
request_url_dict = request_dict.get("_url")
if request_url_dict:
path = "datasets/{name}:assemble".format_map(request_url_dict)
path = "{name}:assemble".format_map(request_url_dict)
else:
path = "datasets/{name}:assemble"
path = "{name}:assemble"

query_params = request_dict.get("_query")
if query_params:
Expand Down Expand Up @@ -363,9 +363,9 @@ def _assess_multimodal_dataset(
request_dict = _AssessDatasetParameters_to_vertex(parameter_model)
request_url_dict = request_dict.get("_url")
if request_url_dict:
path = "datasets/{name}:assess".format_map(request_url_dict)
path = "{name}:assess".format_map(request_url_dict)
else:
path = "datasets/{name}:assess"
path = "{name}:assess"

query_params = request_dict.get("_query")
if query_params:
Expand Down Expand Up @@ -512,9 +512,9 @@ def _delete_multimodal_dataset(
)
request_url_dict = request_dict.get("_url")
if request_url_dict:
path = "datasets/{name}".format_map(request_url_dict)
path = "{name}".format_map(request_url_dict)
else:
path = "datasets/{name}"
path = "{name}"

query_params = request_dict.get("_query")
if query_params:
Expand Down Expand Up @@ -582,9 +582,9 @@ def _get_multimodal_dataset(
request_dict = _GetMultimodalDatasetParameters_to_vertex(parameter_model)
request_url_dict = request_dict.get("_url")
if request_url_dict:
path = "datasets/{name}".format_map(request_url_dict)
path = "{name}".format_map(request_url_dict)
else:
path = "datasets/{name}"
path = "{name}"

query_params = request_dict.get("_query")
if query_params:
Expand Down Expand Up @@ -804,9 +804,9 @@ def _update_multimodal_dataset(
request_dict = _UpdateMultimodalDatasetParameters_to_vertex(parameter_model)
request_url_dict = request_dict.get("_url")
if request_url_dict:
path = "datasets/{name}".format_map(request_url_dict)
path = "{name}".format_map(request_url_dict)
else:
path = "datasets/{name}"
path = "{name}"

query_params = request_dict.get("_query")
if query_params:
Expand Down Expand Up @@ -1130,7 +1130,8 @@ def get_multimodal_dataset(

Args:
name:
Required. name of a multimodal dataset.
Required. name of a multimodal dataset. The name should be in
the format of "projects/{project}/locations/{location}/datasets/{dataset}".
config:
Optional. A configuration for getting the multimodal dataset. If not
provided, the default configuration will be used.
Expand All @@ -1156,7 +1157,8 @@ def delete_multimodal_dataset(

Args:
name:
Required. name of a multimodal dataset.
Required. name of a multimodal dataset. The name should be in
the format of "projects/{project}/locations/{location}/datasets/{dataset}".
config:
Optional. A configuration for deleting the multimodal dataset. If not
provided, the default configuration will be used.
Expand Down Expand Up @@ -1231,7 +1233,7 @@ def assess_tuning_resources(
Args:
dataset_name:
Required. The name of the dataset to assess the tuning resources
for.
for. The name should be in the format of "projects/{project}/locations/{location}/datasets/{dataset}".
model_name:
Required. The name of the model to assess the tuning resources
for.
Expand Down Expand Up @@ -1287,7 +1289,7 @@ def assess_tuning_validity(
Args:
dataset_name:
Required. The name of the dataset to assess the tuning validity
for.
for. The name should be in the format of "projects/{project}/locations/{location}/datasets/{dataset}".
model_name:
Required. The name of the model to assess the tuning validity
for.
Expand Down Expand Up @@ -1347,7 +1349,7 @@ def assess_batch_prediction_resources(
Args:
dataset_name:
Required. The name of the dataset to assess the batch prediction
resources.
resources. The name should be in the format of "projects/{project}/locations/{location}/datasets/{dataset}".
model_name:
Required. The name of the model to assess the batch prediction
resources.
Expand Down Expand Up @@ -1408,7 +1410,7 @@ def assess_batch_prediction_validity(
Args:
dataset_name:
Required. The name of the dataset to assess the batch prediction
validity for.
validity for. The name should be in the format of "projects/{project}/locations/{location}/datasets/{dataset}".
model_name:
Required. The name of the model to assess the batch prediction
validity for.
Expand Down Expand Up @@ -1479,9 +1481,9 @@ async def _assemble_multimodal_dataset(
request_dict = _AssembleDatasetParameters_to_vertex(parameter_model)
request_url_dict = request_dict.get("_url")
if request_url_dict:
path = "datasets/{name}:assemble".format_map(request_url_dict)
path = "{name}:assemble".format_map(request_url_dict)
else:
path = "datasets/{name}:assemble"
path = "{name}:assemble"

query_params = request_dict.get("_query")
if query_params:
Expand Down Expand Up @@ -1571,9 +1573,9 @@ async def _assess_multimodal_dataset(
request_dict = _AssessDatasetParameters_to_vertex(parameter_model)
request_url_dict = request_dict.get("_url")
if request_url_dict:
path = "datasets/{name}:assess".format_map(request_url_dict)
path = "{name}:assess".format_map(request_url_dict)
else:
path = "datasets/{name}:assess"
path = "{name}:assess"

query_params = request_dict.get("_query")
if query_params:
Expand Down Expand Up @@ -1724,9 +1726,9 @@ async def _delete_multimodal_dataset(
)
request_url_dict = request_dict.get("_url")
if request_url_dict:
path = "datasets/{name}".format_map(request_url_dict)
path = "{name}".format_map(request_url_dict)
else:
path = "datasets/{name}"
path = "{name}"

query_params = request_dict.get("_query")
if query_params:
Expand Down Expand Up @@ -1796,9 +1798,9 @@ async def _get_multimodal_dataset(
request_dict = _GetMultimodalDatasetParameters_to_vertex(parameter_model)
request_url_dict = request_dict.get("_url")
if request_url_dict:
path = "datasets/{name}".format_map(request_url_dict)
path = "{name}".format_map(request_url_dict)
else:
path = "datasets/{name}"
path = "{name}"

query_params = request_dict.get("_query")
if query_params:
Expand Down Expand Up @@ -2024,9 +2026,9 @@ async def _update_multimodal_dataset(
request_dict = _UpdateMultimodalDatasetParameters_to_vertex(parameter_model)
request_url_dict = request_dict.get("_url")
if request_url_dict:
path = "datasets/{name}".format_map(request_url_dict)
path = "{name}".format_map(request_url_dict)
else:
path = "datasets/{name}"
path = "{name}"

query_params = request_dict.get("_query")
if query_params:
Expand Down Expand Up @@ -2350,7 +2352,8 @@ async def get_multimodal_dataset(

Args:
name:
Required. name of a multimodal dataset.
Required. name of a multimodal dataset. The name should be in
the format of "projects/{project}/locations/{location}/datasets/{dataset}".
config:
Optional. A configuration for getting the multimodal dataset. If not
provided, the default configuration will be used.
Expand All @@ -2376,7 +2379,8 @@ async def delete_multimodal_dataset(

Args:
name:
Required. name of a multimodal dataset.
Required. name of a multimodal dataset. The name should be in
the format of "projects/{project}/locations/{location}/datasets/{dataset}".
config:
Optional. A configuration for deleting the multimodal dataset. If not
provided, the default configuration will be used.
Expand Down Expand Up @@ -2451,7 +2455,7 @@ async def assess_tuning_resources(
Args:
dataset_name:
Required. The name of the dataset to assess the tuning resources
for.
for. The name should be in the format of "projects/{project}/locations/{location}/datasets/{dataset}".
model_name:
Required. The name of the model to assess the tuning resources
for.
Expand Down Expand Up @@ -2507,7 +2511,7 @@ async def assess_tuning_validity(
Args:
dataset_name:
Required. The name of the dataset to assess the tuning validity
for.
for. The name should be in the format of "projects/{project}/locations/{location}/datasets/{dataset}".
model_name:
Required. The name of the model to assess the tuning validity
for.
Expand Down Expand Up @@ -2567,7 +2571,7 @@ async def assess_batch_prediction_resources(
Args:
dataset_name:
Required. The name of the dataset to assess the batch prediction
resources.
resources. The name should be in the format of "projects/{project}/locations/{location}/datasets/{dataset}".
model_name:
Required. The name of the model to assess the batch prediction
resources.
Expand Down Expand Up @@ -2628,7 +2632,7 @@ async def assess_batch_prediction_validity(
Args:
dataset_name:
Required. The name of the dataset to assess the batch prediction
validity for.
validity for. The name should be in the format of "projects/{project}/locations/{location}/datasets/{dataset}".
model_name:
Required. The name of the model to assess the batch prediction
validity for.
Expand Down
Loading