Das Cockpit selbst hat eine REST API, mit welcher du Agenten erstellen, bearbeiten, befragen und löschen, sowie Datenpools und Daten anlegen, bearbeiten und löschen kannst. Damit kannst du das Localmind Cockpit direkt in deine Applikationen anbinden.
Den API-Schlüssel findest du direkt im Cockpit unter “Einstellungen” im Reiter “API Schlüssel”.
Dieser API-Schlüssel ermöglicht Lese- und Schreibrechte auf das Localmind Cockpit, beachte deshalb alle gängigen Best Practices im sicheren Umgang mit API-Schlüsseln.
POST /api/agents/{id}/query
curl --request POST \
--url https://api.cockpit.localmind.ai/agents/{id}/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"conversationId": "<string>",
"filters": {
"custom_ids": [],
"datasource_ids": []
},
"frequencyPenalty": 123,
"maxTokens": 123,
"modelName": "localmind-pro",
"presencePenalty": 123,
"promptTemplate": "<string>",
"promptType": "raw",
"query": "<string>",
"streaming": true,
"systemPrompt": "<string>",
"temperature": 123,
"topP": 123,
"userPrompt": "<string>",
"visitorId": "<string>"
}'
curl --request POST \
--url https://api.cockpit.localmind.ai/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"description": "<string>",
"modelName": "localmind-pro",
"name": "<string>",
"promptTemplate": "<string>",
"promptType": "raw",
"systemPrompt": "<string>",
"temperature": 123,
"userPrompt": "<string>",
"visibility": "public"
}'
POST /api/agents
curl --request POST \
--url https://api.cockpit.localmind.ai/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"description": "<string>",
"modelName": "localmind-pro",
"name": "<string>",
"promptTemplate": "<string>",
"promptType": "raw",
"systemPrompt": "<string>",
"temperature": 0.2,
"userPrompt": "<string>",
"visibility": "public"
}'
{
"description": "<string>",
"id": "<string>",
"modelName": "localmind-pro",
"name": "<string>",
"promptTemplate": "<string>",
"promptType": "raw",
"systemPrompt": "<string>",
"temperature": 123,
"userPrompt": "<string>",
"visibility": "public"
}
GET /api/agents/{id}
curl --request GET \
--url https://api.cockpit.localmind.ai/agents/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'
{
"description": "<string>",
"id": "<string>",
"modelName": "localmind-pro",
"name": "<string>",
"promptTemplate": "<string>",
"promptType": "raw",
"systemPrompt": "<string>",
"temperature": 123,
"userPrompt": "<string>",
"visibility": "public"
}
PATCH /agents/{id}
curl --request PATCH \
--url https://api.cockpit.localmind.ai/agents/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"description": "<string>",
"modelName": "localmind-pro",
"name": "<string>",
"promptTemplate": "<string>",
"promptType": "raw",
"systemPrompt": "<string>",
"temperature": 123,
"userPrompt": "<string>",
"visibility": "public"
}'
{
"description": "<string>",
"id": "<string>",
"modelName": "localmind-pro",
"name": "<string>",
"promptTemplate": "<string>",
"promptType": "raw",
"systemPrompt": "<string>",
"temperature": 123,
"userPrompt": "<string>",
"visibility": "public"
}
DELETE /api/agents/{id}
curl --request DELETE \
--url https://api.cockpit.localmind.ai/agents/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'
{
"description": "<string>",
"id": "<string>",
"modelName": "localmind-pro",
"name": "<string>",
"promptTemplate": "<string>",
"promptType": "raw",
"systemPrompt": "<string>",
"temperature": 123,
"userPrompt": "<string>",
"visibility": "public"
}
POST /api/datastores/{id}/query
curl --request POST \
--url https://api.cockpit.localmind.ai/datastores/{id}/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"filters": {
"custom_ids": [],
"datasource_ids": []
},
"query": "<string>",
"topK": 5
}'
[
{
"datasource_id": "<string>",
"datasource_name": "<string>",
"score": 123,
"source": "<string>",
"text": "<string>"
}
]
POST /api/datastores
curl --request POST \
--url https://api.cockpit.localmind.ai/datastores \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"description": "<string>",
"name": "<string>",
"type": "qdrant"
}'
{
"description": "<string>",
"id": "<string>",
"name": "<string>",
"type": "qdrant",
"visibility": "public"
}
GET /api/datastores/{id}
curl --request GET \
--url https://api.cockpit.localmind.ai/datastores/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'
{
"description": "<string>",
"id": "<string>",
"name": "<string>",
"type": "qdrant",
"visibility": "public"
}
PATCH /api/datastores/{id}
curl --request PATCH \
--url https://api.cockpit.localmind.ai/datastores/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"description": "<string>",
"name": "<string>",
"type": "qdrant"
}'
{
"description": "<string>",
"id": "<string>",
"name": "<string>",
"type": "qdrant",
"visibility": "public"
}
PATCH /api/datastores/{id}
curl --request DELETE \
--url https://api.chaindesk.ai/datastores/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'
{
"description": "<string>",
"id": "<string>",
"name": "<string>",
"type": "qdrant",
"visibility": "public"
}
POST /api/datasources
curl --request POST \
--url https://api.cockpit.localmind.ai/datasources \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"config": {
"sitemap": "<string>",
"source_url": "<string>"
},
"custom_id": "<string>",
"datastoreId": "<string>",
"type": "web_page"
}'
{
"config": {},
"createdAt": "2023-12-25",
"groupId": "<string>",
"id": "<string>",
"lastSynch": "2023-12-25",
"name": "<string>",
"status": "unsynched",
"type": "<string>",
"updatedAt": "2023-12-25"
}
const apiUrl = 'https://api.cockpit.localmind.ai';
const apiKey = 'XXX';
const datastoreId = 'XXX';
const fileName = 'test.pdf';
const buffer = fs.readFileSync(fileName);
const formData = new FormData();
formData.append(
'file',
new Blob([buffer], {
type: 'application/pdf',
}),
fileName
);
formData.append('type', 'file');
formData.append('datastoreId', datastoreId);
formData.append('fileName', fileName);
const res = await fetch(`${apiUrl}/datasources`, {
method: 'POST',
body: formData,
headers: {
Authorization: `Bearer ${apiKey}`,
},
});
const apiUrl = 'https://api.cockpit.localmind.ai';
const apiKey = 'XXX';
const datastoreId = 'XXX';
const res = await fetch(`${apiUrl}/datasources`, {
method: 'POST',
body: JSON.stringify({
datastoreId,
type: 'web_page',
name: 'Nuclear Fusion - Wikipedia',
config: {
source_url: 'https://en.wikipedia.org/wiki/Nuclear_fusion',
},
}),
headers: {
ContentType: 'application/json',
Authorization: `Bearer ${apiKey}`,
},
});
const apiUrl = 'https://api.cockpit.localmind.ai';
const apiKey = 'XXX';
const datastoreId = 'XXX';
const res = await fetch(`${apiUrl}/datasources`, {
method: 'POST',
body: JSON.stringify({
datastoreId,
type: 'web_site',
name: 'Chaindesk Docs',
config: {
// Sitemap
sitemap: 'https://docs.chaindesk.ai/sitemap.xml',
// Or Auto Discovery
source_url: 'https://docs.databerry.ai',
},
}),
headers: {
ContentType: 'application/json',
Authorization: `Bearer ${apiKey}`,
},
});
GET /api/datasources/{id}
curl --request GET \
--url https://api.cockpit.localmind.ai/datasources/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'
{
"config": {},
"createdAt": "2023-12-25",
"groupId": "<string>",
"id": "<string>",
"lastSynch": "2023-12-25",
"name": "<string>",
"status": "unsynched",
"type": "<string>",
"updatedAt": "2023-12-25"
}
DELETE /api/datasources/{id}
curl --request DELETE \
--url https://api.cockpit.localmind.ai/datasources/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'
{
"config": {},
"createdAt": "2023-12-25",
"groupId": "<string>",
"id": "<string>",
"lastSynch": "2023-12-25",
"name": "<string>",
"status": "unsynched",
"type": "<string>",
"updatedAt": "2023-12-25"
}