> ## Documentation Index
> Fetch the complete documentation index at: https://docs.puretalk.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Add/Update Task

> Creates a new LLM state for the specified assistant, or update an existing one.

### Children Schema

The `Children` schema represents a state in the LLM (Language Learning Model) with various properties such as `state_id`, `name`, `description`, `prompt`, `parameters`, `position`, and `tools`.

#### Recursive Children Property

One of the key features of the `Children` schema is the `children` property. This property allows a children to have nested childrens, creating a hierarchical structure. Each children can, in turn, have its own children, allowing for a recursive definition of states.

```json theme={null}
{
  "state_id": "a4a4f3fd-cc53-421e-a794-cf6ec47e96b1",
  "name": "warm_intro",
  "description": "warm_intro description",
  "prompt": "## Background about Property...",
  "children": [
    {
      "state_id": "abe03fd0-e093-4bd7-bda0-583c31eed973",
      "name": "callback",
      "description": "Transition to schedule a callback",
      "prompt": "## Background\nBusiness Hour:...",
      "children": []
    },
    {
      "state_id": "3d084435-e5b6-4691-b9ea-b773e2726ebe",
      "name": "schedule_tour",
      "description": "Transition to schedule an in person tour",
      "prompt": "## Background about Property...",
      "children": []
    }
  ]
}
```


## OpenAPI

````yaml openapi-ai-assistants POST /ai-assistants/llm-states/{assistant_id}
openapi: 3.0.1
info:
  title: Puretalk AI
  description: Api Documentation for Puretalk AI
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.puretalk.ai/api
security:
  - ApiKeyAuth: []
paths:
  /ai-assistants/llm-states/{assistant_id}:
    post:
      summary: Create or update LLM state
      description: >-
        Creates a new LLM state for the specified assistant, or update an
        existing one.
      parameters:
        - name: assistant_id
          in: path
          required: true
          schema:
            type: string
          description: The ID of the assistant
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                llm_states:
                  type: array
                  items:
                    $ref: '#/components/schemas/Node'
      responses:
        '200':
          description: LLM states response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Node:
      type: object
      properties:
        state_id:
          type: string
          format: uuid
          description: The state id of the node
        name:
          type: string
          description: The name of the node
        description:
          type: string
          description: The description of the node
        prompt:
          type: string
          description: The prompt of the node
        children:
          type: array
          items:
            $ref: '#/components/schemas/Node'
        parameters:
          type: object
          nullable: true
          description: The parameters of the node
        position:
          type: object
          properties:
            x:
              type: number
              description: The x position of the node
            'y':
              type: number
              description: The y position of the node
        tools:
          type: array
          nullable: true
          items:
            type: object
            properties:
              type:
                type: string
                description: The type of the tool
              functionId:
                type: string
                description: The function id of the tool
              function:
                type: object
                properties:
                  name:
                    type: string
                    description: The name of the tool
                  description:
                    type: string
                    description: The description of the tool
                  parameters:
                    oneOf:
                      - type: object
                        properties:
                          start_time:
                            type: string
                            description: >-
                              Availability check start date in YYYY-MM-DD
                              format, e.g. 2024-06-18
                          end_time:
                            type: string
                            description: >-
                              Availability check end date in YYYY-MM-DD format,
                              e.g. 2024-06-23
                        required:
                          - start_time
                          - end_time
                      - type: object
                        properties:
                          calendar_event_name:
                            type: string
                            description: >-
                              Name of the calendar event, e.g. "Meeting with
                              John"
                          duration:
                            type: number
                            description: Duration of the calendar event in minutes, e.g. 60
                          start_date_time:
                            type: string
                            description: >-
                              Start date and time of the calendar event in
                              YYYY-MM-DDTHH:MM format, e.g. 2024-06-18T14:00
                          end_date_time:
                            type: string
                            description: >-
                              End date and time of the calendar event in
                              YYYY-MM-DDTHH:MM format, e.g. 2024-06-18T15:00
                        required:
                          - calendar_event_name
                          - duration
                          - start_date_time
                          - end_date_time
    Error:
      type: object
      properties:
        err:
          type: boolean
        msg:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Authorization header containing API key. You can find your API key in
        the dashboard under 'API Keys'.

````