Chat

Chat with your uploaded files.

POST/chat

Request Body

  • Name
    query
    Required
    Required
    Type
    string
    Description

    Query for which to get related chunks and embeddings.

  • Name
    file_ids
    Required
    Required
    Type
    array
    Description

    Array of file UUIDs to search in. Must contain at least one file ID.

  • Name
    k
    Type
    integer
    Description

    Number of related chunks to return. Default: 3

  • Name
    stream
    Type
    boolean
    Description

    Whether to stream the response. Default: false

JavaScript

const res = await fetch("https://api.supavec.com/chat", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    authorization: apiKey,
  },
  body: JSON.stringify({ query, file_ids: [fileId], stream: true }),
});

Response

// Streaming response
0:"Hello"
0:","
0:" how"
0:" can"
0:" I"
0:" help"
0:" you"
0:" today"
0:"?"

// Non-streaming response
{
  "success": true,
  "text": "Hello, how can I help you today?"
}

Was this page helpful?