Get Started
All requests are made to the RagTag API domain ie https://rags.weaveapi.com/api/v1
Requests can only be made using SSL enabled connections.
Headers
The X-RAGS-APIKEY
header is required for all requests
The RagTag API can be obtained from the operational dashboard after signing up for a RagTag account
Enpoints
Each API will have an end point eg /collection
. End points may require additional query parameters (for GET requests) or body parameters (for POST, PUT, PATCH or DELETE requests)
Usage guide
Create collection
A collection is an aggregate of documents in the vector database. It is the equivalent of a database table. The name of a collection must be a string with no spaces
POST /collection
body
{
name: 'context_data'
}
returns
// if successful
{
status: true,
data: 'collection context_data created'
}
// if unsuccessful
{
status: false,
data: 'error creating collection context_data - error message ....'
}
Delete Collection
A collection can be deleted. This action is not reversible
DELETE /collection
body
{
name: 'context_data'
}
returns
// if successful
{
status: true,
data: 'collection context_data deleted'
}
// if unsuccessful
{
status: false,
data: 'error deleting collection context_data - error message ....'
}
Add documents to collection
Documents can be added to a collection. When a document is added to RagTag, it is automatically converted into an embedding so it is ready for semantic search.
A unique id must be provided when adding a document to a collection. If the id is not unique, the document will not added to the collection and the existing document in the collection with that id will remain unchanged. Metadata may also be included when adding the document to the collection (eg pages, chapters, sections, etc). Metadata is included in the request body with the prefix mtd_
POST /collection/collection_name
body
{
id: 'document_1',
mtd_page: 1,
document: 'The quick brown fox jumped over the lazy dog'
}
returns
// if successful
{
status: true,
data: 'document inserted into collection collection_name'
}
// if unsuccessful
{
status: false,
data: 'error inserting document into collection collection_name - error message ....'
}
Deleting document in collection
Documents can be deleted from a collection. This is irreversible.
DELETE /collection/collection_name
body
{
id: 'document_1'
}
returns
// if successful
{
status: true,
data: 'document with id document_1 in collection collection_name deleted'
}
// if unsuccessful
{
status: false,
data: 'error deleting document with id document_1 in collection collection_name - error message ....'
}
Querying documents in collection
The primary purpose of a vector database is to allow querying of documents for semantically similar documents. When a query is sent to RagTag, it automatically converts the query to an embedding and performs a distance search on all documents in the collection
// query = "is the dog faster than the fox"
// number of results to return = 10
GET /collection/collection_name?query=is%20the%20dog%20faster%20than%20the%20fox&results=10
returns
// results
{
status: true,
data: // returned documents
}