254 lines
11 KiB
Markdown
254 lines
11 KiB
Markdown
# AI Applications
|
|
|
|
This module handles the creation of [AI Applications](https://cloud.google.com/generative-ai-app-builder/docs/introduction) data sources, engines and related configurations.
|
|
|
|
<!-- TOC -->
|
|
* [AI Applications module](#ai-applications)
|
|
* [APIs](#apis)
|
|
* [Quota Project](#quota-project)
|
|
* [Examples](#examples)
|
|
* [Chat Engine](#chat-engine)
|
|
* [Search Engine](#search-engine)
|
|
* [Deploy your service into a region](#deploy-your-service-into-a-region)
|
|
* [Reference Existing Data Sources](#reference-existing-data-sources)
|
|
* [Using multiple data stores](#using-multiple-data-stores)
|
|
* [Set data store schemas](#set-data-store-schemas)
|
|
* [Back data stores with websites data](#back-data-stores-with-websites-data)
|
|
* [Variables](#variables)
|
|
* [Outputs](#outputs)
|
|
<!-- TOC -->
|
|
|
|
## APIs
|
|
|
|
This module uses the API `discoveryengine.googleapis.com`
|
|
|
|
## Quota Project
|
|
|
|
To run this module you'll need to set a quota project.
|
|
|
|
```shell
|
|
export GOOGLE_BILLING_PROJECT=your-project-id
|
|
export USER_PROJECT_OVERRIDE=true
|
|
```
|
|
|
|
## Examples
|
|
|
|
### Chat Engine
|
|
|
|
This is a minimal example to create a Chat Engine agent.
|
|
|
|
```hcl
|
|
module "ai-applications" {
|
|
source = "./fabric/modules/ai-applications"
|
|
name = "my-chat-app"
|
|
project_id = var.project_id
|
|
data_stores_configs = {
|
|
data-store-1 = {
|
|
solution_types = ["SOLUTION_TYPE_CHAT"]
|
|
}
|
|
}
|
|
engines_configs = {
|
|
my-chat-engine = {
|
|
data_store_ids = ["data-store-1"]
|
|
chat_engine_config = {
|
|
company_name = "Google"
|
|
default_language_code = "en"
|
|
time_zone = "America/Los_Angeles"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
# tftest modules=1 resources=2
|
|
```
|
|
|
|
### Search Engine
|
|
|
|
This is a minimal example to create a Search Engine agent.
|
|
|
|
```hcl
|
|
module "ai-applications" {
|
|
source = "./fabric/modules/ai-applications"
|
|
name = "my-search-app"
|
|
project_id = var.project_id
|
|
data_stores_configs = {
|
|
data-store-1 = {
|
|
solution_types = ["SOLUTION_TYPE_SEARCH"]
|
|
}
|
|
}
|
|
engines_configs = {
|
|
my-search-engine = {
|
|
data_store_ids = ["data-store-1"]
|
|
search_engine_config = {}
|
|
}
|
|
}
|
|
}
|
|
# tftest modules=1 resources=2
|
|
```
|
|
|
|
### Deploy your service into a region
|
|
|
|
By default services are deployed globally. You optionally specify a region where to deploy them.
|
|
|
|
```hcl
|
|
module "ai-applications" {
|
|
source = "./fabric/modules/ai-applications"
|
|
name = "my-chat-app"
|
|
project_id = var.project_id
|
|
location = var.region
|
|
data_stores_configs = {
|
|
data-store-1 = {
|
|
solution_types = ["SOLUTION_TYPE_CHAT"]
|
|
}
|
|
}
|
|
engines_configs = {
|
|
my-chat-engine = {
|
|
data_store_ids = ["data-store-1"]
|
|
chat_engine_config = {
|
|
company_name = "Google"
|
|
default_language_code = "en"
|
|
time_zone = "America/Los_Angeles"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
# tftest modules=1 resources=2
|
|
```
|
|
|
|
### Reference existing data sources
|
|
|
|
You can reference from engines existing data sources created outside this module, by passing their ids. In this case, you'll need to configure in the engine valid `industry_vertical` and `location`.
|
|
|
|
```hcl
|
|
module "ai-applications" {
|
|
source = "./fabric/modules/ai-applications"
|
|
name = "my-search-app"
|
|
project_id = var.project_id
|
|
engines_configs = {
|
|
my-search-engine = {
|
|
data_store_ids = [
|
|
"projects/my-project/locations/global/collections/my-collection/dataStores/data-store-1"
|
|
]
|
|
industry_vertical = "GENERIC"
|
|
search_engine_config = {}
|
|
}
|
|
}
|
|
}
|
|
# tftest modules=1 resources=1
|
|
```
|
|
|
|
### Using multiple data stores
|
|
|
|
You can create and connect from your engines multiple data stores.
|
|
|
|
```hcl
|
|
module "ai-applications" {
|
|
source = "./fabric/modules/ai-applications"
|
|
name = "my-chat-app"
|
|
project_id = var.project_id
|
|
data_stores_configs = {
|
|
data-store-1 = {
|
|
solution_types = ["SOLUTION_TYPE_CHAT"]
|
|
}
|
|
data-store-2 = {
|
|
solution_types = ["SOLUTION_TYPE_CHAT"]
|
|
}
|
|
}
|
|
engines_configs = {
|
|
my-chat-engine = {
|
|
data_store_ids = [
|
|
"data-store-1",
|
|
"data-store-2",
|
|
"projects/my-project/locations/global/collections/default_collection/dataStores/data-store-3"
|
|
]
|
|
chat_engine_config = {
|
|
company_name = "Google"
|
|
default_language_code = "en"
|
|
time_zone = "America/Los_Angeles"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
# tftest modules=1 resources=3
|
|
```
|
|
|
|
### Set data store schemas
|
|
|
|
You can configure JSON data store schema definitions directly in your data store configuration.
|
|
|
|
```hcl
|
|
module "ai-applications" {
|
|
source = "./fabric/modules/ai-applications"
|
|
name = "my-search-app"
|
|
project_id = var.project_id
|
|
data_stores_configs = {
|
|
data-store-1 = {
|
|
json_schema = "{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"datetime_detection\":true,\"type\":\"object\",\"geolocation_detection\":true}"
|
|
solution_types = ["SOLUTION_TYPE_SEARCH"]
|
|
}
|
|
}
|
|
}
|
|
# tftest modules=1 resources=2
|
|
```
|
|
|
|
### Back data stores with websites data
|
|
|
|
You can make data stores point to multiple websites and optionally specify their sitemap.
|
|
|
|
```hcl
|
|
module "ai-applications" {
|
|
source = "./fabric/modules/ai-applications"
|
|
name = "my-search-app"
|
|
project_id = var.project_id
|
|
data_stores_configs = {
|
|
website-search-ds = {
|
|
solution_types = ["SOLUTION_TYPE_SEARCH"]
|
|
sites_search_config = {
|
|
sitemap_uri = "https://cloud.google.com/sitemap.xml"
|
|
target_sites = {
|
|
include-google-docs = {
|
|
provided_uri_pattern = "cloud.google.com/docs/*"
|
|
}
|
|
exclude-one-page = {
|
|
exact_match = true
|
|
provided_uri_pattern = "https://cloud.google.com/ai-applications"
|
|
type = "EXCLUDE"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
engines_configs = {
|
|
my-search-engine = {
|
|
data_store_ids = [
|
|
"website-search-ds"
|
|
]
|
|
industry_vertical = "GENERIC"
|
|
search_engine_config = {}
|
|
}
|
|
}
|
|
}
|
|
# tftest modules=1 resources=5
|
|
```
|
|
<!-- BEGIN TFDOC -->
|
|
## Variables
|
|
|
|
| name | description | type | required | default |
|
|
|---|---|:---:|:---:|:---:|
|
|
| [name](variables.tf#L159) | The name of the resources. | <code>string</code> | ✓ | |
|
|
| [project_id](variables.tf#L165) | The ID of the project where the data stores and the agents will be created. | <code>string</code> | ✓ | |
|
|
| [data_stores_configs](variables.tf#L17) | The ai-applications datastore configurations. | <code title="map(object({ advanced_site_search_config = optional(object({ disable_initial_index = optional(bool) disable_automatic_refresh = optional(bool) })) content_config = optional(string, "NO_CONTENT") create_advanced_site_search = optional(bool) display_name = optional(string) document_processing_config = optional(object({ chunking_config = optional(object({ layout_based_chunking_config = optional(object({ chunk_size = optional(number) include_ancestor_headings = optional(bool) })) })) default_parsing_config = optional(object({ digital_parsing_config = optional(bool) layout_parsing_config = optional(bool) ocr_parsing_config = optional(object({ use_native_text = optional(bool) })) })) parsing_config_overrides = optional(map(object({ digital_parsing_config = optional(bool) layout_parsing_config = optional(bool) ocr_parsing_config = optional(object({ use_native_text = optional(bool) })) }))) })) industry_vertical = optional(string, "GENERIC") json_schema = optional(string) location = optional(string) skip_default_schema_creation = optional(bool) solution_types = optional(list(string)) sites_search_config = optional(object({ sitemap_uri = optional(string) target_sites = map(object({ provided_uri_pattern = string exact_match = optional(bool, false) type = optional(string, "INCLUDE") })) })) }))">map(object({…}))</code> | | <code>{}</code> |
|
|
| [engines_configs](variables.tf#L112) | The ai-applications engines configurations. | <code title="map(object({ data_store_ids = list(string) collection_id = optional(string, "default_collection") chat_engine_config = optional(object({ allow_cross_region = optional(bool, null) business = optional(string) company_name = optional(string) default_language_code = optional(string) dialogflow_agent_to_link = optional(string) time_zone = optional(string) })) industry_vertical = optional(string) location = optional(string) search_engine_config = optional(object({ search_add_ons = optional(list(string), []) search_tier = optional(string) })) }))">map(object({…}))</code> | | <code>{}</code> |
|
|
| [location](variables.tf#L153) | Location where the data stores and agents will be created. | <code>string</code> | | <code>"global"</code> |
|
|
|
|
## Outputs
|
|
|
|
| name | description | sensitive |
|
|
|---|---|:---:|
|
|
| [chat_engine_ids](outputs.tf#L17) | The ids of the chat engines created. | |
|
|
| [chat_engines](outputs.tf#L25) | The chat engines created. | |
|
|
| [data_store_ids](outputs.tf#L30) | The ids of the data stores created. | |
|
|
| [data_stores](outputs.tf#L38) | The data stores resources created. | |
|
|
| [search_engine_ids](outputs.tf#L43) | The ids of the search engines created. | |
|
|
| [search_engines](outputs.tf#L51) | The search engines created. | |
|
|
<!-- END TFDOC -->
|