Models API REST

POST Generate chat

POST /models/{modelName}/chat-generations

Operation ID: generateChat. Security: orgJWT.

Generate a response based on a list of messages representing a chat conversation.

Parameters

  • modelName (path, string, required) Configured model name.
  • Authorization (header, string, required) Authorization information that contains the JWT. For guidance, see Access Models API with REST.
    Example: Bearer •••••.
  • x-sfdc-app-context (header, string, required) This value is reserved for future use. For now, specify EinsteinGPT.
    Example: EinsteinGPT.
  • x-client-feature-id (header, string, required) This value is reserved for future use. For now, specify ai-platform-models-connected-app.
    Example: ai-platform-models-connected-app.

Request body (required)

Media type: application/json;charset=utf-8. Schema: ChatGenerationsRequest.

Responses

  • 200 OK

    Media type: application/json. Schema: ChatGenerationsResponse.

  • 400 Bad Request

    Media type: application/json. Schema: Error.

    Example

    {
      "errorCode": "REQUIRED_FIELD_MISSING",
      "messageCode": "EXXXXX",
      "message": "Field is required"
    }
  • 401 Access bearer token is missing or invalid

    Media type: application/json. Schema: Error.

    Example

    {
      "errorCode": "INVALID_AUTH",
      "messageCode": "EXXXXX",
      "message": "Access bearer token is missing or invalid"
    }
  • 403 User forbidden from accessing the resource

    Media type: application/json. Schema: Error.

    Example

    {
      "errorCode": "NOT_FOUND",
      "messageCode": "EXXXXX",
      "message": "User forbidden from accessing the resource"
    }
  • 404 Resource not found or auth token is invalid

    Media type: application/json. Schema: Error.

    Example

    {
      "errorCode": "NOT_FOUND",
      "messageCode": "EXXXXX",
      "message": "Resource not found"
    }
  • 423 Server is busy and cannot process the request at this time

    Media type: application/json. Schema: Error.

    Example

    {
      "errorCode": "NOT_FOUND",
      "messageCode": "EXXXXX",
      "message": "Server is busy and cannot process the request at this time"
    }
  • 429 Too many requests for the server to handle

    Media type: application/json. Schema: Error.

    Example

    {
      "errorCode": "LIMIT_EXCEEDED",
      "messageCode": "EXXXXX",
      "message": "Too many requests for the server to handle"
    }
  • 500 Internal server error

    Media type: application/json. Schema: Error.

    Example

    {
      "errorCode": "INTERNAL_ERROR",
      "messageCode": "EXXXXX",
      "message": "Internal server error"
    }
  • 503 Service is unavailable

    Media type: application/json. Schema: Error.

    Example

    {
      "errorCode": "INTERNAL_ERROR",
      "messageCode": "EXXXXX",
      "message": "Service is unavailable"
    }
  • default Something went wrong

    Media type: application/json. Schema: Error.