🪄
OpenIndex.ai API Documentation
  • Introduction
  • Quick Start
  • Reference
    • API Reference
      • Collections
      • Agents
      • Chat
      • Supported models
Powered by GitBook
On this page
  1. Reference
  2. API Reference

Chat

Chat with document collections and AI agents.

PreviousAgentsNextSupported models

Last updated 1 year ago

Please see the list of for the model parameter above.

If you pass true to the parameter streaming, the API will open a stream returning a format (i.e. one json object per line).

supported models
JSON Lines
  • GETRetrieve user chats
  • POSTSend a message to an AI agent or collection.

Retrieve user chats

get
Authorizations
Query parameters
limitintegerOptional

The number of chats to return.

start_afterintegerOptional

The timestamp to start after.

collection_idstringOptional

The ID of the collection.

agent_idstringOptional

The ID of the agent. If no agent_id or collection_id is specified, the default agent "Jack Of All Trades" will be used.

include_emptybooleanOptional

Whether to include empty chats with collections and agents created by the user.

Responses
200
A list of chats.
application/json
get
GET /api/chat HTTP/1.1
Host: www.openindex.ai
Authorization: Bearer JWT
Accept: */*
200

A list of chats.

{
  "ok": true,
  "chats": [
    {
      "id": "text",
      "userId": "text",
      "createdAt": 1,
      "updatedAt": 1,
      "agentId": "text",
      "collectionId": "text",
      "status": "text",
      "current": [
        {}
      ],
      "auto": {},
      "tools": [
        {
          "id": "text",
          "checked": true
        }
      ]
    }
  ]
}

Send a message to an AI agent or collection.

post
Authorizations
Body
chatIdstringOptional

Enter null to create a new conversation or an existing chatId to continue a conversation

agentIdstringOptional
collectionIdstringOptional
messagestringOptional
streamingbooleanOptional
modelstring · enumOptional

Override the model to use for this reply among the list of supported models.

Possible values:
lastUploadedFilestringOptional

Publicly accessible URL of the last uploaded file. Typically used to feed an image to a multi-modal model.

languagestringOptional

2-letter ISO code of the language the model should use to reply.

Default: en
Responses
200
The response to the message from the language model.
application/json
403
Exceeded daily chat allowance.
application/json
500
Error running the language model.
application/json
post
POST /api/chat HTTP/1.1
Host: www.openindex.ai
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 195

{
  "chatId": "text",
  "agentId": "text",
  "collectionId": "text",
  "message": "text",
  "streaming": true,
  "tools": [
    {
      "id": "text",
      "checked": true
    }
  ],
  "model": "gpt-3.5-turbo",
  "lastUploadedFile": "text",
  "language": "en"
}
{
  "ok": true,
  "message": "text",
  "error": "text",
  "sources": [
    "text"
  ],
  "followup": {},
  "context": {},
  "chatId": "text",
  "agentId": "text",
  "collectionId": "text"
}