/* generated using openapi-typescript-codegen -- do not edit */ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { CheckDocumentTrainingStatus } from '../models/CheckDocumentTrainingStatus'; import type { DocumentFromPoolRequest } from '../models/DocumentFromPoolRequest'; import type { DocumentSettingsResponse } from '../models/DocumentSettingsResponse'; import type { PaginatedRetrieverDocumentEmbeddingList } from '../models/PaginatedRetrieverDocumentEmbeddingList'; import type { ResourceScrappedData } from '../models/ResourceScrappedData'; import type { RetreiverTrainViewRequest } from '../models/RetreiverTrainViewRequest'; import type { RetreiverTrainViewResponse } from '../models/RetreiverTrainViewResponse'; import type { RetrieverDocumentEmbedding } from '../models/RetrieverDocumentEmbedding'; import type { RetrieverDocumentEmbeddingRequest } from '../models/RetrieverDocumentEmbeddingRequest'; import type { RetrieverRequestSearch } from '../models/RetrieverRequestSearch'; import type { RetrieverRequestSearchDocument } from '../models/RetrieverRequestSearchDocument'; import type { RetrieverResponseSearch } from '../models/RetrieverResponseSearch'; import type { ScanWebhookRequest } from '../models/ScanWebhookRequest'; import type { ScanWebhookResponse } from '../models/ScanWebhookResponse'; import type { TrainDocumentViewRequest } from '../models/TrainDocumentViewRequest'; import type { TrainDocumentViewResponse } from '../models/TrainDocumentViewResponse'; import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class AiIndexService { /** * Retrieve details of a specific document embedding. * * This endpoint returns detailed information about a specific * document embedding identified by its ID. * * Args: * request: The HTTP request. * org: Organization key identifier. * document_id: The ID of the document embedding to retrieve. * * Returns: * Response: Detailed information about the document embedding. * * Raises: * NotFound: If the specified document embedding does not exist. * @returns RetrieverDocumentEmbedding * @throws ApiError */ public static aiIndexOrgsUsersDocumentsRetrieve({ documentId, org, userId, }: { documentId: string, org: string, userId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/{document_id}/', path: { 'document_id': documentId, 'org': org, 'user_id': userId, }, errors: { 404: `Document not found`, }, }); } /** * Update a specific document embedding. * * This endpoint allows updating various properties of a document embedding, * including its name, type, pathway, and training status. * * Args: * request: The HTTP request containing the updated document data. * org: Organization key identifier. * document_id: The ID of the document embedding to update. * * Returns: * Response: The updated document embedding information. * * Raises: * BadRequest: If the provided data is invalid. * NotFound: If the specified document embedding does not exist. * @returns RetrieverDocumentEmbedding * @throws ApiError */ public static aiIndexOrgsUsersDocumentsUpdate({ documentId, org, userId, formData, }: { documentId: string, org: string, userId: string, formData: RetrieverDocumentEmbeddingRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'PUT', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/{document_id}/', path: { 'document_id': documentId, 'org': org, 'user_id': userId, }, formData: formData, mediaType: 'multipart/form-data', errors: { 400: `Invalid request data`, 404: `Document not found`, }, }); } /** * Delete a specific document embedding. * * This endpoint removes a document embedding from the system, * including untraining it from any associated pathways. * * Args: * request: The HTTP request. * org: Organization key identifier. * document_id: The ID of the document embedding to delete. * * Returns: * Response: An empty response with a 204 status code if successful. * * Raises: * NotFound: If the specified document embedding does not exist. * @returns void * @throws ApiError */ public static aiIndexOrgsUsersDocumentsDestroy({ documentId, org, userId, }: { documentId: string, org: string, userId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/{document_id}/', path: { 'document_id': documentId, 'org': org, 'user_id': userId, }, errors: { 404: `Document not found`, }, }); } /** * Retrieve document settings with RBAC permission checks. * @returns DocumentSettingsResponse * @throws ApiError */ public static aiIndexOrgsUsersDocumentsSettingsRetrieve({ documentId, org, userId, }: { documentId: string, org: string, userId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/{document_id}/settings/', path: { 'document_id': documentId, 'org': org, 'user_id': userId, }, }); } /** * Update document settings with RBAC permission checks. * @returns DocumentSettingsResponse * @throws ApiError */ public static aiIndexOrgsUsersDocumentsSettingsCreate({ documentId, org, userId, requestBody, }: { documentId: string, org: string, userId: string, requestBody?: DocumentSettingsResponse, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/{document_id}/settings/', path: { 'document_id': documentId, 'org': org, 'user_id': userId, }, body: requestBody, mediaType: 'application/json', }); } /** * Train a document from the document pool * * Sample request: * ```json * {"document_id": 3, "to_pathway": "7c43ec09-3d37-489c-a461-8d73df1d91c7"} * ``` * @returns TrainDocumentViewResponse * @throws ApiError */ public static aiIndexOrgsUsersDocumentsDocumentFromPoolCreate({ org, userId, requestBody, }: { org: string, userId: string, requestBody: DocumentFromPoolRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/document-from-pool/', path: { 'org': org, 'user_id': userId, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request data`, }, }); } /** * Description: * Retrieves a list of document embeddings for a specific pathway with optional search and pagination. * * Methods: * - GET: Retrieves document embeddings that match the specified search criteria and are paginated according to offset and limit. * * Parameters: * - search (str): Search query to filter document names or URLs. * - offset (int): Offset number for pagination. * - limit (int): Limit number for pagination. * * Returns: * - GET: A paginated list of document embeddings with their details. * { * "count": 10, * "next": "http://api.example.com/retriever_documents/?offset=10&limit=2", * "previous": "http://api.example.com/retriever_documents/?offset=0&limit=2", * "results": [ * { * "document_name": "Document2", * "platform_key": "example_platform", * "pathway": "example_pathway" * } * ] * } * * Error Responses: * - 400 Bad Request: Invalid query parameters. * - 404 Not Found: No document embeddings found for the specified criteria. * @returns PaginatedRetrieverDocumentEmbeddingList * @throws ApiError */ public static aiIndexOrgsUsersDocumentsPathwaysList({ org, pathway, userId, limit, offset, search, }: { org: string, pathway: string, userId: string, /** * limit number */ limit?: number, /** * Offset number */ offset?: number, /** * Search query */ search?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/pathways/{pathway}/', path: { 'org': org, 'pathway': pathway, 'user_id': userId, }, query: { 'limit': limit, 'offset': offset, 'search': search, }, }); } /** * Retrieve resource documents similar to the given query. * * This endpoint performs a semantic search to find documents that are * relevant to the provided query within the specified pathway. * * Args: * request: The HTTP request containing the search query. * org: Organization key identifier. * * Returns: * Response: A list of documents relevant to the search query. * * Raises: * ValidationError: If the request data is invalid. * @returns RetrieverResponseSearch * @throws ApiError */ public static aiIndexOrgsUsersDocumentsSearchCreate({ org, userId, requestBody, }: { org: string, userId: string, requestBody: RetrieverRequestSearch, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/search/', path: { 'org': org, 'user_id': userId, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request data`, }, }); } /** * Retrieve document sources related to a given query. * * This endpoint performs a semantic search to find document sources * that are relevant to the provided query within the specified pathway, * and returns them along with confidence levels. * * Args: * request: The HTTP request containing the search query. * org: Organization key identifier. * * Returns: * Response: A list of document sources with confidence levels. * * Raises: * ValidationError: If the request data is invalid. * @returns RetrieverRequestSearchDocument * @throws ApiError */ public static aiIndexOrgsUsersDocumentsSourcesCreate({ org, userId, requestBody, }: { org: string, userId: string, requestBody: RetrieverRequestSearch, }): CancelablePromise> { return __request(OpenAPI, { method: 'POST', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/sources/', path: { 'org': org, 'user_id': userId, }, body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request data`, }, }); } /** * Check the status of a document training task. * * This endpoint retrieves the current status of an asynchronous * document training task that was previously initiated. * * Args: * request: The HTTP request. * org: Organization key identifier. * task_id: The ID of the training task to check. * * Returns: * Response: The current status of the document training task, * which can be "pending", "completed", or "failed". * @returns CheckDocumentTrainingStatus * @throws ApiError */ public static aiIndexOrgsUsersDocumentsTasksRetrieve({ org, taskId, userId, }: { org: string, taskId: string, userId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/tasks/{task_id}/', path: { 'org': org, 'task_id': taskId, 'user_id': userId, }, }); } /** * Train a document through a worker process. * * This endpoint queues larger documents for training through a worker * process, which is more suitable for handling documents that would * take too long to process directly. * * Args: * request: The HTTP request containing the document information. * org: Organization key identifier. * * Returns: * Response: A confirmation that the document was queued for training, * including a task ID for tracking the progress. * * Raises: * ValidationError: If the request data is invalid. * BadRequest: If there was an error processing the document. * @returns TrainDocumentViewResponse * @throws ApiError */ public static aiIndexOrgsUsersDocumentsTrainCreate({ org, userId, formData, }: { org: string, userId: string, formData: TrainDocumentViewRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/train/', path: { 'org': org, 'user_id': userId, }, formData: formData, mediaType: 'multipart/form-data', errors: { 400: `Invalid request data`, }, }); } /** * Train a document directly without using a worker. * * This endpoint is designed for training smaller documents directly * without queuing them through a worker process. For larger documents, * use the TrainDocumentView endpoint instead. * * Args: * request: The HTTP request containing the document information. * org: Organization key identifier. * * Returns: * Response: A confirmation that the document was trained successfully. * * Raises: * ValidationError: If the request data is invalid. * BadRequest: If the document training failed. * @returns RetreiverTrainViewResponse * @throws ApiError */ public static aiIndexOrgsUsersDocumentsTrainRetrieverCreate({ org, userId, formData, }: { org: string, userId: string, formData: RetreiverTrainViewRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/ai-index/orgs/{org}/users/{user_id}/documents/train/retriever/', path: { 'org': org, 'user_id': userId, }, formData: formData, mediaType: 'multipart/form-data', errors: { 400: `Invalid request data or training failed`, }, }); } /** * Retrieve detailed information about a specific scraped resource. * * This endpoint returns the complete scraped data for a specific resource * identified by its ID. * * Args: * request: The HTTP request. * org: Organization key identifier. * user_id: The username of the user associated with the resource. * resource_id: The ID of the resource to retrieve. * * Returns: * Response: The complete scraped data for the specified resource. * * Raises: * NotFound: If the specified resource data does not exist. * @returns ResourceScrappedData * @throws ApiError */ public static aiIndexOrgsUsersResourceDataScrappedRetrieve({ org, resourceId, userId, }: { org: string, resourceId: string, userId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/ai-index/orgs/{org}/users/{user_id}/resource/{resource_id}/data/scrapped/', path: { 'org': org, 'resource_id': resourceId, 'user_id': userId, }, errors: { 404: `Resource data not found`, }, }); } /** * Retrieve and filter scraped data from resources. * * This endpoint returns a list of scraped data from resources associated * with the specified user, with optional filtering based on query parameters. * * Args: * request: The HTTP request containing filter query parameters. * org: Organization key identifier. * user_id: The username of the user whose resources to retrieve. * * Returns: * Response: A list of scraped resource data matching the filter criteria. * * Raises: * BadRequest: If the username is invalid or query parameters are incorrect. * @returns ResourceScrappedData * @throws ApiError */ public static aiIndexOrgsUsersResourceDataScrappedList({ org, userId, isArchive, isLike, isVideo, searchKey, }: { org: string, userId: string, isArchive?: boolean | null, isLike?: boolean | null, isVideo?: boolean | null, searchKey?: string, }): CancelablePromise> { return __request(OpenAPI, { method: 'GET', url: '/api/ai-index/orgs/{org}/users/{user_id}/resource/data/scrapped/', path: { 'org': org, 'user_id': userId, }, query: { 'is_archive': isArchive, 'is_like': isLike, 'is_video': isVideo, 'search_key': searchKey, }, errors: { 400: `Invalid username or query parameters`, }, }); } /** * Receive and process file scan status from external security scanning services. * * This webhook endpoint receives scan results for files that have been submitted * for security scanning. It processes the results asynchronously and determines * if the files are safe for further processing. * * Args: * request: The HTTP request containing scan result data. * * Returns: * Response: A confirmation that the scan result was received and is being processed. * * Raises: * BadRequest: If the provided scan result data is invalid. * @returns ScanWebhookResponse * @throws ApiError */ public static aiIndexWebhookScanCreate({ requestBody, }: { requestBody: ScanWebhookRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/ai-index/webhook/scan/', body: requestBody, mediaType: 'application/json', errors: { 400: `Invalid request data`, }, }); } }