GyanBots
API

GyanBots API Documentation

Welcome to GyanBots API, a service that allows you to integrate intelligent assistants into your applications. GyanBots enables you to create and manage threads, send queries, and retrieve responses from the integrated assistant.

Table of Contents

  1. Create Thread
  2. Retrieve Thread
  3. Send Message to the Thread
  4. Poll Run Status

End Point to Use - https://gyanbot.dev/bot-api/

1. Create Thread

POST /assistants/api/v1/threads

Creates a new thread for interacting with the assistant.

Request

{
  "assistant_id": "gyanbot_699012949"
}

Response

{
  "data": {
    "thread_id": "thread_abc123",
    "created_at": "2024-02-05 11:17:23.968601"
  }
}

2. Retrieve Thread

GET /assistants/api/v1/threads/{thread_id}/

Retrieves information about a specific thread, including messages and assistant details.

Response

{
  "data": {
    "id": "thread_abc123",
    "object": "thread",
    "created_at":"2024-02-05 11:17:23.968601",
    "thread_data": {
      "title": "Tell me more about CISSP?",
      "assistant_id": "asst_AeMh6mgRnAG7csBfy4PKB44j",
      "messages": [
        {
          "message_id": 1,
          "query": "Tell me more about CISSP?",
          "status": "pending",
          "created_at": "2024-02-05 11:14:23.968507"
        },
        {
          "message_id": 2,
          "query": "Tell me more about CISSP?",
          "completion": "The Cert  --- answer",
          "status": "completed",
          "created_at": "2024-02-05 11:17:23.968601"
          
        }
      ]
    }
  }
}

3. Send a Message to the Thread

POST /assistants/api/v1/threads/{thread_id}/

Sends a query to the specified thread for processing by the assistant.

Request

{
  "query": "hello"
}

Response

{
    "data": {
        "thread_id": "d52f60e0-86f6-4937-b258-7c68ba72e304",
        "created_at": "2024-02-05 11:28:31.614189",
        "id": "d4547450-183c-45da-95e0-28e4bb7c5302",
        "run_id": "98f6c337-41db-4128-a5de-71db2bc2f775",
        "status": "pending",
        "assistant_id": "ad904605-d27d-4cc4-8b2c-48c0da89180f"
    }
}

4. Poll Run Status

GET /assistants/api/v1/threads/runs/{run_id}/status

Polls the status of a specific run within a thread.

Response

{
    "data": {
        "thread_id": "d52f60e0-86f6-4937-b258-7c68ba72e304",
        "id": "d4547450-183c-45da-95e0-28e4bb7c5302",
        "status": "pending",
        "run_id": "98f6c337-41db-4128-a5de-71db2bc2f775",
        "created_at": "2024-02-05 11:28:31.614189",
        "assistant_id": "ad904605-d27d-4cc4-8b2c-48c0da89180f"
    }
}
{
    "data": {
        "thread_id": "d52f60e0-86f6-4937-b258-7c68ba72e304",
        "id": "d4547450-183c-45da-95e0-28e4bb7c5302",
        "status": "completed",
        "run_id": "98f6c337-41db-4128-a5de-71db2bc2f775",
        "completion": "Hi I am GyanBot!",
        "created_at": "2024-02-05 11:28:31.614189",
        "assistant_id": "ad904605-d27d-4cc4-8b2c-48c0da89180f"
    }
}