This page provides an overview of Assistant Chat threads

Endpoint, URL, and Supported Methods

Objects are managed via the View Assistant server API at [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/assistant/threads

Supported methods include:GET HEAD POST PUT DELETE

Structure

{
    "GUID": "7a359942-62f4-497b-a9af-af7e47d41ce5",
    "Title": "Test Chat Thread",
    "Description": "A test chat thread for development",
    "MessageCount": 1,
    "CreatedUTC": "2025-04-25T09:24:37.587540",
    "LastModifiedUTC": "2025-04-25T09:24:37.587540",
    "AssistantConfigGUID": "12345678-1234-5678-1234-567812345678"
}

Properties

  • GUID string unique identifier for the chat thread
  • Title string title of the chat thread
  • Description string a brief description of the chat thread
  • MessageCount number number of messages in the thread
  • CreatedUTC datetime timestamp when the thread was created, in UTC
  • LastModifiedUTC datetime timestamp of the last modification, in UTC
  • AssistantConfigGUID string GUID of the assistant configuration used for this chat thread

Create chat thread

To create, callPOST /v1.0/tenants/[tenant-guid]/assistant/threads

curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/threads' \
--header 'Content-Type: application/json' \
--data '{
  "Title": "Test Chat Thread",
  "Description": "A test chat thread for development",
  "Messages": [
    {
        "role": "user",
        "content": "What is the capital of France?",
        "metadata": {
            "source": "web interface",
            "client_timestamp": "2024-02-17T10:30:00Z"
        }
    }
  ],
  "AssistantConfigGUID": "12345678-1234-5678-1234-567812345678",
  "Metadata": {
    "tags": ["test", "development"],
    "category": "testing"
  }
}'
import { ViewAssistantSdk } from "view-sdk";

const assistant = new ViewAssistantSdk(
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const createChatThread = async () => {
  try {
    const response = await assistant.crecha({
      Title: "Test Chat Thread [ASHISH]",
      Description: "A test chat thread for development",
      Messages: [
        {
          role: "user",
          content: "What is the capital of France?",
          metadata: {
            source: "web interface",
            client_timestamp: "2024-02-17T10:30:00Z",
          },
        },
      ],
      AssistantConfigGUID: "12345678-1234-5678-1234-567812345678",
      Metadata: {
        tags: ["test", "development"],
        category: "testing",
      },
    });
    console.log(response);
  } catch (err) {
    console.log("Error creating chat thread:", err);
  }
};

createChatThread();

Read

To read chat thread by GUID, call GET /v1.0/tenants/[tenant-guid]/assistant/threads/[thread-guid]

ccurl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/threads/f62f8117-d0ec-45d0-af7a-db6a62898ecd'
import { ViewAssistantSdk } from "view-sdk";

const assistant = new ViewAssistantSdk(
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const readChatThread = async () => {
  try {
    const response = await assistant.retrieveChatThread(
      "4a421edb-a439-4ca2-a6de-08d14dc89d12"
    );
    console.log(response);
  } catch (err) {
    console.log("Error reading chat thread:", err);
  }
};
readChatThread();

Read all

To read al threads, call GET /v1.0/tenants/[tenant-guid]/assistant/threads

curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/threads'
import { ViewAssistantSdk } from "view-sdk";

const assistant = new ViewAssistantSdk(
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const readAllChatThreads = async () => {
  try {
    const response = await assistant.retrieveAllChatThreads();
    console.log(response);
  } catch (err) {
    console.log("Error reading all chat threads:", err);
  }
};

readAllChatThreads();

Response

{
    "ChatThreads": [
        {
            "GUID": "4a421edb-a439-4ca2-a6de-08d14dc89d12",
            "Title": "Test Chat Thread [ASHISH]",
            "Description": "A test chat thread for development",
            "MessageCount": 1,
            "CreatedUTC": "2025-04-25T09:28:01.811483Z",
            "LastModifiedUTC": "2025-04-25T09:28:01.811483Z",
            "AssistantConfigGUID": "12345678-1234-5678-1234-567812345678"
        },
        {
            "GUID": "7a359942-62f4-497b-a9af-af7e47d41ce5",
            "Title": "Test Chat Thread",
            "Description": "A test chat thread for development",
            "MessageCount": 1,
            "CreatedUTC": "2025-04-25T09:24:37.657950Z",
            "LastModifiedUTC": "2025-04-25T09:24:37.657950Z",
            "AssistantConfigGUID": "12345678-1234-5678-1234-567812345678"
        }
    ]
}

Append chat threaad

To append a thread by GUID, call PUT /v1.0/tenants/[tenant-guid]/assistant/threads/[thread-guid]

curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/threads/00000000-0000-0000-0000-000000000000/messages' \
--header 'Content-Type: application/json' \
--data '{
  "role": "assistant",
  "content": "The capital of France is Paris.",
  "metadata": {
    "source_documents": [
      {
        "content": "Paris is the capital and largest city of France.",
        "similarity": 0.89
      }
    ],
    "generation_metrics": {
      "tokens": 8,
      "generation_time": 0.5
    }
  }
}'
import { ViewAssistantSdk } from "view-sdk";

const assistant = new ViewAssistantSdk(
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const appendChatThread = async () => {
  try {
    const response = await assistant.appendChatThread(
      "4a421edb-a439-4ca2-a6de-08d14dc89d12",
      {
        role: "assistant",
        content: "The capital of France is Paris.",
        metadata: {
          source_documents: [
            {
              content: "Paris is the capital and largest city of France.",
              similarity: 0.89,
            },
          ],
          generation_metrics: {
            tokens: 8,
            generation_time: 0.5,
          },
        },
      }
    );
    console.log(response);
  } catch (err) {
    console.log("Error updating chat thread:", err);
  }
};

appendChatThread();

Delete

To read thread by GUID, call DELETE /v1.0/tenants/[tenant-guid]/assistant/threads/[thread-guid]

curl --location --request DELETE 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/threads/00000000-0000-0000-0000-000000000000'
import { ViewAssistantSdk } from "view-sdk";

const assistant = new ViewAssistantSdk(
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const deleteChatThread = async () => {
  try {
    const response = await assistant.deleteChatThread(
      "4a421edb-a439-4ca2-a6de-08d14dc89d12"
    );
    console.log(response);
  } catch (err) {
    console.log("Error deleting chat thread:", err);
  }
};
deleteChatThread();

Check existence

To check existence of a thread by GUID, call HEAD /v1.0/tenants/[tenant-guid]/assistant/threads/[thread-guid]

curl --location --head 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/threads/f62f8117-d0ec-45d0-af7a-db6a62898ecd'
import { ViewAssistantSdk } from "view-sdk";

const assistant = new ViewAssistantSdk(
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
);

const existingChatThread = async () => {
  try {
    const response = await assistant.existsChatThread("4a421edb-a439-4ca2-a6de-08d14dc89d12");
    console.log(response);
  } catch (err) {
    console.log("Error retrieving chat thread:", err);
  }
};
existingChatThread();