Skip to content

Recommendation Comments

Operations Engineers are able to give feedback comments to any Recommendation that has been created.

The feedback is a crucial link of information sharing about Kelvin SmartApps™ performance between the Operations Engineers and Developers / Data Scientists.

Unlike the confidence feedback which is embedded in the Recommendation, the comments are kept in a separate location and are linked to the recommendation through the Recommendation key id.

Reference:

Field Description
id Unique UUID identifier.
type Type of process the comments is link to. (e.g. recommendation).
related_to id of the type process.
user_id id of the user who created the comments.
created Date in UTC format when the first comments was made to the related_to process.
updated Date in UTC format when any updated were made to this thread, except when new content is added.
follows List of User ids following this thread (Currently not used)
content The full thread of comments for the related_to process

Get All Recommendation Comments

In this example we will retrieve all recommendation comments

This is not possible in Kelvin UI. You can only view comments for each Recommendation individually.

curl -X 'GET' \
'https://<url.kelvin.ai>/api/v4/threads/list?type=recommendation' \
-H 'Authorization: Bearer <Your Current Token>' \
-H 'accept: application/json'

The response will look like this;

[
{
    "id": "f6db3dbc-45e7-421c-bc4b-695e0e87d3cc",
    "type": "recommendation",
    "related_to": "51f4a1d0-2d99-4c9c-9c23-ba48aec3d991",
    "user_id": "0a02b081-18f8-4b35-b52a-163287955c28",
    "created": "2024-01-24T21:06:28.543Z",
    "updated": "2024-01-24T21:06:28.543Z",
    "follows": {
    "0a02b081-18f8-4b35-b52a-163287955c28": {
        "seen": true,
        "mute": false
    }
    },
    "content": {
    "text": "This needs to be reconsidered due to recent maintenance and change of equipment.",
    "replies": [
        {
        "id": "320ef5ab-adf9-4725-9db7-40836cd1cfd8",
        "user_id": "0a02b081-18f8-4b35-b52a-163287955c28",
        "created": "2024-01-24T21:06:28.639Z",
        "updated": "2024-01-24T21:06:28.639Z",
        "content": {
            "text": "This needs to be reconsidered due to recent maintenance and change of equipment."
        }
        }
        {
        "id": "f83a119e-5a2e-4e67-844c-67931d7e531f",
        "user_id": "84872929-45e7-421c-bc4b-695e0e87d3cc",
        "created": "2024-03-16T03:59:55.284Z",
        "updated": "2024-03-16T03:59:55.284Z",
        "content": {
            "text": "Everything looks ok, could the problem be in the configuration."
        }
        },
        {
        "id": "3e5fffef-6e74-4531-8e70-a68e713147ce",
        "user_id": "84872929-d5d3-4a7e-84c7-4c366f6b6d0d",
        "created": "2024-03-16T04:00:04.501Z",
        "updated": "2024-03-16T04:00:04.501Z",
        "content": {
            "text": "That was the issue. Updating the configuration for new equipment improved the recommendation setpoint."
        }
        }
    ]
},
{
    "id": "34b442b0-2ea1-4e39-a2fb-8bbf74876f4b",
    "type": "recommendation",
    "related_to": "3c2e9038-4e42-4053-9c4c-481e6b7307f9",
    "user_id": "f059885e-e339-42b0-b10c-3b92117bb57f",
    "created": "2024-01-26T08:33:29.564Z",
    "updated": "2024-01-26T08:33:29.564Z",
    "follows": {
    "f059885e-e339-42b0-b10c-3b92117bb57f": {
        "seen": true,
        "mute": false
    }
    },
    "content": {
    "text": "This is not required at this time.",
    "replies": [
        {
        "id": "7957be90-9102-4380-8a82-9e99b9a46c04",
        "user_id": "f059885e-e339-42b0-b10c-3b92117bb57f",
        "created": "2024-01-26T08:33:29.864Z",
        "updated": "2024-01-26T08:33:29.864Z",
        "content": {
            "text": "This is not required at this time."
        }
        }
    ]
    }
    }
}
]
from kelvin.api.client import Client

# Login
client = Client(config={"url": "https://<url.kelvin.ai>", "username": "<your_username>"})
client.login(password="<your_password>")

# List all Recommendations
response = client.thread.list_threads(type="recommendation")
print(response)

The response will look like this;

[Thread(content=ThreadContent(attachments=None, mentions=None, replies=[Reply(content=ThreadContent(attachments=None, mentions=None, replies=None, text='This needs to be reconsidered due to recent maintenance and change of equipment.'), created=datetime.datetime(2024, 1, 24, 21, 6, 28, 639000, tzinfo=datetime.timezone.utc), id='320ef5ab-adf9-4725-9db7-40836cd1cfd8', updated=datetime.datetime(2024, 1, 24, 21, 6, 28, 639000, tzinfo=datetime.timezone.utc), user_id='0a02b081-18f8-4b35-b52a-163287955c28')], text='This needs to be reconsidered due to recent maintenance and change of equipment.'), created=datetime.datetime(2024, 1, 24, 21, 6, 28, 543000, tzinfo=datetime.timezone.utc), follows={'0a02b081-18f8-4b35-b52a-163287955c28': UserFollow(mute=False, seen=True)}, id='f6db3dbc-45e7-421c-bc4b-695e0e87d3cc', related_to='51f4a1d0-2d99-4c9c-9c23-ba48aec3d991', type='recommendation', updated=datetime.datetime(2024, 1, 24, 21, 6, 28, 543000, tzinfo=datetime.timezone.utc), user_id='0a02b081-18f8-4b35-b52a-163287955c28'), Thread(content=ThreadContent(attachments=None, mentions=None, replies=[Reply(content=ThreadContent(attachments=None, mentions=None, replies=None, text='This is not required at this time.'), created=datetime.datetime(2024, 1, 26, 8, 33, 29, 864000, tzinfo=datetime.timezone.utc), id='7957be90-9102-4380-8a82-9e99b9a46c04', updated=datetime.datetime(2024, 1, 26, 8, 33, 29, 864000, tzinfo=datetime.timezone.utc), user_id='f059885e-e339-42b0-b10c-3b92117bb57f')], text='This is not required at this time.'), created=datetime.datetime(2024, 1, 26, 8, 33, 29, 564000, tzinfo=datetime.timezone.utc), follows={'f059885e-e339-42b0-b10c-3b92117bb57f': UserFollow(mute=False, seen=True)}, id='34b442b0-2ea1-4e39-a2fb-8bbf74876f4b', related_to='3c2e9038-4e42-4053-9c4c-481e6b7307f9', type='recommendation', updated=datetime.datetime(2024, 1, 26, 8, 33, 29, 564000, tzinfo=datetime.timezone.utc), user_id='f059885e-e339-42b0-b10c-3b92117bb57f')]

Get all Comments for One Recommendation

In this example we will retrieve all comments for ONE recommendation only.

You will first need to get the id of the Recommendation of interest.

In any Recommendation you can see the thread of comments on the right hand side.

curl -X 'GET' \
'https://<url.kelvin.ai>/api/v4/threads/list?related_to=ded48767-919f-4a90-a591-45de14fd726c' \
-H 'Authorization: Bearer <Your Current Token>' \
-H 'accept: application/json'

The response will look like this;

[
{
    "id": "f6db3dbc-45e7-421c-bc4b-695e0e87d3cc",
    "type": "recommendation",
    "related_to": "ded48767-919f-4a90-a591-45de14fd726c",
    "user_id": "0a02b081-18f8-4b35-b52a-163287955c28",
    "created": "2024-01-24T21:06:28.543Z",
    "updated": "2024-01-24T21:06:28.543Z",
    "follows": {
    "0a02b081-18f8-4b35-b52a-163287955c28": {
        "seen": true,
        "mute": false
    }
    },
    "content": {
    "text": "This needs to be reconsidered due to recent maintenance and change of equipment.",
    "replies": [
        {
        "id": "320ef5ab-adf9-4725-9db7-40836cd1cfd8",
        "user_id": "0a02b081-18f8-4b35-b52a-163287955c28",
        "created": "2024-01-24T21:06:28.639Z",
        "updated": "2024-01-24T21:06:28.639Z",
        "content": {
            "text": "This needs to be reconsidered due to recent maintenance and change of equipment."
        }
        }
        {
        "id": "f83a119e-5a2e-4e67-844c-67931d7e531f",
        "user_id": "84872929-45e7-421c-bc4b-695e0e87d3cc",
        "created": "2024-03-16T03:59:55.284Z",
        "updated": "2024-03-16T03:59:55.284Z",
        "content": {
            "text": "Everything looks ok, could the problem be in the configuration."
        }
        },
        {
        "id": "3e5fffef-6e74-4531-8e70-a68e713147ce",
        "user_id": "84872929-d5d3-4a7e-84c7-4c366f6b6d0d",
        "created": "2024-03-16T04:00:04.501Z",
        "updated": "2024-03-16T04:00:04.501Z",
        "content": {
            "text": "That was the issue. Updating the configuration for new equipment improved the recommendation setpoint."
        }
        }
    ]
}
]
from kelvin.api.client import Client

# Login
client = Client(config={"url": "https://<url.kelvin.ai>", "username": "<your_username>"})
client.login(password="<your_password>")

# List all Recommendations
response = client.thread.list_threads(related_to="51f4a1d0-2d99-4c9c-9c23-ba48aec3d991")
print(response)

The response will look like this;

[Thread(content=ThreadContent(attachments=None, mentions=None, replies=[Reply(content=ThreadContent(attachments=None, mentions=None, replies=None, text='This needs to be reconsidered due to recent maintenance and change of equipment.'), created=datetime.datetime(2024, 1, 24, 21, 6, 28, 639000, tzinfo=datetime.timezone.utc), id='320ef5ab-adf9-4725-9db7-40836cd1cfd8', updated=datetime.datetime(2024, 1, 24, 21, 6, 28, 639000, tzinfo=datetime.timezone.utc), user_id='0a02b081-18f8-4b35-b52a-163287955c28')], text='This needs to be reconsidered due to recent maintenance and change of equipment.'), created=datetime.datetime(2024, 1, 24, 21, 6, 28, 543000, tzinfo=datetime.timezone.utc), follows={'0a02b081-18f8-4b35-b52a-163287955c28': UserFollow(mute=False, seen=True)}, id='f6db3dbc-45e7-421c-bc4b-695e0e87d3cc', related_to='51f4a1d0-2d99-4c9c-9c23-ba48aec3d991', type='recommendation', updated=datetime.datetime(2024, 1, 24, 21, 6, 28, 543000, tzinfo=datetime.timezone.utc), user_id='0a02b081-18f8-4b35-b52a-163287955c28')]