Method: schemaVersions.generate

Full name: projects.locations.schemas.schemaVersions.generate

Generates a schema version.

HTTP request

POST https://{endpoint}/v1/{parent}/schemaVersions:generate

Where {endpoint} is one of the supported service endpoints.

Path parameters

Parameters
parent

string

Required. The parent (project, location and schema) under which to generate the SchemaVersion. Format: projects/{project}/locations/{location}/schemas/{schema} It takes the form projects/{project}/locations/{location}/schemas/{schema}.

Request body

The request body contains data with the following structure:

JSON representation
{
  "generateSchemaVersionParams": {
    object (GenerateSchemaVersionParams)
  },

  // Union field source can be only one of the following:
  "inlineDocuments": {
    object (Documents)
  },
  "rawDocuments": {
    object (RawDocuments)
  },
  "gcsDocuments": {
    object (GcsDocuments)
  },
  "gcsPrefix": {
    object (GcsPrefix)
  },
  "baseSchemaVersion": string
  // End of list of possible types for union field source.
}
Fields
generateSchemaVersionParams

object (GenerateSchemaVersionParams)

Optional. User specified parameters for the schema generation.

Union field source. Source of the documents which will be used for schema generation. source can be only one of the following:
inlineDocuments

object (Documents)

The set of documents specified inline.

rawDocuments

object (RawDocuments)

The set of raw documents.

gcsDocuments

object (GcsDocuments)

The set of documents placed on Cloud Storage.

gcsPrefix

object (GcsPrefix)

The common prefix of documents placed on Cloud Storage.

baseSchemaVersion

string

The base schema version name to use for the schema generation. Format: projects/{project}/locations/{location}/schemas/{schema}/schemaVersions/{schemaVersion}

Response body

Response message for schemaVersions.generate.

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

JSON representation
{
  "schemaVersion": {
    object (SchemaVersion)
  }
}
Fields
schemaVersion

object (SchemaVersion)

The schema version generated by the model.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • documentai.schemaVersions.create

For more information, see the IAM documentation.

Documents

A set of inline documents.

JSON representation
{
  "documents": [
    {
      object (Document)
    }
  ]
}
Fields
documents[]

object (Document)

The list of documents.

RawDocuments

Specifies a set of raw documents.

JSON representation
{
  "documents": [
    {
      object (RawDocument)
    }
  ]
}
Fields
documents[]

object (RawDocument)

Specifies raw document content and mime type.

GenerateSchemaVersionParams

The parameters for the schema generation.

JSON representation
{
  "prompt": string,
  "history": {
    object (SchemaGenerationHistory)
  }
}
Fields
prompt

string

Optional. The prompt used for the schema generation.

history

object (SchemaGenerationHistory)

Optional. Previous prompt-answers in a chronological order.

SchemaGenerationHistory

The history of schema generation iterations.

JSON representation
{
  "iterations": [
    {
      object (SchemaGenerationIteration)
    }
  ]
}
Fields
iterations[]

object (SchemaGenerationIteration)

Required. Previous prompt-answers in a chronological order.

SchemaGenerationIteration

A single iteration of the schema generation.

JSON representation
{
  "prompt": string,
  "generatedSchema": {
    object (SchemaVersion)
  },
  "adjustedSchema": {
    object (SchemaVersion)
  }
}
Fields
prompt

string

Optional. The prompt used for the iteration.

generatedSchema

object (SchemaVersion)

Required. The schema version generated by the model.

adjustedSchema

object (SchemaVersion)

Optional. The previous schema version adjusted by the model.