ChatBot API

The ChatBot API allows you to try out different Large Language Models (LLMs) from providers like Mistral, OpenAI, and Claude.

For more details on the supported LLM models and their capabilities, please refer to the ChatBot.

Chat with LLM

POST /stream_chat

Headers

Body

Example of Input body parameters :

data = {
    "llm_model": "claude-3-opus-20240229",
    "temperature": 0.5,
    "system_msg": "You are helpful assistatt.Follow the user's instructions carefully. Respond using markdown.",
    "llm": "ClaudeAI",
    "image_analyze": False,
    "enable_tool": True,
    "history": [
        {
            "content": {
                "text": "hey",
                "image_data": []
            },
            "role": "user",
        },
        {  
             "content": {
                "text": "Hello! How can I assist you today?",
                "image_data": []
            },
            "role": "assistant",
        }
    ],
    "tools": {
        "tool_name": "Tavily",
        "tool_type": "InternetSearch",
        "number_of_context": 3,
        "pdf_references": [123]
    },
}

After passing the necessary parameters and executing the Chat API, you will receive a stream response. A successful response will look similar to the following:

Response

{
  "output": null, 
  "error": null, 
  "error_data": null
}

The Chat API response is a streaming response, which means you will receive the output in chunks as the model generates the response. The response will continue to stream until the generation is complete.

The response will contain the following elements:

  • output: This object contains the generated text output from the model.

The text output from the LLM can be obtained from the output parameter. When the response is complete, the final chunk will contain a null value in the output parameter, indicating the end of the stream.

Run the API

To test this API, please use the following link:

Parse File

Use this endpoint to add a PDF, CSV, TXT or DOC/DOCX document to the Qolaba AI database. The API will parse the document and store it in the vector database, returning a unique ID that can be used to retrieve information from the document using the Large Language Model (LLM).

Please note the following guidelines when indexing Document:

  • The PDF, DOC/DOCX file should not exceed 200 pages.

  • The CSV file should not contain more than 30 columns and 500 rows.

  • When uploading a CSV file to the API, the first row must contain the column names. This helps the Large Language Model (LLM) better understand the values in each row of the CSV file.

  • Ensure that the document does not contain any sensitive or confidential information.

The unique ID returned after indexing the document can be used in subsequent requests to the Chat API to retrieve relevant information from the document.

POST /pdfVectorStore

Headers

Body

Response

{
  "output": null, 
  "error": null, 
  "error_data": null
}

Upon successfully indexing a document, the API will return a response with the unique identifier of the indexed document in output parameter.

You can use the unique identifier in subsequent requests to the Chat API to retrieve information from the indexed PDF.

Run the API

To test this API, please use the following link:

Last updated