Chat

Create a chat response

Changed on

Run an assistant turn. The default response is JSON. HTTP clients request server-sent events by setting stream to true in the JSON body. An Accept: text/event-stream header does not replace stream.

post/api/chat

Request

  • Base URL: https://instance-name-be.glean.com
  • URL: https://instance-name-be.glean.com/api/chat
  • Auth: HTTP bearer

Request body

streamfalse required

When true, the HTTP response is text/event-stream. When false or omitted, the HTTP response is application/json.

storeboolean

When true (default), persist the interaction and return a conversation_id. When false, run ephemerally with no persistence.

conversation_idstring

Continue an existing stored conversation. Incompatible with message-array input and with store: false.

Example request

{
  "input": "Summarize our parental leave policy as JSON.",
  "text": {
    "format": {
      "type": "JSON_SCHEMA",
      "name": "policy_summary",
      "schema": {
        "type": "object",
        "properties": {
          "eligible_employees": {
            "type": "string"
          },
          "duration_weeks": {
            "type": "integer"
          }
        },
        "required": [
          "eligible_employees",
          "duration_weeks"
        ]
      },
      "strict": true
    }
  }
}

Response

Successful response.

idstring required

Platform-owned, non-persisted response envelope identifier in resp_<uuid> form. The same identifier is used for every event in one streamed response.

object'RESPONSE' required
created_atstring date-time required

RFC 3339 UTC timestamp when the response was created.

status'COMPLETED' required
storeboolean required
conversation_idstring nullable

Present when the interaction was persisted.

request_idstring required

Changes

    • info

      added the new optional request property ////

    • info

      added the optional property //// to the response with the status

    • info

      added subschema #1 subschema #2 to the /////////// response property anyOf list for the response status

    • info

      removed subschema #1 subschema #2 from the /////////// response property anyOf list for the response status