Method: projects.locations.endpoints.generateContent

Generate content with multimodal inputs.

HTTP request

POST https://{service-endpoint}/v1beta1/{model}:generateContent

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

Path parameters

Parameters
model

string

Required. The name of the publisher model requested to serve the prediction. Format: projects/{project}/locations/{location}/publishers/*/models/*

Request body

The request body contains data with the following structure:

JSON representation
{
  "contents": [
    {
      object (Content)
    }
  ],
  "tools": [
    {
      object (Tool)
    }
  ],
  "toolConfig": {
    object (ToolConfig)
  },
  "safetySettings": [
    {
      object (SafetySetting)
    }
  ],
  "generationConfig": {
    object (GenerationConfig)
  },
  "systemInstruction": {
    object (Content)
  }
}
Fields
contents[]

object (Content)

Required. The content of the current conversation with the model.

For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request.

tools[]

object (Tool)

Optional. A list of Tools the model may use to generate the next response.

A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.

toolConfig

object (ToolConfig)

Optional. Tool config. This config is shared for all tools provided in the request.

safetySettings[]

object (SafetySetting)

Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates.

generationConfig

object (GenerationConfig)

Optional. Generation config.

systemInstruction

object (Content)

Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.

Response body

If successful, the response body contains an instance of GenerateContentResponse.

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 model resource:

  • aiplatform.endpoints.predict

For more information, see the IAM documentation.