# LLMLabs

## Process Documents from LLM Lab

> Add or remove documents from LLM Labs knowledge base. The operation will be added to the queue, and the endpoint returns status of the operation.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Document Processing Orchestrator (DPO) API","version":"0.1.0"},"paths":{"/{knowledge_base_id}/documents":{"post":{"tags":["LLMLabs"],"summary":"Process Documents from LLM Lab","description":"Add or remove documents from LLM Labs knowledge base. The operation will be added to the queue, and the endpoint returns status of the operation.","operationId":"process_documents__knowledge_base_id__documents_post","parameters":[{"name":"knowledge_base_id","in":"path","required":true,"schema":{"type":"string","description":"The unique identifier of the knowledge base","title":"Knowledge Base Id"},"description":"The unique identifier of the knowledge base"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessDocumentsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseResponse"}}},"description":"Internal Server Error"}}}}},"components":{"schemas":{"ProcessDocumentsRequest":{"properties":{"id":{"type":"string","title":"Id","description":"Vector store identifier for this batch operation"},"insertDocuments":{"items":{"$ref":"#/components/schemas/InsertDocument"},"type":"array","title":"Insertdocuments","description":"List of documents to be inserted into the knowledge base"},"deleteDocuments":{"items":{"$ref":"#/components/schemas/DeleteDocument"},"type":"array","title":"Deletedocuments","description":"List of documents to be deleted from the knowledge base"}},"type":"object","required":["id"],"title":"ProcessDocumentsRequest","description":"Request model for document processing operations (insertion and deletion).\n\nThis model contains a batch of documents to be inserted or deleted from the knowledge base."},"InsertDocument":{"properties":{"id":{"type":"string","title":"Id","description":"Unique identifier for the document"},"name":{"type":"string","title":"Name","description":"Human-readable name of the document"},"type":{"type":"string","enum":["FILE","URL"],"title":"Type","description":"Type of the document either FILE or URL"},"createdAt":{"type":"string","format":"date-time","title":"Createdat","description":"Timestamp when the document was created"},"updatedAt":{"type":"string","format":"date-time","title":"Updatedat","description":"Timestamp when the document was last updated"},"path":{"type":"string","title":"Path","description":"URL to access the document"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata","description":"Additional document metadata based on file properties on LLM Lab","default":{}},"chunks":{"items":{"$ref":"#/components/schemas/ChunkResponse"},"type":"array","title":"Chunks","description":"Pre-processed input following the chunk model","default":[]},"processing_config":{"additionalProperties":true,"type":"object","title":"Processing Config","description":"Processing configuration for the document","default":{}}},"type":"object","required":["id","name","type","createdAt","updatedAt","path"],"title":"InsertDocument","description":"Model for document insertion into the knowledge base.\n\nThis model represents a document to be inserted into the vector store."},"ChunkResponse":{"properties":{"text":{"type":"string","title":"Text","description":"The text content of the chunk."},"structure":{"type":"string","title":"Structure","description":"The structure of the chunk.","default":"uncategorized"},"metadata":{"$ref":"#/components/schemas/ChunkMetadataResponse","description":"The metadata of the chunk."}},"type":"object","required":["text","metadata"],"title":"ChunkResponse","description":"Chunk response model."},"ChunkMetadataResponse":{"properties":{"source":{"type":"string","title":"Source","description":"The source of the chunk."},"source_type":{"type":"string","title":"Source Type","description":"The type of the source. Examples: 'pdf', 'docx', 'html', 'audio', etc."},"loaded_datetime":{"type":"string","title":"Loaded Datetime","description":"The datetime when the chunk was loaded."},"file_id":{"type":"string","title":"File Id","description":"The file ID of the chunk."},"chunk_id":{"type":"string","title":"Chunk Id","description":"The chunk ID of the chunk."},"previous_chunk":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Previous Chunk","description":"The chunk ID of the previous chunk."},"next_chunk":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Chunk","description":"The chunk ID of the next chunk."},"parent_chunk":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Chunk","description":"The chunk ID of the parent chunk."},"children_chunk":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Children Chunk","description":"The chunk IDs of the children chunks."}},"additionalProperties":true,"type":"object","required":["source","source_type","loaded_datetime","file_id","chunk_id","previous_chunk","next_chunk"],"title":"ChunkMetadataResponse","description":"Chunk metadata response model."},"DeleteDocument":{"properties":{"id":{"type":"string","title":"Id","description":"Unique identifier of the document to be deleted"}},"type":"object","required":["id"],"title":"DeleteDocument","description":"Model for document deletion from the knowledge base.\n\nThis model identifies a document to be removed from the vector store."},"BaseResponse":{"properties":{"status":{"type":"string","enum":["accepted","failed"],"title":"Status","description":"Operation status either 'accepted' or 'failed'"}},"type":"object","required":["status"],"title":"BaseResponse","description":"Base response model with standard fields."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## Verify LLM Labs Vector Store

> Endpoint to provide information to the Knowledge Base if it is assigned to a vector store. This endpoint will be called when a new vector store is created or an existing vector store is updated with a new base URL, username, or password.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Document Processing Orchestrator (DPO) API","version":"0.1.0"},"paths":{"/{knowledge_base_id}/verify":{"post":{"tags":["LLMLabs"],"summary":"Verify LLM Labs Vector Store","description":"Endpoint to provide information to the Knowledge Base if it is assigned to a vector store. This endpoint will be called when a new vector store is created or an existing vector store is updated with a new base URL, username, or password.","operationId":"verify__knowledge_base_id__verify_post","parameters":[{"name":"knowledge_base_id","in":"path","required":true,"schema":{"type":"string","description":"The unique identifier of the knowledge base","title":"Knowledge Base Id"},"description":"The unique identifier of the knowledge base"},{"name":"authorization","in":"header","required":false,"schema":{"type":"string","description":"The authorization header for authentication","title":"Authorization"},"description":"The authorization header for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseResponse"}}},"description":"Internal Server Error"}}}}},"components":{"schemas":{"VerifyRequest":{"properties":{"id":{"type":"string","title":"Id","description":"Vector store identifier to verify"},"message":{"type":"string","enum":["create","update"],"title":"Message","description":"Message indicating the context of the verification"}},"type":"object","required":["id","message"],"title":"VerifyRequest","description":"Request model for document verification in the vector store.\n\nThis model is used to verify a document's existence and return its status."},"BaseResponse":{"properties":{"status":{"type":"string","enum":["accepted","failed"],"title":"Status","description":"Operation status either 'accepted' or 'failed'"}},"type":"object","required":["status"],"title":"BaseResponse","description":"Base response model with standard fields."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## Delete vector store

> Endpoint to delete a Vector Store. This endpoint will be invoked when a vector store is being deleted.

```json
{"openapi":"3.1.0","info":{"title":"GLChat Document Processing Orchestrator (DPO) API","version":"0.1.0"},"paths":{"/{knowledge_base_id}/vector-stores/{vector_store_id}":{"delete":{"tags":["LLMLabs"],"summary":"Delete vector store","description":"Endpoint to delete a Vector Store. This endpoint will be invoked when a vector store is being deleted.","operationId":"handle_deleted_vector_store__knowledge_base_id__vector_stores__vector_store_id__delete","parameters":[{"name":"knowledge_base_id","in":"path","required":true,"schema":{"type":"string","description":"The unique identifier of the knowledge base","title":"Knowledge Base Id"},"description":"The unique identifier of the knowledge base"},{"name":"vector_store_id","in":"path","required":true,"schema":{"type":"string","description":"The unique identifier of the vector store to delete","title":"Vector Store Id"},"description":"The unique identifier of the vector store to delete"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"The authorization header for authentication","title":"Authorization"},"description":"The authorization header for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseResponse"}}},"description":"Internal Server Error"}}}}},"components":{"schemas":{"BaseResponse":{"properties":{"status":{"type":"string","enum":["accepted","failed"],"title":"Status","description":"Operation status either 'accepted' or 'failed'"}},"type":"object","required":["status"],"title":"BaseResponse","description":"Base response model with standard fields."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```
