blob: df92abd41543d95ab65a497b0b7c3e10e3b32f54 [file] [log] [blame]
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>apache_beam.yaml.yaml_ml module &mdash; Apache Beam 2.67.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b86133f3" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=959b4fbe"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="apache_beam.yaml.yaml_provider module" href="apache_beam.yaml.yaml_provider.html" />
<link rel="prev" title="apache_beam.yaml.yaml_mapping module" href="apache_beam.yaml.yaml_mapping.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
Apache Beam
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="apache_beam.coders.html">apache_beam.coders package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.dataframe.html">apache_beam.dataframe package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.io.html">apache_beam.io package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.metrics.html">apache_beam.metrics package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.ml.html">apache_beam.ml package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.options.html">apache_beam.options package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.portability.html">apache_beam.portability package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.runners.html">apache_beam.runners package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.testing.html">apache_beam.testing package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.transforms.html">apache_beam.transforms package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.typehints.html">apache_beam.typehints package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.utils.html">apache_beam.utils package</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="apache_beam.yaml.html">apache_beam.yaml package</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="apache_beam.yaml.html#subpackages">Subpackages</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="apache_beam.yaml.html#submodules">Submodules</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.cache_provider_artifacts.html">apache_beam.yaml.cache_provider_artifacts module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.conftest.html">apache_beam.yaml.conftest module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.generate_yaml_docs.html">apache_beam.yaml.generate_yaml_docs module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.json_utils.html">apache_beam.yaml.json_utils module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.main.html">apache_beam.yaml.main module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.options.html">apache_beam.yaml.options module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.yaml_combine.html">apache_beam.yaml.yaml_combine module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.yaml_enrichment.html">apache_beam.yaml.yaml_enrichment module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.yaml_errors.html">apache_beam.yaml.yaml_errors module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.yaml_io.html">apache_beam.yaml.yaml_io module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.yaml_join.html">apache_beam.yaml.yaml_join module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.yaml_mapping.html">apache_beam.yaml.yaml_mapping module</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">apache_beam.yaml.yaml_ml module</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider"><code class="docutils literal notranslate"><span class="pre">ModelHandlerProvider</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.yaml.yaml_ml.VertexAIModelHandlerJSONProvider"><code class="docutils literal notranslate"><span class="pre">VertexAIModelHandlerJSONProvider</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.yaml.yaml_ml.get_user_schema_fields"><code class="docutils literal notranslate"><span class="pre">get_user_schema_fields()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.yaml.yaml_ml.run_inference"><code class="docutils literal notranslate"><span class="pre">run_inference()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.yaml.yaml_ml.ml_transform"><code class="docutils literal notranslate"><span class="pre">ml_transform()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.yaml_provider.html">apache_beam.yaml.yaml_provider module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.yaml_specifiable.html">apache_beam.yaml.yaml_specifiable module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.yaml_testing.html">apache_beam.yaml.yaml_testing module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.yaml_transform.html">apache_beam.yaml.yaml_transform module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.yaml.yaml_utils.html">apache_beam.yaml.yaml_utils module</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.error.html">apache_beam.error module</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.pipeline.html">apache_beam.pipeline module</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.pvalue.html">apache_beam.pvalue module</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Apache Beam</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="apache_beam.yaml.html">apache_beam.yaml package</a></li>
<li class="breadcrumb-item active">apache_beam.yaml.yaml_ml module</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/apache_beam.yaml.yaml_ml.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-apache_beam.yaml.yaml_ml">
<span id="apache-beam-yaml-yaml-ml-module"></span><h1>apache_beam.yaml.yaml_ml module<a class="headerlink" href="#module-apache_beam.yaml.yaml_ml" title="Link to this heading"></a></h1>
<p>This module defines yaml wrappings for some ML transforms.</p>
<dl class="py class">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.ModelHandlerProvider">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.yaml.yaml_ml.</span></span><span class="sig-name descname"><span class="pre">ModelHandlerProvider</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">handler</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">preprocess</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><span class="pre">dict</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">postprocess</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><span class="pre">dict</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#ModelHandlerProvider"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<dl class="py attribute">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.ModelHandlerProvider.handler_types">
<span class="sig-name descname"><span class="pre">handler_types</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><span class="pre">dict</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable" title="(in Python v3.13)"><span class="pre">Callable</span></a><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">...</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider" title="apache_beam.yaml.yaml_ml.ModelHandlerProvider"><span class="pre">ModelHandlerProvider</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></em><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">{'VertexAIModelHandlerJSON':</span> <span class="pre">&lt;class</span> <span class="pre">'apache_beam.yaml.yaml_ml.VertexAIModelHandlerJSONProvider'&gt;}</span></em><a class="headerlink" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider.handler_types" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.ModelHandlerProvider.inference_output_type">
<span class="sig-name descname"><span class="pre">inference_output_type</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#ModelHandlerProvider.inference_output_type"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider.inference_output_type" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.ModelHandlerProvider.parse_processing_transform">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">parse_processing_transform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">processing_transform</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">typ</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#ModelHandlerProvider.parse_processing_transform"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider.parse_processing_transform" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.ModelHandlerProvider.underlying_handler">
<span class="sig-name descname"><span class="pre">underlying_handler</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#ModelHandlerProvider.underlying_handler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider.underlying_handler" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.ModelHandlerProvider.default_preprocess_fn">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">default_preprocess_fn</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#ModelHandlerProvider.default_preprocess_fn"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider.default_preprocess_fn" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.ModelHandlerProvider.default_postprocess_fn">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">default_postprocess_fn</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#ModelHandlerProvider.default_postprocess_fn"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider.default_postprocess_fn" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.ModelHandlerProvider.validate">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">validate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">model_handler_spec</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#ModelHandlerProvider.validate"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider.validate" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.ModelHandlerProvider.register_handler_type">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">register_handler_type</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">type_name</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#ModelHandlerProvider.register_handler_type"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider.register_handler_type" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.ModelHandlerProvider.create_handler">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">create_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">model_handler_spec</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider" title="apache_beam.yaml.yaml_ml.ModelHandlerProvider"><span class="pre">ModelHandlerProvider</span></a></span></span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#ModelHandlerProvider.create_handler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider.create_handler" title="Link to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.VertexAIModelHandlerJSONProvider">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.yaml.yaml_ml.</span></span><span class="sig-name descname"><span class="pre">VertexAIModelHandlerJSONProvider</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">endpoint_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">project</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">location</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">preprocess</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><span class="pre">dict</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">postprocess</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><span class="pre">dict</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">experiment</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">network</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">private</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><span class="pre">bool</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_batch_size</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><span class="pre">int</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_batch_size</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><span class="pre">int</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_batch_duration_secs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><span class="pre">int</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#VertexAIModelHandlerJSONProvider"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.VertexAIModelHandlerJSONProvider" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#apache_beam.yaml.yaml_ml.ModelHandlerProvider" title="apache_beam.yaml.yaml_ml.ModelHandlerProvider"><code class="xref py py-class docutils literal notranslate"><span class="pre">ModelHandlerProvider</span></code></a></p>
<p>ModelHandler for Vertex AI.</p>
<p>This Model Handler can be used with RunInference to load a model hosted
on VertexAI. Every model that is hosted on VertexAI should have three
distinct, required, parameters - <cite>endpoint_id</cite>, <cite>project</cite> and <cite>location</cite>.
These parameters tell the Model Handler how to access the model’s endpoint
so that input data can be sent using an API request, and inferences can be
received as a response.</p>
<p>This Model Handler also requires a <cite>preprocess</cite> function to be defined.
Preprocessing and Postprocessing are described in more detail in the
RunInference docs:
<a class="reference external" href="https://beam.apache.org/releases/yamldoc/current/#runinference">https://beam.apache.org/releases/yamldoc/current/#runinference</a></p>
<p>Every model will have a unique input, but all requests should be
JSON-formatted. For example, most language models such as Llama and Gemma
expect a JSON with the key “prompt” (among other optional keys). In Python,
JSON can be expressed as a dictionary.</p>
<p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">-</span> <span class="nb">type</span><span class="p">:</span> <span class="n">RunInference</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">inference_tag</span><span class="p">:</span> <span class="s1">&#39;my_inference&#39;</span>
<span class="n">model_handler</span><span class="p">:</span>
<span class="nb">type</span><span class="p">:</span> <span class="n">VertexAIModelHandlerJSON</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">endpoint_id</span><span class="p">:</span> <span class="mi">9876543210</span>
<span class="n">project</span><span class="p">:</span> <span class="n">my</span><span class="o">-</span><span class="n">project</span>
<span class="n">location</span><span class="p">:</span> <span class="n">us</span><span class="o">-</span><span class="n">east1</span>
<span class="n">preprocess</span><span class="p">:</span>
<span class="nb">callable</span><span class="p">:</span> <span class="s1">&#39;lambda x: {&quot;prompt&quot;: x.prompt, &quot;max_tokens&quot;: 50}&#39;</span>
</pre></div>
</div>
<p>In the above example, which mimics a call to a Llama 3 model hosted on
VertexAI, the preprocess function (in this case a lambda) takes in a Beam
Row with a single field, “prompt”, and maps it to a dict with the same
field. It also specifies an optional parameter, “max_tokens”, that tells the
model the allowed token size (in this case input + output token size).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>endpoint_id</strong> – the numerical ID of the Vertex AI endpoint to query.</p></li>
<li><p><strong>project</strong> – the GCP project name where the endpoint is deployed.</p></li>
<li><p><strong>location</strong> – the GCP location where the endpoint is deployed.</p></li>
<li><p><strong>preprocess</strong> – A python callable, defined either inline, or using a file,
that is invoked on the input row before sending to the model to be
loaded by this ModelHandler. This parameter is required by the
<cite>VertexAIModelHandlerJSON</cite> ModelHandler.</p></li>
<li><p><strong>postprocess</strong> – A python callable, defined either inline, or using a file,
that is invoked on the PredictionResult output by the ModelHandler
before parsing into the output Beam Row under the field name defined
by the inference_tag.</p></li>
<li><p><strong>experiment</strong> – Experiment label to apply to the
queries. See
<a class="reference external" href="https://cloud.google.com/vertex-ai/docs/experiments/intro-vertex-ai-experiments">https://cloud.google.com/vertex-ai/docs/experiments/intro-vertex-ai-experiments</a>
for more information.</p></li>
<li><p><strong>network</strong> – The full name of the Compute Engine
network the endpoint is deployed on; used for private
endpoints. The network or subnetwork Dataflow pipeline
option must be set and match this network for pipeline
execution.
Ex: “projects/12345/global/networks/myVPC”</p></li>
<li><p><strong>private</strong> – If the deployed Vertex AI endpoint is
private, set to true. Requires a network to be provided
as well.</p></li>
<li><p><strong>min_batch_size</strong> – The minimum batch size to use when batching
inputs.</p></li>
<li><p><strong>max_batch_size</strong> – The maximum batch size to use when batching
inputs.</p></li>
<li><p><strong>max_batch_duration_secs</strong> – The maximum amount of time to buffer
a batch before emitting; used in streaming contexts.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.VertexAIModelHandlerJSONProvider.validate">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">validate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">model_handler_spec</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#VertexAIModelHandlerJSONProvider.validate"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.VertexAIModelHandlerJSONProvider.validate" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.VertexAIModelHandlerJSONProvider.inference_output_type">
<span class="sig-name descname"><span class="pre">inference_output_type</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#VertexAIModelHandlerJSONProvider.inference_output_type"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.VertexAIModelHandlerJSONProvider.inference_output_type" title="Link to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.get_user_schema_fields">
<span class="sig-prename descclassname"><span class="pre">apache_beam.yaml.yaml_ml.</span></span><span class="sig-name descname"><span class="pre">get_user_schema_fields</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">user_type</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#get_user_schema_fields"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.get_user_schema_fields" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.run_inference">
<span class="sig-prename descclassname"><span class="pre">apache_beam.yaml.yaml_ml.</span></span><span class="sig-name descname"><span class="pre">run_inference</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">model_handler</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><span class="pre">dict</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.13)"><span class="pre">Any</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inference_tag</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'inference'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inference_args</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><span class="pre">dict</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.13)"><span class="pre">Any</span></a><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="apache_beam.pvalue.html#apache_beam.pvalue.PCollection" title="apache_beam.pvalue.PCollection"><span class="pre">PCollection</span></a><span class="p"><span class="pre">[</span></span><a class="reference internal" href="apache_beam.pvalue.html#apache_beam.pvalue.Row" title="apache_beam.pvalue.Row"><span class="pre">Row</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#run_inference"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.run_inference" title="Link to this definition"></a></dt>
<dd><p>A transform that takes the input rows, containing examples (or features), for
use on an ML model. The transform then appends the inferences
(or predictions) for those examples to the input row.</p>
<p>A ModelHandler must be passed to the <cite>model_handler</cite> parameter. The
ModelHandler is responsible for configuring how the ML model will be loaded
and how input data will be passed to it. Every ModelHandler has a config tag,
similar to how a transform is defined, where the parameters are defined.</p>
<p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">-</span> <span class="nb">type</span><span class="p">:</span> <span class="n">RunInference</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">model_handler</span><span class="p">:</span>
<span class="nb">type</span><span class="p">:</span> <span class="n">ModelHandler</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">param_1</span><span class="p">:</span> <span class="n">arg1</span>
<span class="n">param_2</span><span class="p">:</span> <span class="n">arg2</span>
<span class="o">...</span>
</pre></div>
</div>
<p>By default, the RunInference transform will return the
input row with a single field appended named by the <cite>inference_tag</cite> parameter
(“inference” by default) that contains the inference directly returned by the
underlying ModelHandler, after any optional postprocessing.</p>
<p>For example, if the input had the following:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Row</span><span class="p">(</span><span class="n">question</span><span class="o">=</span><span class="s2">&quot;What is a car?&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>The output row would look like:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Row</span><span class="p">(</span><span class="n">question</span><span class="o">=</span><span class="s2">&quot;What is a car?&quot;</span><span class="p">,</span> <span class="n">inference</span><span class="o">=...</span><span class="p">)</span>
</pre></div>
</div>
<p>where the <cite>inference</cite> tag can be overridden with the <cite>inference_tag</cite>
parameter.</p>
<p>However, if one specified the following transform config:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">-</span> <span class="nb">type</span><span class="p">:</span> <span class="n">RunInference</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">inference_tag</span><span class="p">:</span> <span class="n">my_inference</span>
<span class="n">model_handler</span><span class="p">:</span> <span class="o">...</span>
</pre></div>
</div>
<p>The output row would look like:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Row</span><span class="p">(</span><span class="n">question</span><span class="o">=</span><span class="s2">&quot;What is a car?&quot;</span><span class="p">,</span> <span class="n">my_inference</span><span class="o">=...</span><span class="p">)</span>
</pre></div>
</div>
<p>See more complete documentation on the underlying
[RunInference](<a class="reference external" href="https://beam.apache.org/documentation/ml/inference-overview/">https://beam.apache.org/documentation/ml/inference-overview/</a>)
transform.</p>
<p>### Preprocessing input data</p>
<p>In most cases, the model will be expecting data in a particular data format,
whether it be a Python Dict, PyTorch tensor, etc. However, the outputs of all
built-in Beam YAML transforms are Beam Rows. To allow for transforming
the Beam Row into a data format the model recognizes, each ModelHandler is
equipped with a <cite>preprocessing</cite> parameter for performing necessary data
preprocessing. It is possible for a ModelHandler to define a default
preprocessing function, but in most cases, one will need to be specified by
the caller.</p>
<p>For example, using <cite>callable</cite>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pipeline</span><span class="p">:</span>
<span class="nb">type</span><span class="p">:</span> <span class="n">chain</span>
<span class="n">transforms</span><span class="p">:</span>
<span class="o">-</span> <span class="nb">type</span><span class="p">:</span> <span class="n">Create</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">elements</span><span class="p">:</span>
<span class="o">-</span> <span class="n">question</span><span class="p">:</span> <span class="s2">&quot;What is a car?&quot;</span>
<span class="o">-</span> <span class="n">question</span><span class="p">:</span> <span class="s2">&quot;Where is the Eiffel Tower located?&quot;</span>
<span class="o">-</span> <span class="nb">type</span><span class="p">:</span> <span class="n">RunInference</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">model_handler</span><span class="p">:</span>
<span class="nb">type</span><span class="p">:</span> <span class="n">ModelHandler</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">param_1</span><span class="p">:</span> <span class="n">arg1</span>
<span class="n">param_2</span><span class="p">:</span> <span class="n">arg2</span>
<span class="n">preprocess</span><span class="p">:</span>
<span class="nb">callable</span><span class="p">:</span> <span class="s1">&#39;lambda row: {&quot;prompt&quot;: row.question}&#39;</span>
<span class="o">...</span>
</pre></div>
</div>
<p>In the above example, the Create transform generates a collection of two Beam
Row elements, each with a single field - “question”. The model, however,
expects a Python Dict with a single key, “prompt”. In this case, we can
specify a simple Lambda function (alternatively could define a full function),
to map the data.</p>
<p>### Postprocessing predictions</p>
<p>It is also possible to define a postprocessing function to postprocess the
data output by the ModelHandler. See the documentation for the ModelHandler
you intend to use (list defined below under <cite>model_handler</cite> parameter doc).</p>
<p>In many cases, before postprocessing, the object
will be a
[PredictionResult](<a class="reference external" href="https://beam.apache.org/releases/pydoc/BEAM_VERSION/apache_beam.ml.inference.base.html#apache_beam.ml.inference.base.PredictionResult">https://beam.apache.org/releases/pydoc/BEAM_VERSION/apache_beam.ml.inference.base.html#apache_beam.ml.inference.base.PredictionResult</a>). # pylint: disable=line-too-long
This type behaves very similarly to a Beam Row and fields can be accessed
using dot notation. However, make sure to check the docs for your ModelHandler
to see which fields its PredictionResult contains or if it returns a
different object altogether.</p>
<p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">-</span> <span class="nb">type</span><span class="p">:</span> <span class="n">RunInference</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">model_handler</span><span class="p">:</span>
<span class="nb">type</span><span class="p">:</span> <span class="n">ModelHandler</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">param_1</span><span class="p">:</span> <span class="n">arg1</span>
<span class="n">param_2</span><span class="p">:</span> <span class="n">arg2</span>
<span class="n">postprocess</span><span class="p">:</span>
<span class="nb">callable</span><span class="p">:</span> <span class="o">|</span>
<span class="k">def</span><span class="w"> </span><span class="nf">fn</span><span class="p">(</span><span class="n">x</span><span class="p">:</span> <span class="n">PredictionResult</span><span class="p">):</span>
<span class="k">return</span> <span class="n">beam</span><span class="o">.</span><span class="n">Row</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">example</span><span class="p">,</span> <span class="n">x</span><span class="o">.</span><span class="n">inference</span><span class="p">,</span> <span class="n">x</span><span class="o">.</span><span class="n">model_id</span><span class="p">)</span>
<span class="o">...</span>
</pre></div>
</div>
<p>The above example demonstrates converting the original output data type (in
this case it is PredictionResult), and converts to a Beam Row, which allows
for easier mapping in a later transform.</p>
<p>### File-based pre/postprocessing functions</p>
<p>For both preprocessing and postprocessing, it is also possible to specify a
Python UDF (User-defined function) file that contains the function. This is
possible by specifying the <cite>path</cite> to the file (local file or GCS path) and
the <cite>name</cite> of the function in the file.</p>
<p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">-</span> <span class="nb">type</span><span class="p">:</span> <span class="n">RunInference</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">model_handler</span><span class="p">:</span>
<span class="nb">type</span><span class="p">:</span> <span class="n">ModelHandler</span>
<span class="n">config</span><span class="p">:</span>
<span class="n">param_1</span><span class="p">:</span> <span class="n">arg1</span>
<span class="n">param_2</span><span class="p">:</span> <span class="n">arg2</span>
<span class="n">preprocess</span><span class="p">:</span>
<span class="n">path</span><span class="p">:</span> <span class="n">gs</span><span class="p">:</span><span class="o">//</span><span class="n">my</span><span class="o">-</span><span class="n">bucket</span><span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">preprocess</span><span class="o">.</span><span class="n">py</span>
<span class="n">name</span><span class="p">:</span> <span class="n">my_preprocess_fn</span>
<span class="n">postprocess</span><span class="p">:</span>
<span class="n">path</span><span class="p">:</span> <span class="n">gs</span><span class="p">:</span><span class="o">//</span><span class="n">my</span><span class="o">-</span><span class="n">bucket</span><span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">postprocess</span><span class="o">.</span><span class="n">py</span>
<span class="n">name</span><span class="p">:</span> <span class="n">my_postprocess_fn</span>
<span class="o">...</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>model_handler</strong><p>Specifies the parameters for the respective
enrichment_handler in a YAML/JSON format. To see the full set of
handler_config parameters, see their corresponding doc pages:</p>
<blockquote>
<div><ul>
<li><p>[VertexAIModelHandlerJSON](<a class="reference external" href="https://beam.apache.org/releases/pydoc/current/apache_beam.yaml.yaml_ml.VertexAIModelHandlerJSONProvider">https://beam.apache.org/releases/pydoc/current/apache_beam.yaml.yaml_ml.VertexAIModelHandlerJSONProvider</a>) # pylint: disable=line-too-long</p></li>
</ul>
</div></blockquote>
</p></li>
<li><p><strong>inference_tag</strong> – The tag to use for the returned inference. Default is
‘inference’.</p></li>
<li><p><strong>inference_args</strong> – Extra arguments for models whose inference call requires
extra parameters. Make sure to check the underlying ModelHandler docs to
see which args are allowed.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.yaml.yaml_ml.ml_transform">
<span class="sig-prename descclassname"><span class="pre">apache_beam.yaml.yaml_ml.</span></span><span class="sig-name descname"><span class="pre">ml_transform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">write_artifact_location</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">read_artifact_location</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">transforms</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.13)"><span class="pre">list</span></a><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Any" title="(in Python v3.13)"><span class="pre">Any</span></a><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/yaml/yaml_ml.html#ml_transform"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.yaml.yaml_ml.ml_transform" title="Link to this definition"></a></dt>
<dd></dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="apache_beam.yaml.yaml_mapping.html" class="btn btn-neutral float-left" title="apache_beam.yaml.yaml_mapping module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="apache_beam.yaml.yaml_provider.html" class="btn btn-neutral float-right" title="apache_beam.yaml.yaml_provider module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright %Y, Apache Beam.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>