Skip to content

Commit

Permalink
modify title, remove output
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjanalreddy committed May 15, 2024
1 parent 03ff5c2 commit 17711d3
Showing 1 changed file with 17 additions and 99 deletions.
116 changes: 17 additions & 99 deletions notebooks/vertex_genai/solutions/grounding_vertex_agent_builder.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"tags": []
},
"source": [
"# Grounding with Vertex AI Agent Builder"
"# Grounding PaLM with Vertex AI Agent Builder"
]
},
{
Expand Down Expand Up @@ -64,7 +64,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {
"id": "oM1iC_MfAts1",
"tags": []
Expand All @@ -78,7 +78,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {
"id": "init_aip:mbsdk,all",
"tags": []
Expand All @@ -101,7 +101,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {
"id": "PyQmSRbKA8r-",
"tags": []
Expand All @@ -126,7 +126,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": null,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -181,7 +181,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {
"tags": []
},
Expand All @@ -190,7 +190,7 @@
"DATA_STORE_PROJECT_ID = PROJECT_ID # @param {type:\"string\"}\n",
"DATA_STORE_REGION = \"global\" # @param {type:\"string\"}\n",
"# Replace this with your data store ID from Vertex AI Search\n",
"DATA_STORE_ID = \"gcp-documentation_1715192184974\" # @param {type:\"string\"}"
"DATA_STORE_ID = \"\" # TODO: ENTER YOUR DATASTORE ID"
]
},
{
Expand All @@ -202,7 +202,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {
"tags": []
},
Expand All @@ -222,30 +222,11 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Response from model without grounding:\n",
" Object tables in BigQuery are used when you want to store and query data that has a complex structure, such as nested objects or arrays. Object tables are also useful when you want to store data that is not easily represented in a relational table, such as JSON or XML data.\n",
"\n",
"Here are some specific cases where you might want to use an object table in BigQuery:\n",
"\n",
"* To store data that has a complex structure, such as nested objects or arrays. For example, you could use an object table to store customer data, where each customer has a name, address, and list of orders.\n",
"* To store data that is not easily represented in a relational table, such as JSON or XML data. For example, you could use an object table to store data from a web service that returns JSON responses.\n",
"* To improve query performance on data that has a complex structure. Object tables can help to improve query performance by allowing you to filter and aggregate data based on the properties of objects.\n",
"\n",
"Here are some examples of how object tables can be used in practice:\n",
"\n",
"* A company could use an object table to store customer data, where each customer has a name, address, and list of orders. This data could be used to generate reports on customer purchases,\n"
]
}
],
"outputs": [],
"source": [
"response = text_model.predict(\n",
" PROMPT,\n",
Expand All @@ -265,28 +246,11 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Response from Model:\n",
" Object tables can be used in BigQuery in the following scenarios:\n",
"\n",
"- To analyze unstructured data in Cloud Storage.\n",
"- To perform analysis with remote functions.\n",
"- To perform inference using BigQuery ML.\n",
"\n",
"\n",
"Grounding Metadata:\n",
"GroundingMetadata(citations=[GroundingCitation(start_index=37, end_index=99, url='https://cloud.google.com/bigquery/docs/object-table-introduction', title='Introduction to object tables | BigQuery | Google Cloud', license=None, publication_date=None), GroundingCitation(start_index=101, end_index=159, url='https://cloud.google.com/bigquery/docs/object-table-introduction', title='Introduction to object tables | BigQuery | Google Cloud', license=None, publication_date=None), GroundingCitation(start_index=161, end_index=219, url='https://cloud.google.com/bigquery/docs/object-table-introduction', title='Introduction to object tables | BigQuery | Google Cloud', license=None, publication_date=None)], search_queries=['When to use an object table in BigQuery?'])\n"
]
}
],
"outputs": [],
"source": [
"if DATA_STORE_ID and DATA_STORE_REGION:\n",
" # Use Vertex AI Search data store\n",
Expand Down Expand Up @@ -330,7 +294,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": null,
"metadata": {
"tags": []
},
Expand All @@ -351,41 +315,11 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Managed datasets in Vertex AI are curated and maintained by Google. They provide a convenient way to access high-quality data for training and evaluating machine learning models. Managed datasets are available in a variety of domains, including healthcare, finance, and retail.\n",
"\n",
"Here are some of the benefits of using managed datasets in Vertex AI:\n",
"\n",
"* **High-quality data:** Managed datasets are curated by Google experts to ensure that they are accurate, complete, and consistent.\n",
"* **Convenient access:** Managed datasets are hosted in the cloud, so you can access them from anywhere with an internet connection.\n",
"* **Scalable:** Managed datasets can be scaled to meet the needs of your machine learning models.\n",
"* **Secure:** Managed datasets are protected by Google's robust security measures.\n",
"\n",
"To learn more about managed datasets in Vertex AI, please visit the [documentation](https://cloud.google.com/vertex-ai/docs/datasets/overview).\n",
" You can use a variety of data types with Vertex AI, including:\n",
"\n",
"* **Structured data:** This type of data is organized in a tabular format, such as a CSV file or a database table.\n",
"* **Unstructured data:** This type of data is not organized in a tabular format, such as images, videos, or text documents.\n",
"* **Semi-structured data:** This type of data is a combination of structured and unstructured data, such as a JSON file or an HTML document.\n",
"\n",
"Vertex AI can also handle data that is stored in a variety of formats, including:\n",
"\n",
"* **Local files:** You can upload local files to Vertex AI using the Vertex AI console or the Vertex AI SDK.\n",
"* **Cloud storage:** You can access data that is stored in Google Cloud Storage or Amazon S3 using Vertex AI.\n",
"* **BigQuery:** You can access data that is stored in BigQuery using Vertex AI.\n",
"\n",
"To learn more about the data types and formats that Vertex AI can handle, please visit the [documentation](https://cloud.google.com/vertex-ai/docs/data-formats).\n"
]
}
],
"outputs": [],
"source": [
"chat = chat_model.start_chat()\n",
"\n",
Expand All @@ -409,27 +343,11 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Managed datasets in Vertex AI are used to provide the source data used to train AutoML and custom models.\n",
"GroundingMetadata(citations=[GroundingCitation(start_index=1, end_index=106, url='https://cloud.google.com/vertex-ai/docs/datasets/overview', title='Overview of creating managed datasets on Vertex AI | Google Cloud', license=None, publication_date=None)], search_queries=['Vertex AI managed datasets'])\n",
" You can use the following types of data to train a model:\n",
"\n",
"- Tabular data: This is data that is organized in rows and columns, like a spreadsheet.\n",
"- Image data: This is data that is represented as a collection of pixels, like a photograph.\n",
"- Video data: This is data that is represented as a sequence of images, like a movie.\n",
"- Text data: This is data that is represented as a sequence of characters, like a document.\n",
"GroundingMetadata(citations=[GroundingCitation(start_index=1, end_index=58, url='https://cloud.google.com/vertex-ai/docs/training-overview', title='Train and use your own models | Vertex AI | Google Cloud', license=None, publication_date=None), GroundingCitation(start_index=1, end_index=58, url='https://cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create', title='The CREATE MODEL statement | BigQuery | Google Cloud', license=None, publication_date=None)], search_queries=['What types of data can I use to train a model?'])\n"
]
}
],
"outputs": [],
"source": [
"chat = chat_model.start_chat()\n",
"grounding_source = GroundingSource.VertexAISearch(\n",
Expand Down

0 comments on commit 17711d3

Please sign in to comment.