Method: locations.generateSyntheticData

Full name: projects.locations.generateSyntheticData

Generates synthetic data based on the provided configuration.

Endpoint

post https://aiplatform.googleapis.com/v1beta1/{location}:generateSyntheticData

Path parameters

location string

Required. The resource name of the Location to run the job. Format: projects/{project}/locations/{location}

Request body

The request body contains data with the following structure:

Fields
count integer

Required. The number of synthetic examples to generate. For this stateless API, the count is limited to a small number.

outputFieldSpecs[] object (OutputFieldSpec)

Required. The schema of the desired output, defined by a list of fields.

examples[] object (SyntheticExample)

Optional. A list of few-shot examples to guide the model's output style and format.

strategy Union type
The generation strategy to use. strategy can be only one of the following:
taskDescription object (TaskDescriptionStrategy)

Generate data from a high-level task description.

Response body

The response containing the generated data.

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

Fields
syntheticExamples[] object (SyntheticExample)

A list of generated synthetic examples.

JSON representation
{
  "syntheticExamples": [
    {
      object (SyntheticExample)
    }
  ]
}

TaskDescriptionStrategy

Defines a generation strategy based on a high-level task description.

Fields
taskDescription string

Required. A high-level description of the synthetic data to be generated.

JSON representation
{
  "taskDescription": string
}

OutputFieldSpec

Defines a specification for a single output field.

Fields
fieldName string

Required. The name of the output field.

guidance string

Optional. Optional, but recommended. Additional guidance specific to this field to provide targeted instructions for the LLM to generate the content of a single output field. While the LLM can sometimes infer content from the field name, providing explicit guidance is preferred.

fieldType enum (FieldType)

Optional. The data type of the field. Defaults to CONTENT if not set.

JSON representation
{
  "fieldName": string,
  "guidance": string,
  "fieldType": enum (FieldType)
}

FieldType

The data type of the field.

Enums
FIELD_TYPE_UNSPECIFIED Field type is unspecified.
CONTENT Arbitrary content field type.
TEXT Text field type.
IMAGE Image field type.
AUDIO Audio field type.

SyntheticExample

Represents a single synthetic example, composed of multiple fields. Used for providing few-shot examples in the request and for returning generated examples in the response.

Fields
fields[] object (SyntheticField)

Required. A list of fields that constitute an example.

JSON representation
{
  "fields": [
    {
      object (SyntheticField)
    }
  ]
}

SyntheticField

Represents a single named field within a SyntheticExample.

Fields
fieldName string

Optional. The name of the field.

content object (Content)

Required. The content of the field.

JSON representation
{
  "fieldName": string,
  "content": {
    object (Content)
  }
}