diff --git a/.gitignore b/.gitignore index 72b7f5bda0..a26fc2e674 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,13 @@ src/views/Playground/PlaygroundView.vue .edge/ .vulcan specs.json + +.claude/ +.serena/ +claude.md +.z.sh#Paths added by Azion CLI +.edge/ +.vulcan +.open-next +src/services/v2/knowledge-base/ai-studio-api.yaml +docs/* \ No newline at end of file diff --git a/azion.config.mjs b/azion.config.mjs index 881b9392c4..c1b71b79e1 100644 --- a/azion.config.mjs +++ b/azion.config.mjs @@ -246,6 +246,40 @@ const config = { rewrite: `/index.html` } }, + { + name: 'Route Knowledge Base API Requests', + description: + 'Routes Knowledge Base API requests to the API origin, forwarding cookies and bypassing cache. Must be before generic /api rule.', + match: '^/api/v4/workspace/ai/kbs', + behavior: { + setOrigin: { + name: 'origin-api', + type: 'single_origin' + }, + forwardCookies: true, + capture: { + match: '/api/(.*)', + captured: 'captured', + subject: 'request_uri' + }, + rewrite: `/%{captured[1]}`, + bypassCache: true + } + }, + { + name: 'Route Knowledge Base API Direct V4 Requests', + description: + 'Routes direct Knowledge Base v4 API requests to the API origin, forwarding cookies and bypassing cache.', + match: '^/v4/workspace/ai/kbs', + behavior: { + setOrigin: { + name: 'origin-api', + type: 'single_origin' + }, + forwardCookies: true, + bypassCache: true + } + }, { name: 'Route API Default Requests to API Origin', description: 'Routes all default API requests to the specific API origin.', diff --git a/azion/production/args.json b/azion/production/args.json deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/azion/production/args.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/azion/production/azion.json b/azion/production/azion.json deleted file mode 100644 index b68e5dd8d7..0000000000 --- a/azion/production/azion.json +++ /dev/null @@ -1,217 +0,0 @@ -{ - "name": "console_kit_31-07-2024", - "bucket": "consolekit31-07-2024", - "preset": "vue", - "env": "production", - "prefix": "20240731102422", - "not-first-run": true, - "function": { - "id": 27312, - "name": "__DEFAULT__", - "file": ".edge/worker.js", - "args": "azion/production/args.json", - "instance-id": 26354, - "instance-name": "__DEFAULT__", - "cache-id": 0 - }, - "application": { - "id": 1722431647, - "name": "__DEFAULT__" - }, - "domain": { - "id": 1698431301, - "name": "Console PK - Production", - "domain_name": "j65rq1emi4.map.azionedge.net", - "url": "https://j65rq1emi4.map.azionedge.net" - }, - "rt-purge": { - "purge_on_publish": true - }, - "origin": [ - { - "origin-id": 142752, - "origin-key": "ef85b806-9eac-4e47-99a6-f9267a5bd9a4", - "name": "origin-storage-default" - }, - { - "origin-id": 142756, - "origin-key": "dcd816a3-8680-4281-96b9-ce1e8cb05e0d", - "name": "origin-sso" - }, - { - "origin-id": 199947, - "origin-key": "0b7d0aa1-15d0-45c8-8cae-7414007f5798", - "name": "origin-script-runner" - }, - { - "origin-id": 152310, - "origin-key": "1b3c2fd6-4ac1-4063-9ff5-e2b4352f917c", - "name": "origin-marketplace" - }, - { - "origin-id": 142757, - "origin-key": "2654d973-9e40-4b07-ab04-79064c2f6dce", - "name": "origin-api" - }, - { - "origin-id": 142755, - "origin-key": "341ed3e6-59ef-4b9b-a19b-f43a1d1501d4", - "name": "origin-cities" - }, - { - "origin-id": 142751, - "origin-key": "4c361d2f-dbb5-42c0-a6b6-28b0e6e50d91", - "name": "console_kit_31-07-2024_single" - }, - { - "origin-id": 154233, - "origin-key": "8c16e835-20af-41d5-a688-cac8e6aefa94", - "name": "origin-console-feedback" - }, - { - "origin-id": 199946, - "origin-key": "9c6a26e3-07b2-4cb1-8bb7-2040cfb1e60c", - "name": "origin-billing" - }, - { - "origin-id": 199949, - "origin-key": "bbd3561e-ba36-4227-be0b-bcbfd0bd32bd", - "name": "origin-iam-api" - }, - { - "origin-id": 199948, - "origin-key": "bd1c28b8-dc47-4ac4-8079-f05686d4bdee", - "name": "origin-template-engine" - } - ], - "rules-engine": { - "created": false, - "rules": [ - { - "id": 269748, - "name": "Apply Common Configuration for All Requests", - "phase": "request" - }, - { - "id": 269749, - "name": "Set Storage Origin for All Requests", - "phase": "request" - }, - { - "id": 269750, - "name": "Deliver Static Assets from Storage", - "phase": "request" - }, - { - "id": 269751, - "name": "Redirect All Non-Asset Requests to to index.html", - "phase": "request" - }, - { - "id": 269752, - "name": "Route API Default Requests to API Origin", - "phase": "request" - }, - { - "id": 269753, - "name": "Route Specific API Services to Marketplace Origin", - "phase": "request" - }, - { - "id": 269754, - "name": "Route Specific API Services to Template Engine Origin", - "phase": "request" - }, - { - "id": 269755, - "name": "Route Specific API Services to Script Runner Origin", - "phase": "request" - }, - { - "id": 269757, - "name": "Route User Authentication and Account Management to SSO Origin", - "phase": "request" - }, - { - "id": 269758, - "name": "Route GraphQL City Queries to Cities Origin", - "phase": "request" - }, - { - "id": 297983, - "name": "Route Send Feedback", - "phase": "request" - }, - { - "id": 313139, - "name": "Route API Identity Providers", - "phase": "request" - }, - { - "id": 372222, - "name": "API Version 4 Routing", - "phase": "request" - }, - { - "id": 381598, - "name": "Billing PDF", - "phase": "request" - }, - { - "id": 368275, - "name": "Rewrite azrt Cookie in azion.com", - "phase": "response" - }, - { - "id": 368276, - "name": "Rewrite azrt Cookie in azionedge.net", - "phase": "response" - }, - { - "id": 368277, - "name": "Rewrite azsid Cookie in azion.com", - "phase": "response" - }, - { - "id": 368278, - "name": "Rewrite azsid Cookie in azionedge.net", - "phase": "response" - }, - { - "id": 368279, - "name": "Rewrite azat Cookie in azion.com", - "phase": "response" - }, - { - "id": 368280, - "name": "Rewrite azat Cookie in azionedge.net", - "phase": "response" - }, - { - "id": 468656, - "name": "OAuth Security Headers - Login and Signup", - "phase": "response" - }, - { - "id": 468657, - "name": "OAuth Security Headers - GitHub Connection", - "phase": "response" - }, - { - "id": 468658, - "name": "Secure Headers - General", - "phase": "response" - } - ] - }, - "cache-settings": [ - { - "id": 161051, - "name": "Statics - Cache" - }, - { - "id": 161053, - "name": "Cities - Cache" - } - ] -} diff --git a/azion/stage/args.json b/azion/stage/args.json deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/azion/stage/args.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/azion/stage/azion.json b/azion/stage/azion.json deleted file mode 100644 index 580f0e20ca..0000000000 --- a/azion/stage/azion.json +++ /dev/null @@ -1,217 +0,0 @@ -{ - "name": "console-kit-2024-08-21-stage", - "bucket": "console-kit-2024-08-21-stage", - "preset": "vue", - "env": "production", - "prefix": "20240821142547", - "not-first-run": true, - "function": { - "id": 28363, - "name": "__DEFAULT__", - "file": ".edge/worker.js", - "args": "azion/stage/args.json", - "instance-id": 27187, - "instance-name": "__DEFAULT__", - "cache-id": 0 - }, - "application": { - "id": 1724264169, - "name": "__DEFAULT__" - }, - "domain": { - "id": 1697648491, - "name": "Console PK - Stage", - "domain_name": "o3s8583vvw.map.azionedge.net", - "url": "https://o3s8583vvw.map.azionedge.net" - }, - "rt-purge": { - "purge_on_publish": true - }, - "origin": [ - { - "origin-id": 198604, - "origin-key": "265d39ed-7ff8-4329-9e91-864ab678beb3", - "name": "origin-script-runner" - }, - { - "origin-id": 198606, - "origin-key": "5e9245bf-39c5-4722-bc4e-b7389204f012", - "name": "origin-iam-api" - }, - { - "origin-id": 149080, - "origin-key": "7f1dcf08-9e37-476c-8f55-f61e48faab11", - "name": "origin-marketplace" - }, - { - "origin-id": 146192, - "origin-key": "94b3632f-e70d-4104-8a82-e424d014603d", - "name": "origin-storage-default" - }, - { - "origin-id": 146191, - "origin-key": "a21a7881-6408-473a-a632-d4daff3647f7", - "name": "console-kit-2024-08-21-stage_single" - }, - { - "origin-id": 199297, - "origin-key": "affdd612-c68e-40db-b4f6-304f37a3eaeb", - "name": "origin-billing" - }, - { - "origin-id": 146196, - "origin-key": "ba01498b-9831-468d-8886-b89b2b6a0f4a", - "name": "origin-sso" - }, - { - "origin-id": 146197, - "origin-key": "bd236c86-efb4-4e8a-a5e9-851c1788917f", - "name": "origin-api" - }, - { - "origin-id": 146195, - "origin-key": "c92f57e1-79d6-4bcc-9493-2af4ad9f4dd5", - "name": "origin-cities" - }, - { - "origin-id": 153761, - "origin-key": "f1f976fb-0558-4592-a930-dcad70ab2e7c", - "name": "origin-console-feedback" - }, - { - "origin-id": 198605, - "origin-key": "e967f66e-0198-4d32-93b6-1f2f3f5a2571", - "name": "origin-template-engine" - } - ], - "rules-engine": { - "created": false, - "rules": [ - { - "id": 277548, - "name": "Apply Common Configuration for All Requests", - "phase": "request" - }, - { - "id": 277549, - "name": "Set Storage Origin for All Requests", - "phase": "request" - }, - { - "id": 277550, - "name": "Deliver Static Assets from Storage", - "phase": "request" - }, - { - "id": 277551, - "name": "Redirect All Non-Asset Requests to to index.html", - "phase": "request" - }, - { - "id": 277552, - "name": "Route API Default Requests to API Origin", - "phase": "request" - }, - { - "id": 277553, - "name": "Route Specific API Services to Marketplace Origin", - "phase": "request" - }, - { - "id": 277554, - "name": "Route Specific API Services to Template Engine Origin", - "phase": "request" - }, - { - "id": 277555, - "name": "Route Specific API Services to Script Runner Origin", - "phase": "request" - }, - { - "id": 277557, - "name": "Route User Authentication and Account Management to SSO Origin", - "phase": "request" - }, - { - "id": 277558, - "name": "Route GraphQL City Queries to Cities Origin", - "phase": "request" - }, - { - "id": 296641, - "name": "Route Send Feedback", - "phase": "request" - }, - { - "id": 312030, - "name": "Route API Identity Providers", - "phase": "request" - }, - { - "id": 371432, - "name": "API Version 4 Routing", - "phase": "request" - }, - { - "id": 380751, - "name": "Billing PDF", - "phase": "request" - }, - { - "id": 368013, - "name": "Rewrite azrt Cookie in azion.com", - "phase": "response" - }, - { - "id": 368014, - "name": "Rewrite azrt Cookie in azionedge.net", - "phase": "response" - }, - { - "id": 368015, - "name": "Rewrite azsid Cookie in azion.com", - "phase": "response" - }, - { - "id": 368016, - "name": "Rewrite azsid Cookie in azionedge.net", - "phase": "response" - }, - { - "id": 368017, - "name": "Rewrite azat Cookie in azion.com", - "phase": "response" - }, - { - "id": 368018, - "name": "Rewrite azat Cookie in azionedge.net", - "phase": "response" - }, - { - "id": 467683, - "name": "OAuth Security Headers - Login and Signup", - "phase": "response" - }, - { - "id": 467684, - "name": "OAuth Security Headers - GitHub Connection", - "phase": "response" - }, - { - "id": 467685, - "name": "Secure Headers - General", - "phase": "response" - } - ] - }, - "cache-settings": [ - { - "id": 164689, - "name": "Statics - Cache" - }, - { - "id": 164691, - "name": "Cities - Cache" - } - ] -} diff --git a/src/composables/useKnowledgeBase.js b/src/composables/useKnowledgeBase.js new file mode 100644 index 0000000000..50373a3597 --- /dev/null +++ b/src/composables/useKnowledgeBase.js @@ -0,0 +1,171 @@ +import { ref } from 'vue' +import { knowledgeBaseService } from '@/services/v2/knowledge-base/knowledge-base-service' +import { useToast } from 'primevue/usetoast' + +const selectedKnowledgeBase = ref(null) +const selectedDocuments = ref([]) +const isUploading = ref(false) +const documentsToUpload = ref([]) +const uploadedDocuments = ref([]) +const failedDocuments = ref([]) +const uploadStatus = ref({ + current: { name: '' }, + uploaded: 0, + total: 0, + progress: 0 +}) + +export const useKnowledgeBase = () => { + const toast = useToast() + + const handleToast = (severity, summary, message) => { + toast.add({ + severity: severity, + summary: summary, + detail: message, + life: 5000 + }) + } + + const uploadDocuments = async (fileList, kbId, onComplete = null) => { + if (!kbId) { + handleToast('error', 'Error', 'Knowledge Base ID is required') + return + } + + // Reset state before starting new upload + uploadedDocuments.value = [] + failedDocuments.value = [] + + const filesArray = Array.from(fileList) + const maxFileSize = 300 * 1024 * 1024 // 300MB in bytes + const allowedExtensions = ['pdf', 'txt'] + + // Validate files + const validFiles = [] + const oversizedFiles = [] + const invalidTypeFiles = [] + + filesArray.forEach((file) => { + const extension = file.name.split('.').pop().toLowerCase() + + if (!allowedExtensions.includes(extension)) { + invalidTypeFiles.push(file.name) + } else if (file.size > maxFileSize) { + oversizedFiles.push(file.name) + } else { + validFiles.push(file) + } + }) + + // Show validation warnings + if (invalidTypeFiles.length > 0) { + handleToast( + 'warn', + 'Invalid File Types', + `${invalidTypeFiles.length} file${ + invalidTypeFiles.length > 1 ? 's' : '' + } skipped. Only PDF and TXT files are supported.` + ) + } + + if (oversizedFiles.length > 0) { + handleToast( + 'warn', + 'File Size Limit Exceeded', + `${oversizedFiles.length} file${ + oversizedFiles.length > 1 ? 's' : '' + } exceed the 300MB limit and cannot be uploaded.` + ) + } + + if (validFiles.length === 0) { + return + } + + // Start upload process + isUploading.value = true + documentsToUpload.value = validFiles + uploadStatus.value = { + current: { name: '' }, + uploaded: 0, + total: validFiles.length, + progress: 0 + } + + try { + for (let index = 0; index < validFiles.length; index++) { + const file = validFiles[index] + uploadStatus.value.current = { name: file.name } + + try { + await knowledgeBaseService.uploadDocument(kbId, file) + uploadedDocuments.value.push(file) + uploadStatus.value.uploaded = index + 1 + uploadStatus.value.progress = Math.round(((index + 1) / validFiles.length) * 100) + } catch (fileError) { + failedDocuments.value.push({ file, error: fileError }) + uploadStatus.value.uploaded = index + 1 + uploadStatus.value.progress = Math.round(((index + 1) / validFiles.length) * 100) + } + } + + isUploading.value = false + + const successCount = uploadedDocuments.value.length + const failureCount = failedDocuments.value.length + + // Show appropriate feedback + if (successCount > 0) { + handleToast( + failureCount > 0 ? 'warn' : 'success', + failureCount > 0 ? 'Upload Partially Completed' : 'Upload Successful', + failureCount > 0 + ? `${successCount} document${ + successCount > 1 ? 's' : '' + } uploaded successfully, ${failureCount} failed` + : `${successCount} document${successCount > 1 ? 's' : ''} uploaded successfully` + ) + } + + if (failureCount > 0 && successCount === 0) { + handleToast( + 'error', + 'Upload Failed', + `All ${failureCount} document${failureCount > 1 ? 's' : ''} failed to upload` + ) + } + + // Call completion callback if provided + if (onComplete && typeof onComplete === 'function') { + onComplete({ successCount, failureCount }) + } + } catch (error) { + isUploading.value = false + handleToast( + 'error', + 'Upload Failed', + 'An unexpected error occurred during upload. Please try again.' + ) + } + } + + const removeDocuments = async (kbId, documentIds) => { + for (const documentId of documentIds) { + await knowledgeBaseService.deleteDocument(kbId, documentId) + } + } + + return { + selectedKnowledgeBase, + selectedDocuments, + isUploading, + documentsToUpload, + uploadedDocuments, + failedDocuments, + uploadStatus, + uploadDocuments, + removeDocuments, + handleToast + } +} diff --git a/src/composables/useKnowledgeBaseChat.js b/src/composables/useKnowledgeBaseChat.js new file mode 100644 index 0000000000..12aabb4269 --- /dev/null +++ b/src/composables/useKnowledgeBaseChat.js @@ -0,0 +1,144 @@ +import { reactive, computed } from 'vue' +import { knowledgeBaseService } from '@/services/v2/knowledge-base/knowledge-base-service' + +const generateSessionId = () => crypto.randomUUID() + +const state = reactive({ + config: { + kbId: null, + errorMessage: 'Sorry, something went wrong with your query.' + }, + chat: { + sessionId: generateSessionId(), + suggestions: [ + { + icon: 'pi pi-question-circle', + title: 'What is this knowledge base about?', + context: 'What is this knowledge base about?' + }, + { + icon: 'pi pi-list', + title: 'Summarize the key topics', + context: 'Summarize the key topics covered in this knowledge base' + }, + { + icon: 'pi pi-search', + title: 'Search for specific information', + context: 'Can you help me find information about...' + } + ], + messages: [], + contexts: [] + }, + isLoading: false, + startConversation: false +}) + +const initializeConfig = (config) => { + state.config.kbId = config.kbId ?? state.config.kbId + state.config.errorMessage = config.errorMessage || state.config.errorMessage + state.chat.suggestions = config.suggestions || state.chat.suggestions +} + +export function useKnowledgeBaseChat(config) { + if (config) { + initializeConfig(config) + } + + const setKbId = (kbId) => { + state.config.kbId = kbId + } + + const setSuggestions = (suggestions) => { + state.chat.suggestions = suggestions.map(({ icon, title, context }) => ({ + icon: icon || 'pi pi-question-circle', + title, + context + })) + } + + const setErrorMessage = (message) => { + state.config.errorMessage = message + } + + const addMessage = (role, content, status = false, context = null) => { + const message = { + id: generateSessionId(), + role, + content, + timestamp: new Date().toISOString(), + status, + context + } + state.chat.messages.push(message) + return message + } + + const sendQuestion = async (question) => { + if (state.isLoading || !state.config.kbId) return + + state.isLoading = true + addMessage('user', question) + state.startConversation = true + + const systemMessage = addMessage('system', '', true) + + try { + const response = await knowledgeBaseService.askKnowledgeBase( + state.config.kbId, + question, + 5 + ) + + // Update system message with the answer + systemMessage.content = response.answer || 'No answer available.' + systemMessage.context = response.context || [] + systemMessage.status = false + + // Store contexts for potential display + if (response.context && response.context.length > 0) { + state.chat.contexts.push({ + messageId: systemMessage.id, + contexts: response.context + }) + } + } catch (error) { + handleError(error, systemMessage) + } finally { + state.isLoading = false + } + } + + const handleError = (error, message) => { + message.content = state.config.errorMessage + message.status = false + message.context = null + } + + const clearChat = () => { + state.chat.sessionId = generateSessionId() + state.isLoading = false + state.startConversation = false + state.chat.messages = [] + state.chat.contexts = [] + } + + const getContextForMessage = (messageId) => { + const contextEntry = state.chat.contexts.find((entry) => entry.messageId === messageId) + return contextEntry?.contexts || [] + } + + return { + messages: computed(() => state.chat.messages), + isLoading: computed(() => state.isLoading), + suggestions: computed(() => state.chat.suggestions), + getStartConversation: computed(() => state.startConversation), + sendQuestion, + clearChat, + setSuggestions, + setKbId, + setErrorMessage, + getContextForMessage + } +} + diff --git a/src/router/index.js b/src/router/index.js index a8d9c71b8b..0ce01c06c9 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,8 +1,8 @@ import { inject } from 'vue' import { accountRoutes } from '@routes/account-routes' import { activityHistoryRoutes } from '@routes/activity-history-routes' -import { azionAiRoutes } from '@routes/azion-ai-routes' - +import { knowledgeBaseRoutes } from '@routes/knowledge-base-routes' +import { copilotRoutes } from '@routes/copilot-routes' import { cliCallbackRoutes } from '@routes/cli-callback-routes' import { createNewRoutes } from '@routes/create-new-routes' import { compareWithAzionRoutes } from '@routes/compare-with-azion' @@ -94,7 +94,8 @@ const router = createRouter({ githubRoutes, billingRoutes, importGithubRoutes, - azionAiRoutes, + knowledgeBaseRoutes, + copilotRoutes, compareWithAzionRoutes, resellerManagementRoutes, groupsManagementRoutes, diff --git a/src/router/routes/azion-ai-routes/index.js b/src/router/routes/copilot-routes/index.js similarity index 88% rename from src/router/routes/azion-ai-routes/index.js rename to src/router/routes/copilot-routes/index.js index d885ca2f97..a02531bd80 100644 --- a/src/router/routes/azion-ai-routes/index.js +++ b/src/router/routes/copilot-routes/index.js @@ -1,6 +1,5 @@ /** @type {import('vue-router').RouteRecordRaw} */ - -export const azionAiRoutes = { +export const copilotRoutes = { path: '/copilot', name: 'copilot', component: () => import('@views/Copilot/index.vue'), diff --git a/src/router/routes/knowledge-base-routes/index.js b/src/router/routes/knowledge-base-routes/index.js new file mode 100644 index 0000000000..88056cab0a --- /dev/null +++ b/src/router/routes/knowledge-base-routes/index.js @@ -0,0 +1,93 @@ +/** @type {import('vue-router').RouteRecordRaw} */ +export const knowledgeBaseRoutes = { + path: '/ai/knowledge-base', + name: 'knowledge-base', + meta: { + title: 'Knowledge Base' + }, + children: [ + { + path: '', + name: 'knowledge-base-list', + component: () => import('@views/KnowledgeBase/ListView.vue'), + meta: { + title: 'Knowledge Base', + breadCrumbs: [ + { + label: 'AI', + to: '/ai' + }, + { + label: 'Knowledge Base', + to: '/ai/knowledge-base' + } + ] + } + }, + { + path: 'create', + name: 'create-knowledge-base', + component: () => import('@views/KnowledgeBase/View.vue'), + meta: { + title: 'Create Knowledge Base', + breadCrumbs: [ + { + label: 'AI', + to: '/ai' + }, + { + label: 'Knowledge Base', + to: '/ai/knowledge-base' + }, + { + label: 'Create', + to: '/ai/knowledge-base/create' + } + ] + } + }, + { + path: ':id', + name: 'knowledge-base-detail', + component: () => import('@views/KnowledgeBase/DetailView.vue'), + meta: { + title: 'Knowledge Base Details', + breadCrumbs: [ + { + label: 'AI', + to: '/ai' + }, + { + label: 'Knowledge Base', + to: '/ai/knowledge-base' + }, + { + label: 'Details' + } + ] + } + }, + { + path: 'edit/:id', + name: 'edit-knowledge-base', + component: () => import('@views/KnowledgeBase/View.vue'), + props: { mode: 'edit' }, + meta: { + title: 'Edit Knowledge Base', + breadCrumbs: [ + { + label: 'AI', + to: '/ai' + }, + { + label: 'Knowledge Base', + to: '/ai/knowledge-base' + }, + { + label: 'Edit' + } + ] + } + } + ] +} diff --git a/src/services/axios/AxiosHttpClientAdapter.js b/src/services/axios/AxiosHttpClientAdapter.js index 0b8403957f..064c0ecbba 100644 --- a/src/services/axios/AxiosHttpClientAdapter.js +++ b/src/services/axios/AxiosHttpClientAdapter.js @@ -45,14 +45,16 @@ export class AxiosHttpClientAdapter { let axiosResponse try { - axiosResponse = await axios.request({ + const requestDetails = { url: url, method: method, headers: headers, data: body, signal, ...(baseURL && { baseURL: baseURL }) - }) + } + + axiosResponse = await axios.request(requestDetails) } catch (error) { const axiosError = error axiosResponse = axiosError.response diff --git a/src/services/sidebar-menus-services/menus.js b/src/services/sidebar-menus-services/menus.js index dfa0089fe1..185adfcd2c 100644 --- a/src/services/sidebar-menus-services/menus.js +++ b/src/services/sidebar-menus-services/menus.js @@ -131,6 +131,17 @@ function createToolsItems() { ] } +function createAiItems() { + return [ + { + label: 'Knowledge Base', + to: '/ai/knowledge-base', + icon: 'pi pi-book', + id: 'knowledge-base' + } + ] +} + function createEdgeLibrariesItems() { return [ { @@ -237,6 +248,10 @@ export function getMenuItens(showMarketplaceProductsItens) { label: 'Observe', items: createObserveItems() }, + { + label: 'AI', + items: createAiItems() + }, { label: 'Tools', items: createToolsItems() diff --git a/src/services/v2/knowledge-base/ai-studio-api.yaml b/src/services/v2/knowledge-base/ai-studio-api.yaml new file mode 100644 index 0000000000..b4338cbffd --- /dev/null +++ b/src/services/v2/knowledge-base/ai-studio-api.yaml @@ -0,0 +1,5597 @@ +openapi: 3.0.3 +info: + title: ai-studio-api + version: 1.0.0 + description: REST API OpenAPI documentation for the ai-studio-api +paths: + /workspace/ai/kbs: + get: + operationId: list knowledge bases + description: List all knowledge bases owned by your account. + summary: List knowledge bases + parameters: + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - name: ordering + required: false + in: query + description: Which field to use when ordering the results. + schema: + type: string + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - in: query + name: page_size + schema: + type: integer + description: A numeric value that indicates the number of items per page. + - name: search + required: false + in: query + description: A search term. + schema: + type: string + tags: + - AI Studio - Knowledge Bases + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedKnowledgeBaseList' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + post: + operationId: create knowledge base + description: Create a new knowledge base for your account. + summary: Create a knowledge base + tags: + - AI Studio - Knowledge Bases + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/KnowledgeBaseRequest' + required: true + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseKnowledgeBase' + description: '' + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncKnowledgeBase' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/kbs/{kbId}: + get: + operationId: retrive knowledge base + description: Retrieve details from a specific knowledge base in your account. + summary: Retrieve details from a knowledge base + parameters: + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - in: path + name: kbId + schema: + type: string + pattern: ^\d+$ + required: true + tags: + - AI Studio - Knowledge Bases + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseRetrieveKnowledgeBase' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + put: + operationId: update knowledge base + description: Update an existing knowledge base. This replaces the entire knowledge + base with the new data provided. + summary: Update a knowledge base + parameters: + - in: path + name: kbId + schema: + type: string + pattern: ^\d+$ + required: true + tags: + - AI Studio - Knowledge Bases + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/KnowledgeBaseRequest' + required: true + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseKnowledgeBase' + description: Ok + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncKnowledgeBase' + description: Accepted + patch: + operationId: partial update knowledge base + description: Update one or more fields of an existing knowledge base without + affecting other fields. + summary: Partially update a knowledge base + parameters: + - in: path + name: kbId + schema: + type: string + pattern: ^\d+$ + required: true + tags: + - AI Studio - Knowledge Bases + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PatchedKnowledgeBaseRequest' + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseKnowledgeBase' + description: Ok + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncKnowledgeBase' + description: Accepted + delete: + operationId: destroy a knowledge base + description: Destruction of a specific knowledge base in your account. + summary: Destroy a knowledge base + parameters: + - in: path + name: kbId + schema: + type: string + pattern: ^\d+$ + required: true + tags: + - AI Studio - Knowledge Bases + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseDeleteKnowledgeBase' + description: '' + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncDeleteKnowledgeBase' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/kbs/{kbId}/documents: + get: + operationId: list documents + description: List all documents owned by your account. + summary: List documents + parameters: + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - in: path + name: kbId + schema: + type: integer + required: true + - name: ordering + required: false + in: query + description: Which field to use when ordering the results. + schema: + type: string + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - in: query + name: page_size + schema: + type: integer + description: A numeric value that indicates the number of items per page. + - name: search + required: false + in: query + description: A search term. + schema: + type: string + tags: + - AI Studio - Documents + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedDocumentList' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + post: + operationId: create document + description: Create a new document for your account. + summary: Create a document + parameters: + - in: path + name: kbId + schema: + type: integer + required: true + tags: + - AI Studio - Documents + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/DocumentRequest' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/DocumentRequest' + application/json: + schema: + $ref: '#/components/schemas/DocumentRequest' + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseDocument' + description: '' + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncDocument' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/kbs/{kbId}/documents/{documentId}: + get: + operationId: retrive document + description: Retrieve details from a specific document in your account. + summary: Retrieve details from a document + parameters: + - in: path + name: documentId + schema: + type: integer + required: true + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - in: path + name: kbId + schema: + type: integer + required: true + tags: + - AI Studio - Documents + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseRetrieveDocument' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + put: + operationId: update document + description: Update an existing document. This replaces the entire document + with the new data provided. + summary: Update a document + parameters: + - in: path + name: documentId + schema: + type: integer + required: true + - in: path + name: kbId + schema: + type: integer + required: true + tags: + - AI Studio - Documents + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/DocumentRequest' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/DocumentRequest' + application/json: + schema: + $ref: '#/components/schemas/DocumentRequest' + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseDocument' + description: Ok + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncDocument' + description: Accepted + delete: + operationId: destroy a document + description: Destruction of a specific document in your account. + summary: Destroy a document + parameters: + - in: path + name: documentId + schema: + type: integer + required: true + - in: path + name: kbId + schema: + type: integer + required: true + tags: + - AI Studio - Documents + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseDeleteDocument' + description: '' + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncDeleteDocument' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/kbs/{kbId}/documents/{documentId}/chunks: + get: + operationId: list chunks + description: List all chunks owned by your account. + summary: List chunks + parameters: + - in: path + name: documentId + schema: + type: integer + required: true + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - in: path + name: kbId + schema: + type: integer + required: true + - name: ordering + required: false + in: query + description: Which field to use when ordering the results. + schema: + type: string + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - in: query + name: page_size + schema: + type: integer + description: A numeric value that indicates the number of items per page. + - name: search + required: false + in: query + description: A search term. + schema: + type: string + tags: + - AI Studio - Chunks + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedChunkList' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/threads: + get: + operationId: list chat threads + description: List all chat threads owned by your account. + summary: List chat threads + parameters: + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - name: ordering + required: false + in: query + description: Which field to use when ordering the results. + schema: + type: string + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - in: query + name: page_size + schema: + type: integer + description: A numeric value that indicates the number of items per page. + - name: search + required: false + in: query + description: A search term. + schema: + type: string + tags: + - AI Studio - Chat Threads + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedChatThreadList' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + post: + operationId: create chat thread + description: Create a new chat thread for your account. + summary: Create a chat thread + tags: + - AI Studio - Chat Threads + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChatThreadRequest' + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseChatThread' + description: '' + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncChatThread' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/threads/{threadId}: + get: + operationId: retrive chat thread + description: Retrieve details from a specific chat thread in your account. + summary: Retrieve details from a chat thread + parameters: + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - in: path + name: threadId + schema: + type: integer + required: true + tags: + - AI Studio - Chat Threads + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseRetrieveChatThread' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + put: + operationId: update chat thread + description: Update an existing chat thread. This replaces the entire chat thread + with the new data provided. + summary: Update a chat thread + parameters: + - in: path + name: threadId + schema: + type: integer + required: true + tags: + - AI Studio - Chat Threads + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChatThreadRequest' + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseChatThread' + description: Ok + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncChatThread' + description: Accepted + patch: + operationId: partial update chat thread + description: Update one or more fields of an existing chat thread without affecting + other fields. + summary: Partially update a chat thread + parameters: + - in: path + name: threadId + schema: + type: integer + required: true + tags: + - AI Studio - Chat Threads + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PatchedChatThreadRequest' + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseChatThread' + description: Ok + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncChatThread' + description: Accepted + delete: + operationId: destroy a chat thread + description: Destruction of a specific chat thread in your account. + summary: Destroy a chat thread + parameters: + - in: path + name: threadId + schema: + type: integer + required: true + tags: + - AI Studio - Chat Threads + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseDeleteChatThread' + description: '' + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncDeleteChatThread' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/threads/{threadId}/messages: + get: + operationId: list messages + description: List all messages owned by your account. + summary: List messages + parameters: + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - name: ordering + required: false + in: query + description: Which field to use when ordering the results. + schema: + type: string + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - in: query + name: page_size + schema: + type: integer + description: A numeric value that indicates the number of items per page. + - name: search + required: false + in: query + description: A search term. + schema: + type: string + - in: path + name: threadId + schema: + type: integer + required: true + tags: + - AI Studio - Messages + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedMessageList' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + post: + operationId: create message + description: Create a new message for your account. + summary: Create a message + parameters: + - in: path + name: threadId + schema: + type: integer + required: true + tags: + - AI Studio - Messages + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MessageRequest' + required: true + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseMessage' + description: '' + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncMessage' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/threads/{threadId}/messages/{messageId}: + get: + operationId: retrive message + description: Retrieve details from a specific message in your account. + summary: Retrieve details from a message + parameters: + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - in: path + name: messageId + schema: + type: integer + required: true + - in: path + name: threadId + schema: + type: integer + required: true + tags: + - AI Studio - Messages + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseRetrieveMessage' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + put: + operationId: update message + description: Update an existing message. This replaces the entire message with + the new data provided. + summary: Update a message + parameters: + - in: path + name: messageId + schema: + type: integer + required: true + - in: path + name: threadId + schema: + type: integer + required: true + tags: + - AI Studio - Messages + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MessageRequest' + required: true + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseMessage' + description: Ok + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncMessage' + description: Accepted + delete: + operationId: destroy a message + description: Destruction of a specific message in your account. + summary: Destroy a message + parameters: + - in: path + name: messageId + schema: + type: integer + required: true + - in: path + name: threadId + schema: + type: integer + required: true + tags: + - AI Studio - Messages + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseDeleteMessage' + description: '' + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncDeleteMessage' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/tools: + get: + operationId: list tools + description: List all tools owned by your account. + summary: List tools + parameters: + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - name: ordering + required: false + in: query + description: Which field to use when ordering the results. + schema: + type: string + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - in: query + name: page_size + schema: + type: integer + description: A numeric value that indicates the number of items per page. + - name: search + required: false + in: query + description: A search term. + schema: + type: string + tags: + - AI Studio - Tools + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedToolList' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + post: + operationId: create tool + description: Create a new tool for your account. + summary: Create a tool + tags: + - AI Studio - Tools + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ToolRequest' + required: true + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseTool' + description: '' + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncTool' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/tools/{toolId}: + get: + operationId: retrive tool + description: Retrieve details from a specific tool in your account. + summary: Retrieve details from a tool + parameters: + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - in: path + name: toolId + schema: + type: integer + required: true + tags: + - AI Studio - Tools + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseRetrieveTool' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + put: + operationId: update tool + description: Update an existing tool. This replaces the entire tool with the + new data provided. + summary: Update a tool + parameters: + - in: path + name: toolId + schema: + type: integer + required: true + tags: + - AI Studio - Tools + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ToolRequest' + required: true + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseTool' + description: Ok + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncTool' + description: Accepted + patch: + operationId: partial update tool + description: Update one or more fields of an existing tool without affecting + other fields. + summary: Partially update a tool + parameters: + - in: path + name: toolId + schema: + type: integer + required: true + tags: + - AI Studio - Tools + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PatchedToolRequest' + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseTool' + description: Ok + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncTool' + description: Accepted + delete: + operationId: destroy a tool + description: Destruction of a specific tool in your account. + summary: Destroy a tool + parameters: + - in: path + name: toolId + schema: + type: integer + required: true + tags: + - AI Studio - Tools + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseDeleteTool' + description: '' + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAsyncDeleteTool' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/tools/{toolId}/kbs: + get: + operationId: list knowledge bases linked to a tool + description: List all knowledge bases linked to a specific tool in your account. + summary: List knowledge bases linked to a tool + parameters: + - in: query + name: fields + schema: + type: string + description: Comma-separated list of field names to include in the response. + - name: ordering + required: false + in: query + description: Which field to use when ordering the results. + schema: + type: string + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - name: page_size + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: search + required: false + in: query + description: A search term. + schema: + type: string + - in: path + name: toolId + schema: + type: integer + required: true + tags: + - AI Studio - Tools + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedKnowledgeBaseList' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + post: + operationId: add knowledge base to a tool + description: Add a new knowledge base to a specific tool for your account. + summary: Add a knowledge base to a tool + parameters: + - in: path + name: toolId + schema: + type: integer + required: true + tags: + - AI Studio - Tools + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ToolRequest' + required: true + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/ToolKBLink' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled + /workspace/ai/tools/{toolId}/kbs/{kbId}: + delete: + operationId: remove knowledge base from a tool + description: Remove a specific knowledge base from a tool in your account. + summary: Remove a knowledge base from a tool + parameters: + - in: path + name: kbId + schema: + type: integer + required: true + - in: path + name: toolId + schema: + type: integer + required: true + tags: + - AI Studio - Tools + security: + - TokenAuth: [] + - BearerAuth: [] + responses: + '204': + description: No response body + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10001: + value: + errors: + - status: '401' + code: '10001' + title: Authentication Failed + detail: Invalid authentication credentials. + summary: Authentication Failed + description: Invalid authentication credentials. + description: Authentication Failed + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10003: + value: + errors: + - status: '403' + code: '10003' + title: Permission Denied + detail: You do not have permission to perform this action. + summary: Permission Denied + description: You do not have permission to perform this action. + description: Permission Denied + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10000: + value: + errors: + - status: '400' + code: '10000' + title: Validation Error + detail: Invalid data provided in the request. + summary: Validation Error + description: Invalid data provided in the request. + description: Validation Error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10004: + value: + errors: + - status: '404' + code: '10004' + title: Not Found + detail: Not found. + summary: Not Found + description: Not found. + description: Not Found + '405': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10007: + value: + errors: + - status: '405' + code: '10007' + title: Method Not Allowed + detail: Method "{method}" not allowed. + summary: Method Not Allowed + description: Method "{method}" not allowed. + description: Method Not Allowed + '406': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10005: + value: + errors: + - status: '406' + code: '10005' + title: Not Acceptable + detail: Could not satisfy the request Accept header. + summary: Not Acceptable + description: Could not satisfy the request Accept header. + description: Not Acceptable + '429': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + examples: + Error-10010: + value: + errors: + - status: '429' + code: '10010' + title: Throttled + detail: Request was throttled. + summary: Throttled + description: Request was throttled. + description: Throttled +components: + schemas: + ChatThread: + type: object + properties: + thread_id: + type: integer + readOnly: true + account_id: + type: integer + readOnly: true + nullable: true + name: + type: string + maxLength: 255 + description: + type: string + last_modified: + type: string + format: date-time + readOnly: true + last_editor: + type: string + readOnly: true + required: + - account_id + - last_editor + - last_modified + - thread_id + title: ChatThread + additionalProperties: false + ChatThreadRequest: + type: object + properties: + name: + type: string + maxLength: 255 + description: + type: string + title: ChatThreadRequest + additionalProperties: false + Chunk: + type: object + properties: + chunk_id: + type: integer + readOnly: true + document_id: + type: integer + readOnly: true + name: + type: string + maxLength: 255 + description: + type: string + embedding: + type: object + additionalProperties: {} + metadata: + type: object + additionalProperties: {} + content: + type: string + required: + - chunk_id + - content + - document_id + title: Chunk + additionalProperties: false + Document: + type: object + properties: + document_id: + type: integer + readOnly: true + kb_id: + type: integer + readOnly: true + name: + type: string + description: + type: string + type: + type: string + source_uri: + type: string + maxLength: 1024 + chunk_strategy: + type: object + additionalProperties: {} + status: + allOf: + - $ref: '#/components/schemas/StatusEnum' + readOnly: true + last_modified: + type: string + format: date-time + readOnly: true + last_editor: + type: string + readOnly: true + required: + - document_id + - kb_id + - last_editor + - last_modified + - status + title: Document + additionalProperties: false + DocumentRequest: + type: object + properties: + name: + type: string + description: + type: string + type: + type: string + source_uri: + type: string + maxLength: 1024 + chunk_strategy: + type: object + additionalProperties: {} + title: DocumentRequest + additionalProperties: false + EmbeddingModelEnum: + enum: + - text-embedding-3-small + type: string + description: '* `text-embedding-3-small` - text-embedding-3-small' + title: EmbeddingModelEnum + additionalProperties: false + JSONAPIErrorObject: + type: object + description: Serializer for a single JSON:API error object. + properties: + status: + type: string + description: The HTTP status code applicable to this problem + pattern: ^\d{3}$ + maxLength: 3 + minLength: 3 + code: + type: string + description: An application-specific error code + pattern: ^\d{5}$ + maxLength: 5 + minLength: 5 + title: + type: string + description: A short, human-readable summary of the problem + pattern: ^.*$ + maxLength: 4096 + minLength: 1 + detail: + type: string + description: A human-readable explanation specific to this occurrence of + the problem + pattern: ^.*$ + maxLength: 4096 + minLength: 1 + source: + allOf: + - $ref: '#/components/schemas/JSONAPIErrorSource' + description: References to the primary source of the error + meta: + type: object + additionalProperties: {} + description: Non-standard meta-information about the error + title: JSONAPIErrorObject + additionalProperties: false + JSONAPIErrorResponse: + type: object + description: Serializer for a JSON:API error response. + properties: + errors: + type: array + items: + $ref: '#/components/schemas/JSONAPIErrorObject' + description: Array of error objects + required: + - errors + title: JSONAPIErrorResponse + additionalProperties: false + JSONAPIErrorSource: + type: object + description: Serializer for the 'source' object in a JSON:API error. + properties: + pointer: + type: string + description: JSON Pointer to the value in the request document that caused + the error + pattern: ^(/[^/]+)+$ + maxLength: 4096 + minLength: 1 + parameter: + type: string + description: URI query parameter that caused the error + pattern: ^.*$ + maxLength: 4096 + minLength: 1 + header: + type: string + description: Request header name that caused the error + pattern: ^.*$ + maxLength: 4096 + minLength: 1 + title: JSONAPIErrorSource + additionalProperties: false + KnowledgeBase: + type: object + properties: + kb_id: + type: integer + readOnly: true + account_id: + type: integer + readOnly: true + nullable: true + name: + type: string + pattern: ^[A-Za-z0-9-]{6,50}$ + description: + type: string + embedding_model: + allOf: + - $ref: '#/components/schemas/EmbeddingModelEnum' + default: text-embedding-3-small + sql_id: + type: string + readOnly: true + sql_db_name: + type: string + readOnly: true + storage_name: + type: string + readOnly: true + last_modified: + type: string + format: date-time + readOnly: true + last_editor: + type: string + readOnly: true + required: + - account_id + - kb_id + - last_editor + - last_modified + - name + - sql_db_name + - sql_id + - storage_name + title: KnowledgeBase + additionalProperties: false + KnowledgeBaseRequest: + type: object + properties: + name: + type: string + minLength: 1 + pattern: ^[A-Za-z0-9-]{6,50}$ + description: + type: string + embedding_model: + allOf: + - $ref: '#/components/schemas/EmbeddingModelEnum' + default: text-embedding-3-small + required: + - name + title: KnowledgeBaseRequest + additionalProperties: false + Message: + type: object + properties: + message_id: + type: integer + readOnly: true + thread_id: + type: integer + readOnly: true + last_editor: + type: string + readOnly: true + name: + type: string + maxLength: 255 + description: + type: string + message: + type: object + additionalProperties: {} + metadata: + type: object + additionalProperties: {} + last_modified: + type: string + format: date-time + readOnly: true + required: + - last_editor + - last_modified + - message + - message_id + - thread_id + title: Message + additionalProperties: false + MessageRequest: + type: object + properties: + name: + type: string + maxLength: 255 + description: + type: string + message: + type: object + additionalProperties: {} + metadata: + type: object + additionalProperties: {} + required: + - message + title: MessageRequest + additionalProperties: false + PaginatedChatThreadList: + type: object + properties: + count: + type: integer + minimum: 0 + maximum: 2147483647 + example: 123 + results: + type: array + items: + $ref: '#/components/schemas/ChatThread' + title: PaginatedChatThreadList + additionalProperties: false + PaginatedChunkList: + type: object + properties: + count: + type: integer + minimum: 0 + maximum: 2147483647 + example: 123 + results: + type: array + items: + $ref: '#/components/schemas/Chunk' + title: PaginatedChunkList + additionalProperties: false + PaginatedDocumentList: + type: object + properties: + count: + type: integer + minimum: 0 + maximum: 2147483647 + example: 123 + results: + type: array + items: + $ref: '#/components/schemas/Document' + title: PaginatedDocumentList + additionalProperties: false + PaginatedKnowledgeBaseList: + type: object + properties: + count: + type: integer + minimum: 0 + maximum: 2147483647 + example: 123 + results: + type: array + items: + $ref: '#/components/schemas/KnowledgeBase' + title: PaginatedKnowledgeBaseList + additionalProperties: false + PaginatedMessageList: + type: object + properties: + count: + type: integer + minimum: 0 + maximum: 2147483647 + example: 123 + results: + type: array + items: + $ref: '#/components/schemas/Message' + title: PaginatedMessageList + additionalProperties: false + PaginatedToolList: + type: object + properties: + count: + type: integer + minimum: 0 + maximum: 2147483647 + example: 123 + results: + type: array + items: + $ref: '#/components/schemas/Tool' + title: PaginatedToolList + additionalProperties: false + PatchedChatThreadRequest: + type: object + properties: + name: + type: string + maxLength: 255 + description: + type: string + title: PatchedChatThreadRequest + additionalProperties: false + PatchedKnowledgeBaseRequest: + type: object + properties: + name: + type: string + minLength: 1 + pattern: ^[A-Za-z0-9-]{6,50}$ + description: + type: string + embedding_model: + allOf: + - $ref: '#/components/schemas/EmbeddingModelEnum' + default: text-embedding-3-small + title: PatchedKnowledgeBaseRequest + additionalProperties: false + PatchedToolRequest: + type: object + properties: + name: + type: string + minLength: 1 + maxLength: 255 + description: + type: string + type: + type: string + minLength: 1 + maxLength: 100 + json_schema: + type: object + additionalProperties: {} + active: + type: boolean + title: PatchedToolRequest + additionalProperties: false + ResponseAsyncChatThread: + type: object + properties: + state: + type: string + default: pending + pattern: .* + maxLength: 8 + minLength: 1 + data: + $ref: '#/components/schemas/ChatThread' + required: + - data + title: ResponseAsyncChatThread + additionalProperties: false + ResponseAsyncDeleteChatThread: + type: object + properties: + state: + type: string + default: pending + pattern: .* + maxLength: 8 + minLength: 1 + title: ResponseAsyncDeleteChatThread + additionalProperties: false + ResponseAsyncDeleteDocument: + type: object + properties: + state: + type: string + default: pending + pattern: .* + maxLength: 8 + minLength: 1 + title: ResponseAsyncDeleteDocument + additionalProperties: false + ResponseAsyncDeleteKnowledgeBase: + type: object + properties: + state: + type: string + default: pending + pattern: .* + maxLength: 8 + minLength: 1 + title: ResponseAsyncDeleteKnowledgeBase + additionalProperties: false + ResponseAsyncDeleteMessage: + type: object + properties: + state: + type: string + default: pending + pattern: .* + maxLength: 8 + minLength: 1 + title: ResponseAsyncDeleteMessage + additionalProperties: false + ResponseAsyncDeleteTool: + type: object + properties: + state: + type: string + default: pending + pattern: .* + maxLength: 8 + minLength: 1 + title: ResponseAsyncDeleteTool + additionalProperties: false + ResponseAsyncDocument: + type: object + properties: + state: + type: string + default: pending + pattern: .* + maxLength: 8 + minLength: 1 + data: + $ref: '#/components/schemas/Document' + required: + - data + title: ResponseAsyncDocument + additionalProperties: false + ResponseAsyncKnowledgeBase: + type: object + properties: + state: + type: string + default: pending + pattern: .* + maxLength: 8 + minLength: 1 + data: + $ref: '#/components/schemas/KnowledgeBase' + required: + - data + title: ResponseAsyncKnowledgeBase + additionalProperties: false + ResponseAsyncMessage: + type: object + properties: + state: + type: string + default: pending + pattern: .* + maxLength: 8 + minLength: 1 + data: + $ref: '#/components/schemas/Message' + required: + - data + title: ResponseAsyncMessage + additionalProperties: false + ResponseAsyncTool: + type: object + properties: + state: + type: string + default: pending + pattern: .* + maxLength: 8 + minLength: 1 + data: + $ref: '#/components/schemas/Tool' + required: + - data + title: ResponseAsyncTool + additionalProperties: false + ResponseChatThread: + type: object + properties: + state: + type: string + default: executed + pattern: .* + maxLength: 8 + minLength: 1 + data: + $ref: '#/components/schemas/ChatThread' + required: + - data + title: ResponseChatThread + additionalProperties: false + ResponseDeleteChatThread: + type: object + properties: + state: + type: string + default: executed + pattern: .* + maxLength: 8 + minLength: 1 + title: ResponseDeleteChatThread + additionalProperties: false + ResponseDeleteDocument: + type: object + properties: + state: + type: string + default: executed + pattern: .* + maxLength: 8 + minLength: 1 + title: ResponseDeleteDocument + additionalProperties: false + ResponseDeleteKnowledgeBase: + type: object + properties: + state: + type: string + default: executed + pattern: .* + maxLength: 8 + minLength: 1 + title: ResponseDeleteKnowledgeBase + additionalProperties: false + ResponseDeleteMessage: + type: object + properties: + state: + type: string + default: executed + pattern: .* + maxLength: 8 + minLength: 1 + title: ResponseDeleteMessage + additionalProperties: false + ResponseDeleteTool: + type: object + properties: + state: + type: string + default: executed + pattern: .* + maxLength: 8 + minLength: 1 + title: ResponseDeleteTool + additionalProperties: false + ResponseDocument: + type: object + properties: + state: + type: string + default: executed + pattern: .* + maxLength: 8 + minLength: 1 + data: + $ref: '#/components/schemas/Document' + required: + - data + title: ResponseDocument + additionalProperties: false + ResponseKnowledgeBase: + type: object + properties: + state: + type: string + default: executed + pattern: .* + maxLength: 8 + minLength: 1 + data: + $ref: '#/components/schemas/KnowledgeBase' + required: + - data + title: ResponseKnowledgeBase + additionalProperties: false + ResponseMessage: + type: object + properties: + state: + type: string + default: executed + pattern: .* + maxLength: 8 + minLength: 1 + data: + $ref: '#/components/schemas/Message' + required: + - data + title: ResponseMessage + additionalProperties: false + ResponseRetrieveChatThread: + type: object + properties: + data: + $ref: '#/components/schemas/ChatThread' + required: + - data + title: ResponseRetrieveChatThread + additionalProperties: false + ResponseRetrieveDocument: + type: object + properties: + data: + $ref: '#/components/schemas/Document' + required: + - data + title: ResponseRetrieveDocument + additionalProperties: false + ResponseRetrieveKnowledgeBase: + type: object + properties: + data: + $ref: '#/components/schemas/KnowledgeBase' + required: + - data + title: ResponseRetrieveKnowledgeBase + additionalProperties: false + ResponseRetrieveMessage: + type: object + properties: + data: + $ref: '#/components/schemas/Message' + required: + - data + title: ResponseRetrieveMessage + additionalProperties: false + ResponseRetrieveTool: + type: object + properties: + data: + $ref: '#/components/schemas/Tool' + required: + - data + title: ResponseRetrieveTool + additionalProperties: false + ResponseTool: + type: object + properties: + state: + type: string + default: executed + pattern: .* + maxLength: 8 + minLength: 1 + data: + $ref: '#/components/schemas/Tool' + required: + - data + title: ResponseTool + additionalProperties: false + StatusEnum: + enum: + - queued + - processing + - indexed + type: string + description: |- + * `queued` - queued + * `processing` - processing + * `indexed` - indexed + title: StatusEnum + additionalProperties: false + Tool: + type: object + properties: + tool_id: + type: integer + readOnly: true + name: + type: string + maxLength: 255 + description: + type: string + type: + type: string + maxLength: 100 + json_schema: + type: object + additionalProperties: {} + active: + type: boolean + kbs: + type: string + readOnly: true + last_modified: + type: string + format: date-time + readOnly: true + last_editor: + type: string + readOnly: true + required: + - kbs + - last_editor + - last_modified + - name + - tool_id + - type + title: Tool + additionalProperties: false + ToolKBLink: + type: object + properties: + tool_kb_id: + type: integer + readOnly: true + kb_id: + type: integer + readOnly: true + required: + - kb_id + - tool_kb_id + title: ToolKBLink + additionalProperties: false + ToolRequest: + type: object + properties: + name: + type: string + minLength: 1 + maxLength: 255 + description: + type: string + type: + type: string + minLength: 1 + maxLength: 100 + json_schema: + type: object + additionalProperties: {} + active: + type: boolean + required: + - name + - type + title: ToolRequest + additionalProperties: false + securitySchemes: + BearerAuth: + type: http + scheme: bearer + TokenAuth: + type: apiKey + in: header + name: Authorization + description: Token-based authentication with required prefix "Token" diff --git a/src/services/v2/knowledge-base/knowledge-base-adapter.js b/src/services/v2/knowledge-base/knowledge-base-adapter.js new file mode 100644 index 0000000000..6bf42c8581 --- /dev/null +++ b/src/services/v2/knowledge-base/knowledge-base-adapter.js @@ -0,0 +1,68 @@ +import { adaptServiceDataResponse } from '@/services/v2/utils/adaptServiceDataResponse' +import { formatDateToDayMonthYearHour } from '@/helpers/convert-date' + +const transformMap = { + id: (value) => value.kb_id, + kbId: (value) => value.kb_id, + accountId: (value) => value.account_id, + name: (value) => value.name, + description: (value) => value.description, + embeddingModel: (value) => value.embedding_model, + sqlId: (value) => value.sql_id, + sqlDbName: (value) => value.sql_db_name, + storageName: (value) => value.storage_name, + storage: (value) => value.storage_name, + lastModified: (value) => formatDateToDayMonthYearHour(value.last_modified), + lastEditor: (value) => value.last_editor +} + +const documentTransformMap = { + id: (value) => value.document_id, + documentId: (value) => value.document_id, + name: (value) => value.name, + filename: (value) => value.filename, + type: (value) => value.type, + status: (value) => value.status, + size: (value) => value.size, + createdAt: (value) => formatDateToDayMonthYearHour(value.created_at), + uploadedAt: (value) => formatDateToDayMonthYearHour(value.uploaded_at), + processedAt: (value) => formatDateToDayMonthYearHour(value.processed_at), + lastModified: (value) => formatDateToDayMonthYearHour(value.last_modified), + lastEditor: (value) => value.last_editor +} + +export const KnowledgeBaseAdapter = { + transformListKnowledgeBases(data, fields) { + const { results, count } = data + const adapt = adaptServiceDataResponse(results, fields, transformMap) + + return { + count, + body: adapt + } + }, + + transformLoadKnowledgeBase(data) { + return { + id: data.kb_id, + name: data.name, + description: data.description, + embedding_model: data.embedding_model, + sqlId: data.sql_id, + sqlDbName: data.sql_db_name, + storageName: data.storage_name, + lastModified: data.last_modified, + lastEditor: data.last_editor + } + }, + + transformListDocuments(data, fields) { + const { results, count } = data + const adapt = adaptServiceDataResponse(results, fields, documentTransformMap) + + return { + count, + body: adapt + } + } +} diff --git a/src/services/v2/knowledge-base/knowledge-base-service.js b/src/services/v2/knowledge-base/knowledge-base-service.js new file mode 100644 index 0000000000..4d4d030023 --- /dev/null +++ b/src/services/v2/knowledge-base/knowledge-base-service.js @@ -0,0 +1,170 @@ +import { BaseService } from '@/services/v2/base/query/baseService' +import { KnowledgeBaseAdapter } from './knowledge-base-adapter' + +export class KnowledgeBaseService extends BaseService { + constructor() { + super() + this.adapter = KnowledgeBaseAdapter + this.baseURL = '/api/v4/workspace/ai/kbs' + } + + listKnowledgeBases = async (params = {}) => { + const response = await this.http.request({ + method: 'GET', + url: this.baseURL, + params: { + search: '', + fields: '', + ordering: 'name', + page: 1, + page_size: 100, + ...params + } + }) + + // API returns PaginatedKnowledgeBaseList: { count, results: KnowledgeBase[] } + return this.adapter.transformListKnowledgeBases(response.data, params.fields) + } + + createKnowledgeBase = async (payload = {}) => { + const adaptedPayload = { + name: payload?.name, + description: payload?.description, + embedding_model: payload?.embedding_model + } + + const response = await this.http.request({ + method: 'POST', + url: this.baseURL, + body: adaptedPayload + }) + + // API returns { data: { data: { ...created KB... } } } + const actualData = response.data?.data || response.data + return { + feedback: 'Your Knowledge Base item has been created', + urlToEditView: `/ai/knowledge-base/edit/${actualData.kb_id}`, + knowledgeBaseId: actualData.kb_id, + data: actualData + } + } + + loadKnowledgeBase = async (id) => { + const response = await this.http.request({ + method: 'GET', + url: `${this.baseURL}/${id}` + }) + + // API returns { data: { data: { ...actual data... } } } + const actualData = response.data?.data || response.data + return this.adapter.transformLoadKnowledgeBase(actualData) + } + + updateKnowledgeBase = async (id, payload = {}) => { + const adaptedPayload = { + name: payload?.name, + description: payload?.description, + embedding_model: payload?.embedding_model + } + + await this.http.request({ + method: 'PATCH', + url: `${this.baseURL}/${id}`, + body: adaptedPayload + }) + + return 'Knowledge Base updated successfully' + } + + deleteKnowledgeBase = async (item) => { + await this.http.request({ + method: 'DELETE', + url: `${this.baseURL}/${item.kbId}` + }) + + return 'Knowledge Base deleted successfully' + } + + // Document-related methods + listDocuments = async (kbId, params = {}) => { + const response = await this.http.request({ + method: 'GET', + url: `${this.baseURL}/${kbId}/documents`, + params: { + search: '', + fields: '', + ordering: 'name', + page: 1, + page_size: 100, + ...params + } + }) + + // API returns { data: { data: { results: [...], count: N } } } + const actualData = response.data?.data || response.data + return this.adapter.transformListDocuments(actualData, params.fields) + } + + uploadDocument = async (kbId, file, onProgress = null) => { + const formData = new FormData() + formData.append('file', file) + + const config = {} + if (onProgress && typeof onProgress === 'function') { + config.onUploadProgress = (progressEvent) => { + const progress = { + loaded: progressEvent.loaded, + total: progressEvent.total, + percentage: progressEvent.total + ? Math.round((progressEvent.loaded / progressEvent.total) * 100) + : 0, + fileName: file.name, + fileSize: file.size + } + onProgress(progress) + } + } + + const response = await this.http.request({ + method: 'POST', + url: `${this.baseURL}/${kbId}/documents`, + body: formData, + config: { + ...config, + headers: { + 'Content-Type': 'multipart/form-data' + } + } + }) + + // API returns { data: { data: { ...uploaded document... } } } + return response.data?.data || response.data + } + + deleteDocument = async (kbId, documentId) => { + await this.http.request({ + method: 'DELETE', + url: `${this.baseURL}/${kbId}/documents/${documentId}` + }) + + return 'Document deleted successfully' + } + + // Query KB method + askKnowledgeBase = async (kbId, question, topK = 5) => { + const response = await this.http.request({ + method: 'POST', + url: `${this.baseURL}/${kbId}/ask`, + body: { + question, + top_k: topK, + model: 'gpt-4.1' + } + }) + + // API returns { answer: string, context: Array<{chunk_id, title, content, source, similarity, search_type}> } + return response.data + } +} + +export const knowledgeBaseService = new KnowledgeBaseService() diff --git a/src/templates/edit-form-block/index.vue b/src/templates/edit-form-block/index.vue index e02922210a..a5eaa092bb 100644 --- a/src/templates/edit-form-block/index.vue +++ b/src/templates/edit-form-block/index.vue @@ -110,9 +110,14 @@ const loadInitialData = async () => { try { const { id } = route.params + const initialValues = await props.loadService({ id }) + emit('loaded-service-object', initialValues) + + // Try both resetForm and setValues resetForm({ values: initialValues }) + setValues(initialValues) } catch (error) { if (error && typeof error.showErrors === 'function') { error.showErrors(toast) diff --git a/src/templates/list-table-block/folder-list.vue b/src/templates/list-table-block/folder-list.vue index 30d82d77c6..3f4594581d 100644 --- a/src/templates/list-table-block/folder-list.vue +++ b/src/templates/list-table-block/folder-list.vue @@ -613,11 +613,11 @@ break case 'delete': openDeleteDialog({ - title: action.title, + title: rowData.name || action.title, id: rowData.id, data: rowData, deleteService: action.service, - deleteConfirmationText: undefined, + deleteConfirmationText: rowData.name, closeCallback: (opt) => { if (opt.data.updated) { reload() diff --git a/src/templates/list-table-block/with-fetch-ordering-and-pagination.vue b/src/templates/list-table-block/with-fetch-ordering-and-pagination.vue index e6b5b1f050..c100e2de42 100644 --- a/src/templates/list-table-block/with-fetch-ordering-and-pagination.vue +++ b/src/templates/list-table-block/with-fetch-ordering-and-pagination.vue @@ -777,6 +777,7 @@ } const editItemSelected = ({ data: item }) => { + emit('on-row-click', item) emit('on-before-go-to-edit', item) if (props.editInDrawer) { props.editInDrawer(item) diff --git a/src/views/KnowledgeBase/DetailView.vue b/src/views/KnowledgeBase/DetailView.vue new file mode 100644 index 0000000000..c717451b31 --- /dev/null +++ b/src/views/KnowledgeBase/DetailView.vue @@ -0,0 +1,429 @@ + + + diff --git a/src/views/KnowledgeBase/FormFields/FormFieldsKnowledgeBase.vue b/src/views/KnowledgeBase/FormFields/FormFieldsKnowledgeBase.vue new file mode 100644 index 0000000000..abe2aa24f4 --- /dev/null +++ b/src/views/KnowledgeBase/FormFields/FormFieldsKnowledgeBase.vue @@ -0,0 +1,78 @@ + + + diff --git a/src/views/KnowledgeBase/ListView.vue b/src/views/KnowledgeBase/ListView.vue new file mode 100644 index 0000000000..cb44a14d84 --- /dev/null +++ b/src/views/KnowledgeBase/ListView.vue @@ -0,0 +1,124 @@ + + + diff --git a/src/views/KnowledgeBase/View.vue b/src/views/KnowledgeBase/View.vue new file mode 100644 index 0000000000..2f85c96c00 --- /dev/null +++ b/src/views/KnowledgeBase/View.vue @@ -0,0 +1,148 @@ + + + diff --git a/src/views/KnowledgeBase/components/ContextChunks.vue b/src/views/KnowledgeBase/components/ContextChunks.vue new file mode 100644 index 0000000000..dd6a66f2ff --- /dev/null +++ b/src/views/KnowledgeBase/components/ContextChunks.vue @@ -0,0 +1,71 @@ + + + + diff --git a/src/views/KnowledgeBase/components/DragAndDrop.vue b/src/views/KnowledgeBase/components/DragAndDrop.vue new file mode 100644 index 0000000000..f4bf9c57f7 --- /dev/null +++ b/src/views/KnowledgeBase/components/DragAndDrop.vue @@ -0,0 +1,80 @@ + + + diff --git a/src/views/KnowledgeBase/components/QuerySidebar.vue b/src/views/KnowledgeBase/components/QuerySidebar.vue new file mode 100644 index 0000000000..fcea49f1e8 --- /dev/null +++ b/src/views/KnowledgeBase/components/QuerySidebar.vue @@ -0,0 +1,216 @@ +