♊️ GemiNews 🗞️
(dev)
🏡
📰 Articles
🏷️ Tags
🧠 Queries
📈 Graphs
☁️ Stats
💁🏻 Assistant
💬
🎙️
Demo 1: Embeddings + Recommendation
Demo 2: Bella RAGa
Demo 3: NewRetriever
Demo 4: Assistant function calling
Editing article
Title
Summary
Content
<p>Vertex AI Search is a fully-managed platform, powered by large language models, that lets you build AI-enabled search and recommendation experiences for your public or private websites or mobile applications. For a thorough understanding of the methodology and procedures associated with the creation, deployment, maintenance, and monitoring of a Vertex AI Search instance, please refer to the <a href="https://cloud.google.com/generative-ai-app-builder/docs/introduction">Vertex AI Search and Conversation documentation</a>.</p><p>There are many options to DIY a Search/Chat bot … <strong><em>BUT</em></strong> <strong>Demos are easy, Production is hard.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*UeqxMw2saNXhowf7" /></figure><p>The following are the steps involved in constructing a Retrieval-Augmented Generation (RAG) search application:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y3LZ8-03KQ_pN7Qy" /></figure><p>The utilization of managed Vertex AI Search by Google Cloud considerably streamlines this process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7sUEga74WmFPm_pr" /></figure><p>Follow the simple steps to build your datastores and engines, then load and query the data in GCP Vertex AI Search and Conversation platform.</p><p><strong>What we are going to Build</strong></p><ol><li>Datastores and Engines from Terraform</li><li>Load data and query from python</li></ol><h3><strong>Step 1:</strong></h3><pre># Create Test DataStore<br>resource "google_discovery_engine_data_store" "test-ds" {<br> location = "global"<br> data_store_id = "test-data-store-id"<br> display_name = "test-unstructured-datastore"<br> industry_vertical = "GENERIC"<br> content_config = "CONTENT_REQUIRED"<br> solution_types = ["SOLUTION_TYPE_SEARCH"]<br> create_advanced_site_search = false<br> project = <PROJECT ID><br>}<br><br># Create Test Serach Engine<br>resource "google_discovery_engine_search_engine" "test-engine" {<br> engine_id = "test_engine_id"<br> collection_id = "default_collection"<br> location = google_discovery_engine_data_store.test-ds.location<br> display_name = "test-engine"<br> industry_vertical = "GENERIC"<br> data_store_ids = [google_discovery_engine_data_store.test-ds.data_store_id]<br> common_config {<br> company_name = "Test Company"<br> }<br>search_engine_config {<br> search_add_ons = ["SEARCH_ADD_ON_LLM"]<br> }<br>project = <PROJECT ID><br>}<br><br># Output resource Id's<br>output "test_data_store_id" {<br> value =resource.google_discovery_engine_data_store.test-ds.data_store_id<br>}<br>output "test_engine_id" {<br> value = resource.google_discovery_engine_search_engine.test-engine.engine_id<br>}</pre><p>Run</p><pre>Plugin project ID in above terraform code and run below commands<br><br>terraform init<br>terraform plan<br>terraform apply</pre><p>If you running terraform with your own GCP identity you will run into an error like below.</p><pre>Error: Error creating DataStore: googleapi: Error 403: <br>Your application is authenticating by using local Application Default <br>Credentials. The discoveryengine.googleapis.com API requires a quota project, <br>which is not set by default. To learn how to set your quota project, <br>see https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds .</pre><p>Add provider block to specify billing project. billing project and project where datastores are created can be same.</p><pre>provider "google" {<br> project = <PROJECT ID> // Your actual GCP project ID<br> user_project_override = true <br> billing_project = <BILLING PROJECT ID> // The project used for quota<br>}</pre><p>Once terraform is successful you can login to GCP Console -> Vertex Search and Conversation</p><ol><li>Confirm an App named “test-engine” is created</li><li>Confirm an empty datastore named “test-unstructured-datastore” is created</li></ol><h3>Step 2:</h3><p>Create load_data.py with below contents. Plug in project Id and Datastore ID (output from terraform)</p><pre><br>from google.cloud import storage<br>from google.api_core.client_options import ClientOptions<br>from google.cloud import discoveryengine_v1alpha as discoveryengine<br><br><br>def import_documents(<br> project_id: str,<br> location: str,<br> data_store_id: str,<br> gcs_uri: str,<br>):<br> # Create a client<br> client_options = (<br> ClientOptions(<br> api_endpoint=f"{location}-discoveryengine.googleapis.com")<br> if location != "global"<br> else None<br> )<br> client = discoveryengine.DocumentServiceClient(<br> client_options=client_options)<br><br> # The full resource name of the search engine branch.<br> # e.g. projects/{project}/locations/{location}/dataStores/{data_store_id}/branches/{branch}<br> parent = client.branch_path(<br> project=project_id,<br> location=location,<br> data_store=data_store_id,<br> branch="default_branch",<br> )<br><br> source_documents = [f"{gcs_uri}/*"]<br><br> request = discoveryengine.ImportDocumentsRequest(<br> parent=parent,<br> gcs_source=discoveryengine.GcsSource(<br> input_uris=source_documents, data_schema="content"<br> ),<br> # Options: `FULL`, `INCREMENTAL`<br> reconciliation_mode=discoveryengine.ImportDocumentsRequest.ReconciliationMode.INCREMENTAL,<br> )<br><br> # Make the request<br> operation = client.import_documents(request=request)<br><br> response = operation.result()<br><br> # Once the operation is complete,<br> # get information from operation metadata<br> metadata = discoveryengine.ImportDocumentsMetadata(operation.metadata)<br><br> # Handle the response<br> return operation.operation.name<br><br><br>source_documents_gs_uri = (<br> "gs://cloud-samples-data/gen-app-builder/search/alphabet-investor-pdfs"<br>)<br><br>PROJECT_ID = <PROJECT ID><br>DATASTORE_ID = <DATASTORE ID><br>LOCATION = "global"<br>print(" Starting loading data into datastore")<br>import_documents(PROJECT_ID, LOCATION, DATASTORE_ID, source_documents_gs_uri)<br>print(" Completed loading data into datastore")</pre><p>Create search_data.py with below contents. Plug in project Id and Datastore ID (output from terraform)</p><pre>from google.cloud import storage<br>from google.api_core.client_options import ClientOptions<br>from google.cloud import discoveryengine_v1alpha as discoveryengine<br>from typing import List<br><br><br>def search_sample(<br> project_id: str,<br> location: str,<br> data_store_id: str,<br> search_query: str,<br>) -> List[discoveryengine.SearchResponse]:<br> # For more information, refer to:<br> # https://cloud.google.com/generative-ai-app-builder/docs/locations#specify_a_multi-region_for_your_data_store<br> client_options = (<br> ClientOptions(<br> api_endpoint=f"{location}-discoveryengine.googleapis.com")<br> if LOCATION != "global"<br> else None<br> )<br><br> # Create a client<br> client = discoveryengine.SearchServiceClient(client_options=client_options)<br><br> # The full resource name of the search engine serving config<br> # e.g. projects/{project_id}/locations/{location}/dataStores/{data_store_id}/servingConfigs/{serving_config_id}<br> serving_config = client.serving_config_path(<br> project=project_id,<br> location=location,<br> data_store=data_store_id,<br> serving_config="default_config",<br> )<br><br> # Optional: Configuration options for search<br> # Refer to the `ContentSearchSpec` reference for all supported fields:<br> # https://cloud.google.com/python/docs/reference/discoveryengine/latest/google.cloud.discoveryengine_v1.types.SearchRequest.ContentSearchSpec<br> content_search_spec = discoveryengine.SearchRequest.ContentSearchSpec(<br> # For information about snippets, refer to:<br> # https://cloud.google.com/generative-ai-app-builder/docs/snippets<br> snippet_spec=discoveryengine.SearchRequest.ContentSearchSpec.SnippetSpec(<br> return_snippet=True<br> ),<br> # For information about search summaries, refer to:<br> # https://cloud.google.com/generative-ai-app-builder/docs/get-search-summaries<br> summary_spec=discoveryengine.SearchRequest.ContentSearchSpec.SummarySpec(<br> summary_result_count=5,<br> include_citations=True,<br> ignore_adversarial_query=True,<br> ignore_non_summary_seeking_query=True,<br> ),<br> )<br><br> # Refer to the `SearchRequest` reference for all supported fields:<br> # https://cloud.google.com/python/docs/reference/discoveryengine/latest/google.cloud.discoveryengine_v1.types.SearchRequest<br> request = discoveryengine.SearchRequest(<br> serving_config=serving_config,<br> query=search_query,<br> page_size=10,<br> content_search_spec=content_search_spec,<br> query_expansion_spec=discoveryengine.SearchRequest.QueryExpansionSpec(<br> condition=discoveryengine.SearchRequest.QueryExpansionSpec.Condition.AUTO,<br> ),<br> spell_correction_spec=discoveryengine.SearchRequest.SpellCorrectionSpec(<br> mode=discoveryengine.SearchRequest.SpellCorrectionSpec.Mode.AUTO<br> ),<br> )<br><br> response = client.search(request)<br> return response<br><br><br>QUERY = "Who is the CEO of Google?"<br><br><br>PROJECT_ID = <PROJECT ID><br>DATASTORE_ID = <DATASTORE ID><br>LOCATION = "global"<br><br>print(search_sample(PROJECT_ID, LOCATION, DATASTORE_ID, QUERY).summary.summary_text)</pre><p>Output of above python script should print the summary for the query.</p><p>Do create datastores and engines in python refer to this <a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/search/create_datastore_and_search.ipynb">Github Resource</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=364cdc591167" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/vertex-search-and-conversation-364cdc591167">Vertex Search and Conversation</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>
Author
Link
Published date
Image url
Feed url
Guid
Hidden blurb
--- !ruby/object:Feedjira::Parser::RSSEntry title: Vertex Search and Conversation url: https://medium.com/google-cloud/vertex-search-and-conversation-364cdc591167?source=rss----e52cf94d98af---4 author: Anita Gutta categories: - google-cloud-platform - gcp-chat-bots - conversational-ai - machine-learning - vertex-search published: 2024-04-08 06:26:09.000000000 Z entry_id: !ruby/object:Feedjira::Parser::GloballyUniqueIdentifier is_perma_link: 'false' guid: https://medium.com/p/364cdc591167 carlessian_info: news_filer_version: 2 newspaper: Google Cloud - Medium macro_region: Blogs rss_fields: - title - url - author - categories - published - entry_id - content content: '<p>Vertex AI Search is a fully-managed platform, powered by large language models, that lets you build AI-enabled search and recommendation experiences for your public or private websites or mobile applications. For a thorough understanding of the methodology and procedures associated with the creation, deployment, maintenance, and monitoring of a Vertex AI Search instance, please refer to the <a href="https://cloud.google.com/generative-ai-app-builder/docs/introduction">Vertex AI Search and Conversation documentation</a>.</p><p>There are many options to DIY a Search/Chat bot … <strong><em>BUT</em></strong> <strong>Demos are easy, Production is hard.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*UeqxMw2saNXhowf7" /></figure><p>The following are the steps involved in constructing a Retrieval-Augmented Generation (RAG) search application:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y3LZ8-03KQ_pN7Qy" /></figure><p>The utilization of managed Vertex AI Search by Google Cloud considerably streamlines this process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7sUEga74WmFPm_pr" /></figure><p>Follow the simple steps to build your datastores and engines, then load and query the data in GCP Vertex AI Search and Conversation platform.</p><p><strong>What we are going to Build</strong></p><ol><li>Datastores and Engines from Terraform</li><li>Load data and query from python</li></ol><h3><strong>Step 1:</strong></h3><pre># Create Test DataStore<br>resource "google_discovery_engine_data_store" "test-ds" {<br> location = "global"<br> data_store_id = "test-data-store-id"<br> display_name = "test-unstructured-datastore"<br> industry_vertical = "GENERIC"<br> content_config = "CONTENT_REQUIRED"<br> solution_types = ["SOLUTION_TYPE_SEARCH"]<br> create_advanced_site_search = false<br> project = <PROJECT ID><br>}<br><br># Create Test Serach Engine<br>resource "google_discovery_engine_search_engine" "test-engine" {<br> engine_id = "test_engine_id"<br> collection_id = "default_collection"<br> location = google_discovery_engine_data_store.test-ds.location<br> display_name = "test-engine"<br> industry_vertical = "GENERIC"<br> data_store_ids = [google_discovery_engine_data_store.test-ds.data_store_id]<br> common_config {<br> company_name = "Test Company"<br> }<br>search_engine_config {<br> search_add_ons = ["SEARCH_ADD_ON_LLM"]<br> }<br>project = <PROJECT ID><br>}<br><br># Output resource Id's<br>output "test_data_store_id" {<br> value =resource.google_discovery_engine_data_store.test-ds.data_store_id<br>}<br>output "test_engine_id" {<br> value = resource.google_discovery_engine_search_engine.test-engine.engine_id<br>}</pre><p>Run</p><pre>Plugin project ID in above terraform code and run below commands<br><br>terraform init<br>terraform plan<br>terraform apply</pre><p>If you running terraform with your own GCP identity you will run into an error like below.</p><pre>Error: Error creating DataStore: googleapi: Error 403: <br>Your application is authenticating by using local Application Default <br>Credentials. The discoveryengine.googleapis.com API requires a quota project, <br>which is not set by default. To learn how to set your quota project, <br>see https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds .</pre><p>Add provider block to specify billing project. billing project and project where datastores are created can be same.</p><pre>provider "google" {<br> project = <PROJECT ID> // Your actual GCP project ID<br> user_project_override = true <br> billing_project = <BILLING PROJECT ID> // The project used for quota<br>}</pre><p>Once terraform is successful you can login to GCP Console -> Vertex Search and Conversation</p><ol><li>Confirm an App named “test-engine” is created</li><li>Confirm an empty datastore named “test-unstructured-datastore” is created</li></ol><h3>Step 2:</h3><p>Create load_data.py with below contents. Plug in project Id and Datastore ID (output from terraform)</p><pre><br>from google.cloud import storage<br>from google.api_core.client_options import ClientOptions<br>from google.cloud import discoveryengine_v1alpha as discoveryengine<br><br><br>def import_documents(<br> project_id: str,<br> location: str,<br> data_store_id: str,<br> gcs_uri: str,<br>):<br> # Create a client<br> client_options = (<br> ClientOptions(<br> api_endpoint=f"{location}-discoveryengine.googleapis.com")<br> if location != "global"<br> else None<br> )<br> client = discoveryengine.DocumentServiceClient(<br> client_options=client_options)<br><br> # The full resource name of the search engine branch.<br> # e.g. projects/{project}/locations/{location}/dataStores/{data_store_id}/branches/{branch}<br> parent = client.branch_path(<br> project=project_id,<br> location=location,<br> data_store=data_store_id,<br> branch="default_branch",<br> )<br><br> source_documents = [f"{gcs_uri}/*"]<br><br> request = discoveryengine.ImportDocumentsRequest(<br> parent=parent,<br> gcs_source=discoveryengine.GcsSource(<br> input_uris=source_documents, data_schema="content"<br> ),<br> # Options: `FULL`, `INCREMENTAL`<br> reconciliation_mode=discoveryengine.ImportDocumentsRequest.ReconciliationMode.INCREMENTAL,<br> )<br><br> # Make the request<br> operation = client.import_documents(request=request)<br><br> response = operation.result()<br><br> # Once the operation is complete,<br> # get information from operation metadata<br> metadata = discoveryengine.ImportDocumentsMetadata(operation.metadata)<br><br> # Handle the response<br> return operation.operation.name<br><br><br>source_documents_gs_uri = (<br> "gs://cloud-samples-data/gen-app-builder/search/alphabet-investor-pdfs"<br>)<br><br>PROJECT_ID = <PROJECT ID><br>DATASTORE_ID = <DATASTORE ID><br>LOCATION = "global"<br>print(" Starting loading data into datastore")<br>import_documents(PROJECT_ID, LOCATION, DATASTORE_ID, source_documents_gs_uri)<br>print(" Completed loading data into datastore")</pre><p>Create search_data.py with below contents. Plug in project Id and Datastore ID (output from terraform)</p><pre>from google.cloud import storage<br>from google.api_core.client_options import ClientOptions<br>from google.cloud import discoveryengine_v1alpha as discoveryengine<br>from typing import List<br><br><br>def search_sample(<br> project_id: str,<br> location: str,<br> data_store_id: str,<br> search_query: str,<br>) -> List[discoveryengine.SearchResponse]:<br> # For more information, refer to:<br> # https://cloud.google.com/generative-ai-app-builder/docs/locations#specify_a_multi-region_for_your_data_store<br> client_options = (<br> ClientOptions(<br> api_endpoint=f"{location}-discoveryengine.googleapis.com")<br> if LOCATION != "global"<br> else None<br> )<br><br> # Create a client<br> client = discoveryengine.SearchServiceClient(client_options=client_options)<br><br> # The full resource name of the search engine serving config<br> # e.g. projects/{project_id}/locations/{location}/dataStores/{data_store_id}/servingConfigs/{serving_config_id}<br> serving_config = client.serving_config_path(<br> project=project_id,<br> location=location,<br> data_store=data_store_id,<br> serving_config="default_config",<br> )<br><br> # Optional: Configuration options for search<br> # Refer to the `ContentSearchSpec` reference for all supported fields:<br> # https://cloud.google.com/python/docs/reference/discoveryengine/latest/google.cloud.discoveryengine_v1.types.SearchRequest.ContentSearchSpec<br> content_search_spec = discoveryengine.SearchRequest.ContentSearchSpec(<br> # For information about snippets, refer to:<br> # https://cloud.google.com/generative-ai-app-builder/docs/snippets<br> snippet_spec=discoveryengine.SearchRequest.ContentSearchSpec.SnippetSpec(<br> return_snippet=True<br> ),<br> # For information about search summaries, refer to:<br> # https://cloud.google.com/generative-ai-app-builder/docs/get-search-summaries<br> summary_spec=discoveryengine.SearchRequest.ContentSearchSpec.SummarySpec(<br> summary_result_count=5,<br> include_citations=True,<br> ignore_adversarial_query=True,<br> ignore_non_summary_seeking_query=True,<br> ),<br> )<br><br> # Refer to the `SearchRequest` reference for all supported fields:<br> # https://cloud.google.com/python/docs/reference/discoveryengine/latest/google.cloud.discoveryengine_v1.types.SearchRequest<br> request = discoveryengine.SearchRequest(<br> serving_config=serving_config,<br> query=search_query,<br> page_size=10,<br> content_search_spec=content_search_spec,<br> query_expansion_spec=discoveryengine.SearchRequest.QueryExpansionSpec(<br> condition=discoveryengine.SearchRequest.QueryExpansionSpec.Condition.AUTO,<br> ),<br> spell_correction_spec=discoveryengine.SearchRequest.SpellCorrectionSpec(<br> mode=discoveryengine.SearchRequest.SpellCorrectionSpec.Mode.AUTO<br> ),<br> )<br><br> response = client.search(request)<br> return response<br><br><br>QUERY = "Who is the CEO of Google?"<br><br><br>PROJECT_ID = <PROJECT ID><br>DATASTORE_ID = <DATASTORE ID><br>LOCATION = "global"<br><br>print(search_sample(PROJECT_ID, LOCATION, DATASTORE_ID, QUERY).summary.summary_text)</pre><p>Output of above python script should print the summary for the query.</p><p>Do create datastores and engines in python refer to this <a href="https://github.com/GoogleCloudPlatform/generative-ai/blob/main/search/create_datastore_and_search.ipynb">Github Resource</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=364cdc591167" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/vertex-search-and-conversation-364cdc591167">Vertex Search and Conversation</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>'
Language
Active
Ricc internal notes
Imported via /Users/ricc/git/gemini-news-crawler/webapp/db/seeds.d/import-feedjira.rb on 2024-04-09 05:41:46 -0700. Content is EMPTY here. Entried: title,url,author,categories,published,entry_id,content. TODO add Newspaper: filename = /Users/ricc/git/gemini-news-crawler/webapp/db/seeds.d/../../../crawler/out/feedjira/Blogs/Google Cloud - Medium/2024-04-08-Vertex_Search_and_Conversation-v2.yaml
Ricc source
Show this article
Back to articles