# chat.gel.assistant.message

> One message in a chat, from the user or the assistant. A reply's key is the user message's key plus '.r' and the attempt number, such as '.r0' or '.r1'. The app creates the reply with status 'pending' and no content, it fills it in when generation ends. Creating fails if the key is taken, so each attempt gets exactly one reply. Sort replies by attempt number rather than by key, since '.r10' sorts before '.r2'.

- Kind: record
- Record key: any
- Authority: assistant.gel.chat
- Lexicon: 1
- Published by [gel.chat](https://lexicon.garden/identity/did:plc:k2csuyvih44bjf2lex73x56v), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:k2csuyvih44bjf2lex73x56v/chat.gel.assistant.message)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:k2csuyvih44bjf2lex73x56v/chat.gel.assistant.message/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:k2csuyvih44bjf2lex73x56v/chat.gel.assistant.message/analytics)

## Record (`chat.gel.assistant.message`)

Type: record · key any

### Properties

- `content` (union, required)
  - One of: `chat.gel.assistant.defs#plainContent`, `chat.gel.assistant.defs#encryptedContent`
- `createdAt` (string · datetime, required)
- `effort` (ref): The reasoning effort (assistant message).
  - Reference: `chat.gel.assistant.defs#effort`
- `error` (string)
  - Constraints: maxLength: 3000
- `generation` (ref): On a user message, asks the assistant to reply. The app only answers messages written by the chat's owner, and only recent ones: an old unanswered message found during a resync is left alone.
  - Reference: `chat.gel.assistant.defs#generationRequest`
- `model` (ref): The model that generated the response (assistant message).
  - Reference: `chat.gel.assistant.defs#modelRef`
- `parent` (string · record-key): The key of the previous message. Siblings are edits or regenerations.
- `role` (string, required)
  - Constraints: knownValues: user | assistant
- `status` (string): Generation completion status (assistant message).
  - Constraints: knownValues: pending | complete | error | cancelled
- `usage` (ref)
  - Reference: `chat.gel.assistant.defs#usage`

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "One message in a chat, from the user or the assistant. A reply's key is the user message's key plus '.r' and the attempt number, such as '.r0' or '.r1'. The app creates the reply with status 'pending' and no content, it fills it in when generation ends. Creating fails if the key is taken, so each attempt gets exactly one reply. Sort replies by attempt number rather than by key, since '.r10' sorts before '.r2'.",
      "key": "any",
      "record": {
        "properties": {
          "content": {
            "refs": [
              "chat.gel.assistant.defs#plainContent",
              "chat.gel.assistant.defs#encryptedContent"
            ],
            "type": "union"
          },
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "effort": {
            "description": "The reasoning effort (assistant message).",
            "ref": "chat.gel.assistant.defs#effort",
            "type": "ref"
          },
          "error": {
            "maxLength": 3000,
            "type": "string"
          },
          "generation": {
            "description": "On a user message, asks the assistant to reply. The app only answers messages written by the chat's owner, and only recent ones: an old unanswered message found during a resync is left alone.",
            "ref": "chat.gel.assistant.defs#generationRequest",
            "type": "ref"
          },
          "model": {
            "description": "The model that generated the response (assistant message).",
            "ref": "chat.gel.assistant.defs#modelRef",
            "type": "ref"
          },
          "parent": {
            "description": "The key of the previous message. Siblings are edits or regenerations.",
            "format": "record-key",
            "type": "string"
          },
          "role": {
            "knownValues": [
              "user",
              "assistant"
            ],
            "type": "string"
          },
          "status": {
            "description": "Generation completion status (assistant message).",
            "knownValues": [
              "pending",
              "complete",
              "error",
              "cancelled"
            ],
            "type": "string"
          },
          "usage": {
            "ref": "chat.gel.assistant.defs#usage",
            "type": "ref"
          }
        },
        "required": [
          "role",
          "content",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    }
  },
  "id": "chat.gel.assistant.message",
  "lexicon": 1
}
```
