Skip to main content

Overview

The Chat API enables conversational interactions with your research notebooks. Send messages and receive AI-generated responses based on the notebook’s research content using vector search and retrieval-augmented generation (RAG).

Send Chat Message

POST /chat/message

Send a chat message and receive an AI-generated response

Request

messages
array
required
Array of chat messages in the conversation
notebook_id
string
required
The ID of the notebook to query against
metadata
object
Optional additional metadata for the message

Response

status
string
Status of the request: success
response
string
The AI-generated response to your message

Example Request

curl -X POST https://api.decipherit.com/chat/message \
  -H "Content-Type: application/json" \
  -d '{
    "notebook_id": "nb_123456",
    "messages": [
      {
        "role": "user",
        "content": "What are the key findings about quantum computing?"
      }
    ]
  }'

Example Response

{
  "status": "success",
  "response": "Based on the research in your notebook, the key findings about quantum computing include: 1) Quantum computers leverage quantum superposition and entanglement to process information exponentially faster than classical computers for specific problems. 2) Current applications focus on cryptography, drug discovery, and optimization problems. 3) Major challenges include maintaining qubit coherence and error correction."
}

Multi-turn Conversation

The API supports multi-turn conversations by passing the full message history:
curl -X POST https://api.decipherit.com/chat/message \
  -H "Content-Type: application/json" \
  -d '{
    "notebook_id": "nb_123456",
    "messages": [
      {
        "role": "user",
        "content": "What are the key findings?"
      },
      {
        "role": "assistant",
        "content": "The key findings include..."
      },
      {
        "role": "user",
        "content": "Can you elaborate on the first point?"
      }
    ]
  }'

Example with Metadata

{
  "notebook_id": "nb_123456",
  "messages": [
    {
      "role": "user",
      "content": "Summarize the main points"
    }
  ],
  "metadata": {
    "user_id": "user_789",
    "session_id": "session_xyz"
  }
}

Error Responses

500 Internal Server Error
object

How It Works

  1. Vector Search: Your message is used to search the notebook’s research content using semantic similarity
  2. Context Retrieval: Relevant research sections are retrieved from the vector database
  3. AI Generation: The chat agent generates a response using the retrieved context and conversation history
  4. Response: The generated answer is returned, grounded in your notebook’s research

Best Practices

  • Be Specific: Ask specific questions about the research topic for more focused answers
  • Maintain Context: Include previous messages for coherent multi-turn conversations
  • Notebook Scope: Questions are answered based only on the specified notebook’s research content
  • Error Handling: Implement retry logic for 500 errors as they may be transient

Build docs developers (and LLMs) love