Upsertion

Upsert refers to the process of uploading and processing documents into vector stores, forming the foundation of Retrieval Augmented Generation (RAG) systems.

There are two fundamental ways to upsert data into vector store:

We highly recommend using Document Stores as it provides a unified interface to help with the RAG pipelines - retrieveing data from different sources, chunking strategy, upserting to vector database, syncing with updated data.

In this guide, we are going to cover another method - Chatflow Upsert. This is an older method prior to Document Stores.

For details, see the Vector Upsert Endpoint API Reference.

Understanding the upserting process

Chatflow allows you to create a flow that can do both upserting and RAG querying process, both can be run idenpendently.

Upsert vs. RAG

Setup

For an upsert process to work, we would need to create an upserting flow with 5 different nodes:

  1. Document Loader

  2. Text Splitter

  3. Embedding Model

  4. Vector Store

  5. Record Manager (Optional)

All of the elements have been covered in Document Stores, refer there for more details.

Once flow is setup correctly, there will be a green button at the top right that allows user to start the upsert process.

The upsert process can also be carried out via API:

Base URL and Authentication

Base URL: http://localhost:3000 (or your Flowise instance URL)

Endpoint: POST /api/v1/vector/upsert/:id

Authentication: Refer Authentication for Flows

Request Methods

The API supports two different request methods depending on your chatflow configuration:

1. Form Data (File Upload)

Used when your chatflow contains Document Loaders with file upload capability.

2. JSON Body (No File Upload)

Used when your chatflow uses Document Loaders that don't require file uploads (e.g., web scrapers, database connectors).

Document Loaders with File Upload

Supported Document Types

Document Loader
File Types

CSV File

.csv

Docx/Word File

.docx

JSON File

.json

JSON Lines File

.jsonl

PDF File

.pdf

Text File

.txt

Excel File

.xlsx

Powerpoint File

.pptx

File Loader

Multiple

Unstructured File

Multiple

Important: Ensure the file type matches your Document Loader configuration. For maximum flexibility, consider using the File Loader which supports multiple file types.

Request Format (Form Data)

When uploading files, use multipart/form-data instead of JSON:

Examples

Document Loaders without File Upload

For Document Loaders that don't require file uploads (e.g., web scrapers, database connectors, API integrations), use JSON format similar to the Prediction API.

Examples

Response Fields

Field
Type
Description

numAdded

number

Number of new chunks added to vector store

numDeleted

number

Number of chunks deleted (if using Record Manager)

numSkipped

number

Number of chunks skipped (if using Record Manager)

numUpdated

number

Number of existing chunks updated (if using Record Manager)

Optimization Strategies

1. Batch Processing Strategies

2. Metadata Optimization

Troubleshooting

  1. File Upload Fails

    • Check file format compatibility

    • Verify file size limits

  2. Processing Timeout

    • Increase request timeout

    • Break large files into smaller parts

    • Optimize chunk size

  3. Vector Store Errors

    • Check vector store connectivity

    • Verify embedding model dimension compatibility

Last updated