forked from apache/beam
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Docs] Beam website doc for vertex ai enrichment handler (apache#30692)
* add vetex ai page * update beam side docs for vertex ai enrichment * add links to release doc * update links, correct table formatting * Update website/www/site/content/en/documentation/transforms/python/elementwise/enrichment-bigtable.md Co-authored-by: Rebecca Szper <[email protected]> * Update website/www/site/content/en/documentation/transforms/python/elementwise/enrichment-vertexai.md Co-authored-by: Rebecca Szper <[email protected]> * Apply suggestions from code review Co-authored-by: Rebecca Szper <[email protected]> --------- Co-authored-by: Rebecca Szper <[email protected]>
- Loading branch information
1 parent
488d2a1
commit 4af19ff
Showing
7 changed files
with
275 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...e/content/en/documentation/transforms/python/elementwise/enrichment-bigtable.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
title: "Enrichment with Bigtable" | ||
--- | ||
<!-- | ||
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. | ||
--> | ||
|
||
# Use Bigtable to enrich data | ||
|
||
{{< localstorage language language-py >}} | ||
|
||
<table> | ||
<tr> | ||
<td> | ||
<a> | ||
{{< button-pydoc path="apache_beam.transforms.enrichment_handlers.bigtable" class="BigTableEnrichmentHandler" >}} | ||
</a> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
In Apache Beam 2.54.0 and later versions, the enrichment transform includes a built-in enrichment handler for [Bigtable](https://cloud.google.com/bigtable/docs/overview). | ||
The following example demonstrates how to create a pipeline that use the enrichment transform with the [`BigTableEnrichmentHandler`](https://beam.apache.org/releases/pydoc/current/apache_beam.transforms.enrichment_handlers.bigtable.html#apache_beam.transforms.enrichment_handlers.bigtable.BigTableEnrichmentHandler) handler. | ||
|
||
The data stored in the Bigtable cluster uses the following format: | ||
|
||
{{< table >}} | ||
| Row key | product:product_id | product:product_name | product:product_stock | | ||
|:-----------:|:--------------------:|:----------------------:|:-----------------------:| | ||
| 1 | 1 | pixel 5 | 2 | | ||
| 2 | 2 | pixel 6 | 4 | | ||
| 3 | 3 | pixel 7 | 20 | | ||
| 4 | 4 | pixel 8 | 10 | | ||
{{< /table >}} | ||
|
||
|
||
{{< highlight language="py" >}} | ||
{{< code_sample "sdks/python/apache_beam/examples/snippets/transforms/elementwise/enrichment.py" enrichment_with_bigtable >}} | ||
{{</ highlight >}} | ||
|
||
{{< paragraph class="notebook-skip" >}} | ||
Output: | ||
{{< /paragraph >}} | ||
{{< highlight class="notebook-skip" >}} | ||
{{< code_sample "sdks/python/apache_beam/examples/snippets/transforms/elementwise/enrichment_test.py" enrichment_with_bigtable >}} | ||
{{< /highlight >}} | ||
|
||
## Related transforms | ||
|
||
Not applicable. | ||
|
||
{{< button-pydoc path="apache_beam.transforms.enrichment_handlers.bigtable" class="BigTableEnrichmentHandler" >}} |
89 changes: 89 additions & 0 deletions
89
...e/content/en/documentation/transforms/python/elementwise/enrichment-vertexai.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
title: "Enrichment with Vertex AI Feature Store" | ||
--- | ||
<!-- | ||
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. | ||
--> | ||
|
||
# Enrichment with Google Cloud Vertex AI Feature Store | ||
|
||
{{< localstorage language language-py >}} | ||
|
||
<table> | ||
<tr> | ||
<td> | ||
<a> | ||
{{< button-pydoc path="apache_beam.transforms.enrichment_handlers.vertex_ai_feature_store" class="VertexAIFeatureStoreEnrichmentHandler" >}} | ||
</a> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
|
||
In Apache Beam 2.55.0 and later versions, the enrichment transform includes a built-in enrichment handler for [Vertex AI Feature Store](https://cloud.google.com/vertex-ai/docs/featurestore). | ||
The following example demonstrates how to create a pipeline that use the enrichment transform with the [`VertexAIFeatureStoreEnrichmentHandler`](https://beam.apache.org/releases/pydoc/current/apache_beam.transforms.enrichment_handlers.vertex_ai_feature_store.html#apache_beam.transforms.enrichment_handlers.vertex_ai_feature_store.VertexAIFeatureStoreEnrichmentHandler) handler and the [`VertexAIFeatureStoreLegacyEnrichmentHandler`](https://beam.apache.org/releases/pydoc/current/apache_beam.transforms.enrichment_handlers.vertex_ai_feature_store.html#apache_beam.transforms.enrichment_handlers.vertex_ai_feature_store.VertexAIFeatureStoreLegacyEnrichmentHandler) handler. | ||
|
||
## Example 1: Enrichment with Vertex AI Feature Store | ||
|
||
The precomputed feature values stored in Vertex AI Feature Store uses the following format: | ||
|
||
{{< table >}} | ||
| user_id | age | gender | state | country | | ||
|:--------:|:----:|:-------:|:-----:|:-------:| | ||
| 21422 | 12 | 0 | 0 | 0 | | ||
| 2963 | 12 | 1 | 1 | 1 | | ||
| 20592 | 12 | 1 | 2 | 2 | | ||
| 76538 | 12 | 1 | 3 | 0 | | ||
{{< /table >}} | ||
|
||
|
||
{{< highlight language="py" >}} | ||
{{< code_sample "sdks/python/apache_beam/examples/snippets/transforms/elementwise/enrichment.py" enrichment_with_vertex_ai >}} | ||
{{</ highlight >}} | ||
|
||
{{< paragraph class="notebook-skip" >}} | ||
Output: | ||
{{< /paragraph >}} | ||
{{< highlight class="notebook-skip" >}} | ||
{{< code_sample "sdks/python/apache_beam/examples/snippets/transforms/elementwise/enrichment_test.py" enrichment_with_vertex_ai >}} | ||
{{< /highlight >}} | ||
|
||
## Example 2: Enrichment with Vertex AI Feature Store (legacy) | ||
|
||
The precomputed feature values stored in Vertex AI Feature Store (Legacy) use the following format: | ||
|
||
{{< table >}} | ||
| entity_id | title | genres | | ||
|:----------|:-------------------------|:--------| | ||
| movie_01 | The Shawshank Redemption | Drama | | ||
| movie_02 | The Shining | Horror | | ||
| movie_04 | The Dark Knight | Action | | ||
{{< /table >}} | ||
|
||
{{< highlight language="py" >}} | ||
{{< code_sample "sdks/python/apache_beam/examples/snippets/transforms/elementwise/enrichment.py" enrichment_with_vertex_ai_legacy >}} | ||
{{</ highlight >}} | ||
|
||
{{< paragraph class="notebook-skip" >}} | ||
Output: | ||
{{< /paragraph >}} | ||
{{< highlight class="notebook-skip" >}} | ||
{{< code_sample "sdks/python/apache_beam/examples/snippets/transforms/elementwise/enrichment_test.py" enrichment_with_vertex_ai_legacy >}} | ||
{{< /highlight >}} | ||
|
||
|
||
## Related transforms | ||
|
||
Not applicable. | ||
|
||
{{< button-pydoc path="apache_beam.transforms.enrichment_handlers.vertex_ai_feature_store" class="VertexAIFeatureStoreEnrichmentHandler" >}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters