|
134 | 134 | "metadata": {}, |
135 | 135 | "outputs": [], |
136 | 136 | "source": [ |
137 | | - "import bigframes.operations as ops\n", |
| 137 | + "import bigframes.bigquery as bbq\n", |
138 | 138 | "\n", |
139 | 139 | "def get_runtime_json_str(series, mode=\"R\", with_metadata=False):\n", |
140 | 140 | " \"\"\"\n", |
|
148 | 148 | " \"\"\"\n", |
149 | 149 | " # 1. Optionally fetch metadata\n", |
150 | 150 | " s = (\n", |
151 | | - " series._apply_unary_op(ops.obj_fetch_metadata_op)\n", |
| 151 | + " bbq.obj.fetch_metadata(series)\n", |
152 | 152 | " if with_metadata\n", |
153 | 153 | " else series\n", |
154 | 154 | " )\n", |
155 | 155 | " \n", |
156 | 156 | " # 2. Retrieve the access URL runtime object\n", |
157 | | - " runtime = s._apply_unary_op(ops.ObjGetAccessUrl(mode=mode))\n", |
| 157 | + " runtime = bbq.obj.get_access_url(s, mode=mode)\n", |
158 | 158 | " \n", |
159 | 159 | " # 3. Convert the runtime object to a JSON string\n", |
160 | | - " return runtime._apply_unary_op(ops.ToJSONString())" |
| 160 | + " return bbq.to_json_string(runtime)" |
161 | 161 | ] |
162 | 162 | }, |
163 | 163 | { |
|
1536 | 1536 | ], |
1537 | 1537 | "source": [ |
1538 | 1538 | "import bigframes.bigquery as bbq\n", |
1539 | | - "import bigframes.operations as ops\n", |
1540 | 1539 | "\n", |
1541 | 1540 | "# The audio_transcribe function is a convenience wrapper around bigframes.bigquery.ai.generate.\n", |
1542 | 1541 | "# Here's how to perform the same operation directly:\n", |
|
1551 | 1550 | "\n", |
1552 | 1551 | "# Convert the audio series to the runtime representation required by the model.\n", |
1553 | 1552 | "# This involves fetching metadata and getting a signed access URL.\n", |
1554 | | - "audio_metadata = audio_series._apply_unary_op(ops.obj_fetch_metadata_op)\n", |
1555 | | - "audio_runtime = audio_metadata._apply_unary_op(ops.ObjGetAccessUrl(mode=\"R\"))\n", |
| 1553 | + "audio_metadata = bbq.obj.fetch_metadata(audio_series)\n", |
| 1554 | + "audio_runtime = bbq.obj.get_access_url(audio_metadata, mode=\"R\")\n", |
1556 | 1555 | "\n", |
1557 | 1556 | "transcribed_results = bbq.ai.generate(\n", |
1558 | 1557 | " prompt=(prompt_text, audio_runtime),\n", |
|
0 commit comments