# Method: projects.generateProductText

- [HTTP request](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#body.HTTP_TEMPLATE)
- [Path parameters](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#body.PATH_PARAMETERS)
- [Request body](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#body.request_body)
  - [JSON representation](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#body.response_body)
  - [JSON representation](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#body.GenerateProductTextResponse.SCHEMA_REPRESENTATION)
- [ProductInfo](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductInfo)
  - [JSON representation](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductInfo.SCHEMA_REPRESENTATION)
- [OutputSpec](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#OutputSpec)
  - [JSON representation](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#OutputSpec.SCHEMA_REPRESENTATION)
- [TitleExample](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#TitleExample)
  - [JSON representation](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#TitleExample.SCHEMA_REPRESENTATION)
- [ProductTextGenerationSuggestion](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductTextGenerationSuggestion)
  - [JSON representation](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductTextGenerationSuggestion.SCHEMA_REPRESENTATION)
- [ProductTextGenerationMetadata](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductTextGenerationMetadata)
  - [JSON representation](https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductTextGenerationMetadata.SCHEMA_REPRESENTATION)

Generates a set of candidate text completions/responses from product information.

### HTTP request

`POST https://productstudio.googleapis.com/v1/{parent=projects/*}:generateProductText`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. Project to make a call. Must refer to a caller's project. Format: `projects/{project-id}`. |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "titleExamples": [ { object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#TitleExample`) } ], "productInfo": { object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductInfo`) }, "outputSpec": { object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#OutputSpec`) } } ``` |

| Fields ||
|---|---|
| `titleExamples[]` | ``object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#TitleExample`)`` Optional. Provide some hand-crafted examples of title improvements that are unique to your usecase. TiDe is a general tool that handles multiple product categories, but your brand identity may require custom functionality. Feel free to specify that here. |
| `productInfo` | ``object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductInfo`)`` Required. Available information about the product. Used to inform the genAI models. |
| `outputSpec` | ``object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#OutputSpec`)`` Optional. Configuration parameters that directly influence what content is generated, and how that content is rendered in the final response. |

### Response body

Text generated for a provided product.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "attributes": { string: string, ... }, "title": { object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductTextGenerationSuggestion`) }, "description": { object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductTextGenerationSuggestion`) }, "metadata": { object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductTextGenerationMetadata`) } } ``` |

| Fields ||
|---|---|
| `attributes` | `map (key: string, value: string)` Any other generated attributes An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `title` | ``object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductTextGenerationSuggestion`)`` Generated title. |
| `description` | ``object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductTextGenerationSuggestion`)`` Generated description. |
| `metadata` | ``object (`https://developers.google.com/product-studio/reference/rest/v1/projects/generateProductText#ProductTextGenerationMetadata`)`` Additional info that clients may want to audit surrounding the generation. |

## ProductInfo

Available information about the product. Used to inform the genAI models.

| JSON representation |
|---|
| ``` { "productAttributes": { string: string, ... }, "productImage": { object (`https://developers.google.com/product-studio/reference/rest/v1/Image`) } } ``` |

| Fields ||
|---|---|
| `productAttributes` | `map (key: string, value: string)` Required. A mapping of all available product attributes. This may include title, description, brand, gender, color, size, etc. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `productImage` | ``object (`https://developers.google.com/product-studio/reference/rest/v1/Image`)`` Optional. Image associated with the product. |

## OutputSpec

Configuration parameters that directly influence what content is generated, and how that content is rendered in the final response.

| JSON representation |
|---|
| ``` { "workflowId": string, "tone": string, "editorialChanges": string } ``` |

| Fields ||
|---|---|
| `workflowId` | `string` Optional. The workflow to execute for the provided product data. Workflows may populate the response's title, description, or both. |
| `tone` | `string` Optional. The desired output tone for the generated text. e.g. serious, casual. |
| `editorialChanges` | `string` Optional. Any editorial changes for the generated product data. e.g. replace Small with "S", do not modify color if already present. |

## TitleExample

A hand-crafted example of a product title improvement. These examples are provided to the AI to improve its quality.

| JSON representation |
|---|
| ``` { "productInfo": { string: string, ... }, "finalProductInfo": { string: string, ... }, "titleFormat": string, "category": string } ``` |

| Fields ||
|---|---|
| `productInfo` | `map (key: string, value: string)` Required. A map containing all existing product information. e.g., {"title": "dress", "description": "A red dress", "brand": "Dresses4All"} Any information that you might use to populate your product feed. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `finalProductInfo` | `map (key: string, value: string)` Required. A map in the same format as productInfo but with all improvements included. e.g., {"brand": "Dresses4All", "product": "dress", "color": "red", ...} For now, order these attributes in the order that you want them to appear in the final title. e.g., the above will become: Dresses4All dress \| red An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `titleFormat` | `string` Required. The attributes or approximate attributes that make up the title. e.g., title "Google GShoe M" titleFormat can be "brand \| product \| size". |
| `category` | `string` Required. The product's category. This helps the AI understand when certain examples are more relevant than others. |

## ProductTextGenerationSuggestion

Text generated for a product, optionally including its quality score.

| JSON representation |
|---|
| ``` { "text": string, "score": number, "changeSummary": string } ``` |

| Fields ||
|---|---|
| `text` | `string` The text generated |
| `score` | `number` The quality score associated with the generation. Heuristic implemented according to the feedgen team's implementation styles. |
| `changeSummary` | `string` A brief summarization of all the changes that have been made. |

## ProductTextGenerationMetadata

Wrapper data type for any metadata associated with text generation.

| JSON representation |
|---|
| ``` { "metadata": { object } } ``` |

| Fields ||
|---|---|
| `metadata` | ``object (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Struct` format)`` Metadata is a pretty loose concept. The data is modeled as a map here to indicate that there is no guaranteed structure to the output past a simple K:V association. The first use-case is to track words added/removed/changed in generations. |