Knowledge Base
Knowledge Base is used to ground generations by agents using Retrieval Augmented Generation (RAG). AI Library provides vector database out of the box.
Create a Knowledge Base
Retrieves a list of all knowledge bases.
Request body
- Name
name
- Type
- string
- Required
- required
- Description
Name of the knowledge base.
- Name
meta
- Type
- json
- Required
- optional
- Description
Meta data of the knowledge base.
Response
Returns the knowledgeId of the created knowledge base.
Body
{
"name": "my first knowledge base"
}
Response
{
"knowledgeId": "myfirstkno_1716198026361802"
}
List all knowledge bases
Retrieves a list of all knowledge bases.
Response
Returns a list of knowledge bases and pagination information.
Response
{
"knowledgebases": [
{
"title": "my first knowledge base",
"knowledgeId": "myfirstkno_1716198026361802",
"status": "available",
"userName": "John Doe",
"visibility": "private",
"star": true,
"meta": {
"description": "Create from Google Colab notebook",
},
"created_timestamp": "2024-05-20 09:40:26",
"updated_timestamp": "2024-05-20 09:40:28"
},
// ...
],
"meta": {
"page": 1,
"total": 66,
"next_page": 2,
"prev_page": 0,
"total_pages": 3,
"next": "/v1/knowledgebase?page=2&collection=&status=&limit=25",
"prev": ""
}
}
Retrieve a Knowledge Base
Retrieves a knowledge base by its ID.
Path parameters
- Name
knowledgeId
- Type
- string
- Required
- required
- Description
ID of the knowledge base.
Response
{
"title": "my first knowledge base",
"knowledgeId": "myfirstkno_1716198026361802",
"status": "available",
"userName": "John Doe",
"visibility": "private",
"star": true,
"meta": {
"description": "Create from Google Colab notebook",
},
"created_timestamp": "2024-05-20 09:40:26",
"updated_timestamp": "2024-05-20 09:40:28"
},
Add Source to Knowledge Base
Add a list of files to a knowledge base.
Request body
- Name
type
- Type
- string
- Required
- required
- Description
Options -
docs
- Name
meta
- Type
- json
- Required
- optional
- Description
Meta data of the knowledge base.
- Name
options
- Type
- object
- Required
- optional
- Description
Meta data of the knowledge base.
- Name
options > urls
- Type
- array
- Required
- optional
- Description
List of URLs to add to the knowledge base.
Accepted file types are PDF, DOCX, PPTX, XLSX, CSV, TXT.
Processing PDF and TXT files are faster than other file types.
Response
Returns the knowledgeId of the created knowledge base.
Body
{
"type": "docs",
"options": {
"urls": [
"https://assets.ctfassets.net/416ywc1laqmd/7oJfDqN7x2Bjj3bXiP3WHR/5866c87cd89c15987bbb7211bfc3f3cc/Update_11_17_23.pdf"
]
},
"meta": {
"folder": "home"
}
}
Response
{
"knowledgeId": "myfirstkno_1716198026361802"
}
Knowledge Base Status
Get the knowledge base status to check if all sources are processed.
Path parameters
- Name
knowledgeId
- Type
- string
- Required
- required
- Description
ID of the knowledge base.
Response
{
"status": "processing",
}
Retrieve Source Details
Use this to retrieve the details of a source file including the contents.
Path parameters
- Name
knowledgeId
- Type
- string
- Required
- required
- Description
ID of the knowledge base.
- Name
sourceId
- Type
- string
- Required
- required
- Description
ID of the source file.
Response
{
"knowledgeId": "myfirstkno_1716198026361802",
"text": "Hello world... ",
"source": "my first knowledge Source.pdf",
"userName": "John Doe",
"created_date": "2024-12-03"
}
List Sources
Use this to retrieve the details of a source file including the contents.
Path parameters
- Name
knowledgeId
- Type
- string
- Required
- required
- Description
ID of the knowledge base.
Returns
List of all sources in the knowledge base.
Response
[
{
"created_timestamp": "2024-12-03 06:40:04",
"id": 3318,
"meta": {
"folder": "home",
"source_type": "docs"
},
"source": "my first knowledge Source.pdf",
"source_type": "docs",
"status": "completed",
"userName": "John Doe"
},
//...
]
Delete Sources
Delete sources from a knowledge base.
- Name
values
- Type
- array
- Required
- required
- Description
List of sources to delete.
Body
{
"values": [
"my first knowledge Source.pdf",
//...
]
}
Response
{
"message": "Deleted successfully"
}