Full name: projects.locations.generateSyntheticData
Generates synthetic (artificial) data based on a description
Endpoint
posthttps://aiplatform.googleapis.com/v1/{location}:generateSyntheticData
Path parameters
locationstring
Required. The geographic location where the synthetic data generation request is processed. This should be in the format projects/{project}/locations/{location}. For example, projects/my-project/locations/us-central1.
Request body
The request body contains data with the following structure:
countinteger
Required. The number of synthetic examples to generate. For this stateless API, you can generate up to 50 examples in a single request.
Required. Defines the schema of each synthetic example to be generated, defined by a list of fields.
Optional. A list of few-shot examples that help the model understand the desired style, tone, and format of the generated synthetic data. Providing these few-shot examples can significantly improve the quality and relevance of the output.
strategyUnion type
strategy can be only one of the following:Generates synthetic data based on a high-level description of the task or data you want.
Response body
The response message for the locations.generateSyntheticData method, containing the synthetic examples generated by the Gen AI evaluation service.
If successful, the response body contains data with the following structure:
A list of generated synthetic examples, each containing a complete synthetic data instance generated based on your request.
| JSON representation |
|---|
{
"syntheticExamples": [
{
object ( |
TaskDescriptionStrategy
Defines a generation strategy based on a general task description.
taskDescriptionstring
Required. A general description of the type of synthetic data you want to generate. For example, "Generate customer reviews for a new smartphone."
| JSON representation |
|---|
{ "taskDescription": string } |
OutputFieldSpec
Specifies the properties of a single field that are included in each generated synthetic example. This helps the model understand what kind of data to generate for each field.
fieldNamestring
Required. The name of this field in the generated synthetic data, such as "emailSubject" or "customer_review".
guidancestring
Optional. Specific instructions for the large language model on how to generate content for this particular field. While the LLM can sometimes infer content from the field name, providing explicit guidance is preferred. For example, for a field named "review", the guidance could be "A positive review about a coffee maker."
Optional. The data type of the field. Defaults to CONTENT if not set.
| JSON representation |
|---|
{
"fieldName": string,
"guidance": string,
"fieldType": enum ( |
FieldType
The type of data expected for this field. This helps the model generate content in the correct format.
| Enums | |
|---|---|
FIELD_TYPE_UNSPECIFIED |
The field type is not specified. Defaults to CONTENT. |
CONTENT |
The field can contain any type of content, including text, images, and audio. |
TEXT |
The field contains only text. |
IMAGE |
The field contains image data. |
AUDIO |
The field contains audio data. |
SyntheticExample
A single instance of generated synthetic data. Each example is made up of one or more named fields, as defined in OutputFieldSpec. These examples are used as few-shot examples to show the model what you want (in GenerateSyntheticDataRequest.examples) and to return generated examples in the response (in GenerateSyntheticDataResponse.synthetic_examples).
Required. A list of fields that constitute an example.
| JSON representation |
|---|
{
"fields": [
{
object ( |
SyntheticField
Represents a single named field within a synthetic example, consisting of a name and the actual content.
fieldNamestring
Optional. The name of the specific field, such as "productName" or "reviewText".
Required. The actual content or value for this field. This can be text, images, or other types of data.
| JSON representation |
|---|
{
"fieldName": string,
"content": {
object ( |