|
16 | 16 | "cell_type": "markdown",
|
17 | 17 | "metadata": {},
|
18 | 18 | "source": [
|
19 |
| - "## Prerequisites\n", |
20 |
| - "Create session and define a BQ connection which we already created and allowlisted. " |
| 19 | + "## Define the model" |
21 | 20 | ]
|
22 | 21 | },
|
23 | 22 | {
|
|
29 | 28 | "name": "stderr",
|
30 | 29 | "output_type": "stream",
|
31 | 30 | "text": [
|
32 |
| - "/usr/local/google/home/garrettwu/src/bigframes/bigframes/session/__init__.py:1762: UserWarning: No explicit location is set, so using location US for the session.\n", |
33 |
| - " return Session(context)\n" |
| 31 | + "/usr/local/google/home/garrettwu/src/bigframes/bigframes/ml/llm.py:589: DefaultLocationWarning: No explicit location is set, so using location US for the session.\n", |
| 32 | + " self.session = session or bpd.get_global_session()\n" |
34 | 33 | ]
|
35 |
| - } |
36 |
| - ], |
37 |
| - "source": [ |
38 |
| - "session = bigframes.pandas.get_global_session()\n", |
39 |
| - "connection = f\"{session.bqclient.project}.us.bigframes-default-connection\"" |
40 |
| - ] |
41 |
| - }, |
42 |
| - { |
43 |
| - "attachments": {}, |
44 |
| - "cell_type": "markdown", |
45 |
| - "metadata": {}, |
46 |
| - "source": [ |
47 |
| - "## Define the model" |
48 |
| - ] |
49 |
| - }, |
50 |
| - { |
51 |
| - "cell_type": "code", |
52 |
| - "execution_count": 3, |
53 |
| - "metadata": {}, |
54 |
| - "outputs": [ |
| 34 | + }, |
55 | 35 | {
|
56 | 36 | "data": {
|
57 | 37 | "text/html": [
|
58 |
| - "Query job 12bcd690-ca99-4001-bf26-032f50e77d62 is DONE. 0 Bytes processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:12bcd690-ca99-4001-bf26-032f50e77d62&page=queryresults\">Open Job</a>" |
| 38 | + "Query job 675a6c8a-213b-496c-9f77-b87bf7cfa5e0 is DONE. 0 Bytes processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:675a6c8a-213b-496c-9f77-b87bf7cfa5e0&page=queryresults\">Open Job</a>" |
59 | 39 | ],
|
60 | 40 | "text/plain": [
|
61 | 41 | "<IPython.core.display.HTML object>"
|
|
66 | 46 | }
|
67 | 47 | ],
|
68 | 48 | "source": [
|
69 |
| - "model = GeminiTextGenerator(session=session, connection_name=connection)" |
| 49 | + "model = GeminiTextGenerator()" |
70 | 50 | ]
|
71 | 51 | },
|
72 | 52 | {
|
|
81 | 61 | },
|
82 | 62 | {
|
83 | 63 | "cell_type": "code",
|
84 |
| - "execution_count": 4, |
| 64 | + "execution_count": 3, |
85 | 65 | "metadata": {},
|
86 | 66 | "outputs": [],
|
87 | 67 | "source": [
|
|
102 | 82 | },
|
103 | 83 | {
|
104 | 84 | "cell_type": "code",
|
105 |
| - "execution_count": 5, |
| 85 | + "execution_count": 4, |
106 | 86 | "metadata": {},
|
107 | 87 | "outputs": [
|
108 | 88 | {
|
109 | 89 | "data": {
|
110 | 90 | "text/html": [
|
111 |
| - "Query job f8fe31c6-7d8a-4919-9492-8304a0083cca is DONE. 0 Bytes processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:f8fe31c6-7d8a-4919-9492-8304a0083cca&page=queryresults\">Open Job</a>" |
| 91 | + "Query job 7967df2b-9f0f-45c8-a363-15f65891c3bf is DONE. 0 Bytes processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:7967df2b-9f0f-45c8-a363-15f65891c3bf&page=queryresults\">Open Job</a>" |
112 | 92 | ],
|
113 | 93 | "text/plain": [
|
114 | 94 | "<IPython.core.display.HTML object>"
|
|
118 | 98 | "output_type": "display_data"
|
119 | 99 | },
|
120 | 100 | {
|
121 |
| - "data": { |
122 |
| - "text/html": [ |
123 |
| - "Query job 28bab71f-e218-4d92-9a50-dab41bb0c71f is DONE. 24 Bytes processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:28bab71f-e218-4d92-9a50-dab41bb0c71f&page=queryresults\">Open Job</a>" |
124 |
| - ], |
125 |
| - "text/plain": [ |
126 |
| - "<IPython.core.display.HTML object>" |
127 |
| - ] |
128 |
| - }, |
129 |
| - "metadata": {}, |
130 |
| - "output_type": "display_data" |
| 101 | + "name": "stderr", |
| 102 | + "output_type": "stream", |
| 103 | + "text": [ |
| 104 | + "/usr/local/google/home/garrettwu/src/bigframes/bigframes/core/__init__.py:108: PreviewWarning: Interpreting JSON column(s) as StringDtype. This behavior may change in future versions.\n", |
| 105 | + " warnings.warn(\n" |
| 106 | + ] |
131 | 107 | },
|
132 | 108 | {
|
133 | 109 | "data": {
|
134 | 110 | "text/html": [
|
135 |
| - "Query job 01d66b61-459f-474e-9f66-d519f9c2f23d is DONE. 6 Bytes processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:01d66b61-459f-474e-9f66-d519f9c2f23d&page=queryresults\">Open Job</a>" |
| 111 | + "Query job 9a1f57cd-98e1-4eac-a1b3-8f88d61971cd is DONE. 6 Bytes processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:9a1f57cd-98e1-4eac-a1b3-8f88d61971cd&page=queryresults\">Open Job</a>" |
136 | 112 | ],
|
137 | 113 | "text/plain": [
|
138 | 114 | "<IPython.core.display.HTML object>"
|
|
144 | 120 | {
|
145 | 121 | "data": {
|
146 | 122 | "text/html": [
|
147 |
| - "Query job af606ca7-4bcf-4bd1-95fd-c516542b5a4f is DONE. 5.3 kB processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:af606ca7-4bcf-4bd1-95fd-c516542b5a4f&page=queryresults\">Open Job</a>" |
| 123 | + "Query job 2a94a2cf-7d4c-4009-a798-d7a5d6d4049d is DONE. 8.5 kB processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:2a94a2cf-7d4c-4009-a798-d7a5d6d4049d&page=queryresults\">Open Job</a>" |
148 | 124 | ],
|
149 | 125 | "text/plain": [
|
150 | 126 | "<IPython.core.display.HTML object>"
|
|
183 | 159 | " <tbody>\n",
|
184 | 160 | " <tr>\n",
|
185 | 161 | " <th>0</th>\n",
|
186 |
| - " <td>**BigQuery**\n", |
| 162 | + " <td>## BigQuery: A Serverless Data Warehouse\n", |
187 | 163 | "\n",
|
188 |
| - "**Definition:**\n", |
189 |
| - "\n", |
190 |
| - "BigQuery is a s...</td>\n", |
191 |
| - " <td>null</td>\n", |
| 164 | + "BigQ...</td>\n", |
| 165 | + " <td>[{\"category\":1,\"probability\":1,\"probability_sc...</td>\n", |
192 | 166 | " <td></td>\n",
|
193 | 167 | " <td>What is BigQuery?</td>\n",
|
194 | 168 | " </tr>\n",
|
195 | 169 | " <tr>\n",
|
196 | 170 | " <th>1</th>\n",
|
197 |
| - " <td>**BigQuery Machine Learning (BQML)**\n", |
| 171 | + " <td>## BigQuery Machine Learning (BQML)\n", |
198 | 172 | "\n",
|
199 |
| - "BQML is ...</td>\n", |
200 |
| - " <td>null</td>\n", |
| 173 | + "BQML is a...</td>\n", |
| 174 | + " <td>[{\"category\":1,\"probability\":1,\"probability_sc...</td>\n", |
201 | 175 | " <td></td>\n",
|
202 | 176 | " <td>What is BQML?</td>\n",
|
203 | 177 | " </tr>\n",
|
204 | 178 | " <tr>\n",
|
205 | 179 | " <th>2</th>\n",
|
206 |
| - " <td>BigQuery DataFrame is a Python DataFrame imple...</td>\n", |
207 |
| - " <td>null</td>\n", |
| 180 | + " <td>## What is BigQuery DataFrame?\n", |
| 181 | + "\n", |
| 182 | + "**BigQuery Dat...</td>\n", |
| 183 | + " <td>[{\"category\":1,\"probability\":1,\"probability_sc...</td>\n", |
208 | 184 | " <td></td>\n",
|
209 | 185 | " <td>What is BigQuery DataFrame?</td>\n",
|
210 | 186 | " </tr>\n",
|
|
214 | 190 | ],
|
215 | 191 | "text/plain": [
|
216 | 192 | " ml_generate_text_llm_result \\\n",
|
217 |
| - "0 **BigQuery**\n", |
| 193 | + "0 ## BigQuery: A Serverless Data Warehouse\n", |
218 | 194 | "\n",
|
219 |
| - "**Definition:**\n", |
| 195 | + "BigQ... \n", |
| 196 | + "1 ## BigQuery Machine Learning (BQML)\n", |
220 | 197 | "\n",
|
221 |
| - "BigQuery is a s... \n", |
222 |
| - "1 **BigQuery Machine Learning (BQML)**\n", |
| 198 | + "BQML is a... \n", |
| 199 | + "2 ## What is BigQuery DataFrame?\n", |
223 | 200 | "\n",
|
224 |
| - "BQML is ... \n", |
225 |
| - "2 BigQuery DataFrame is a Python DataFrame imple... \n", |
| 201 | + "**BigQuery Dat... \n", |
226 | 202 | "\n",
|
227 |
| - " ml_generate_text_rai_result ml_generate_text_status \\\n", |
228 |
| - "0 null \n", |
229 |
| - "1 null \n", |
230 |
| - "2 null \n", |
| 203 | + " ml_generate_text_rai_result ml_generate_text_status \\\n", |
| 204 | + "0 [{\"category\":1,\"probability\":1,\"probability_sc... \n", |
| 205 | + "1 [{\"category\":1,\"probability\":1,\"probability_sc... \n", |
| 206 | + "2 [{\"category\":1,\"probability\":1,\"probability_sc... \n", |
231 | 207 | "\n",
|
232 | 208 | " prompt \n",
|
233 | 209 | "0 What is BigQuery? \n",
|
234 | 210 | "1 What is BQML? \n",
|
235 | 211 | "2 What is BigQuery DataFrame? "
|
236 | 212 | ]
|
237 | 213 | },
|
238 |
| - "execution_count": 5, |
| 214 | + "execution_count": 4, |
239 | 215 | "metadata": {},
|
240 | 216 | "output_type": "execute_result"
|
241 | 217 | }
|
|
255 | 231 | },
|
256 | 232 | {
|
257 | 233 | "cell_type": "code",
|
258 |
| - "execution_count": 6, |
| 234 | + "execution_count": 5, |
259 | 235 | "metadata": {},
|
260 | 236 | "outputs": [
|
261 | 237 | {
|
262 | 238 | "data": {
|
263 | 239 | "text/plain": [
|
264 |
| - "'**BigQuery**\\n\\n**Definition:**\\n\\nBigQuery is a serverless, highly scalable, cloud-based data warehouse and analytics platform offered by Google Cloud.\\n\\n**Key Features:**\\n\\n* **Massive Scalability:** Can handle large datasets (petabytes or more) with fast query execution.\\n* **Elastic:** Automatically scales compute resources based on workload requirements.\\n* **Serverless:** Users do not need to manage infrastructure or provision resources.\\n* **Flexible Data Loading:** Supports a wide range of data sources, including files, databases, and streaming data.\\n* **SQL-Based Querying:** Uses standard SQL syntax for querying and analyzing data.\\n* **Machine Learning Integration:** Provides built-in machine learning capabilities for predictive analytics and data exploration.\\n* **Real-Time Analysis:** Supports streaming data analysis and interactive dashboards.\\n* **Collaboration and Sharing:** Allows multiple users to access and analyze data in a collaborative environment.\\n* **Cost-Effective:** Pay-as-you-go pricing based on data scanned and compute resources used.\\n\\n**Applications:**\\n\\n* Data warehousing and analytics\\n* Business intelligence and reporting\\n* Data science and machine learning\\n* Data exploration and visualization\\n* Marketing analytics\\n* Fraud detection and risk management\\n\\n**Benefits:**\\n\\n* Rapid data analysis on large datasets\\n* Reduced infrastructure management overhead\\n* Increased agility and flexibility\\n* Enhanced collaboration and data sharing\\n* Cost-effective data storage and analytics'" |
| 240 | + "\"## BigQuery: A Serverless Data Warehouse\\n\\nBigQuery is a serverless, cloud-based data warehouse that enables scalable analysis of large datasets. It's a popular choice for businesses of all sizes due to its ability to handle petabytes of data and run complex queries quickly and efficiently. Let's delve into its key features:\\n\\n**Serverless Architecture:** BigQuery eliminates the need for server management, allowing you to focus on analyzing data. Google manages the infrastructure, scaling resources up or down automatically based on your needs.\\n\\n**Scalability:** BigQuery can handle massive datasets, scaling seamlessly as your data volume grows. It automatically distributes queries across its infrastructure, ensuring fast and efficient processing.\\n\\n**SQL-like Querying:** BigQuery uses a familiar SQL-like syntax, making it easy for data analysts and developers to learn and use. This allows them to leverage their existing SQL knowledge for data exploration and analysis.\\n\\n**Cost-Effectiveness:** BigQuery offers a pay-as-you-go pricing model, meaning you only pay for the resources you use. This makes it a cost-effective solution for businesses with varying data processing needs.\\n\\n**Integration with Google Cloud:** BigQuery integrates seamlessly with other Google Cloud services like Cloud Storage, Dataflow, and Machine Learning, enabling a comprehensive data processing and analysis workflow within the Google Cloud ecosystem.\\n\\n**Security and Reliability:** BigQuery offers robust security features and high availability, ensuring data protection and reliable access.\\n\\n**Use Cases:** BigQuery finds applications in various scenarios, including:\\n\\n* **Data Warehousing:** Store and analyze large amounts of structured and semi-structured data.\\n* **Business Intelligence:** Generate insights from data for informed decision-making.\\n* **Data Analytics:** Perform complex data analysis and extract valuable patterns.\\n* **Machine Learning:** Train and deploy machine learning models on large datasets.\\n\\n**Getting Started:** To get started with BigQuery, you can create a free trial account on Google Cloud Platform and explore its features. Numerous tutorials and documentation are available to help you learn and use BigQuery effectively.\\n\\n## Additional Resources:\\n\\n* **BigQuery Documentation:** https://cloud.google.com/bigquery/docs/\\n* **BigQuery Quickstart:** https://cloud.google.com/bigquery/docs/quickstarts/quickstart-console\\n* **BigQuery Pricing:** https://cloud.google.com/bigquery/pricing\\n\\nFeel free to ask if you have any further questions about BigQuery!\"" |
265 | 241 | ]
|
266 | 242 | },
|
267 |
| - "execution_count": 6, |
| 243 | + "execution_count": 5, |
268 | 244 | "metadata": {},
|
269 | 245 | "output_type": "execute_result"
|
270 | 246 | }
|
|
0 commit comments