FluxbaseKnowledgeBase
//fluxbase-kotlin/io.github.nimbleflux.fluxbase.knowledgebase/FluxbaseKnowledgeBase
FluxbaseKnowledgeBase
Section titled “FluxbaseKnowledgeBase”[jvm]
class FluxbaseKnowledgeBase(http: FluxbaseHttpClient)
Knowledge base module — user-scope CRUD, documents, hybrid search, and the knowledge graph. Mirrors the TS SDK’s FluxbaseKnowledgeBase (sdk/src/knowledge-base.ts).
Constructors
Section titled “Constructors”| FluxbaseKnowledgeBase | [jvm] constructor(http: FluxbaseHttpClient) |
Functions
Section titled “Functions”| Name | Summary |
|---|---|
| addDocument | [jvm] suspend fun addDocument(kbId: String, request: AddDocumentRequest): FluxbaseResponse<KnowledgeBaseDocument> POST /api/v1/ai/knowledge-bases/:id/documents — add a text document. |
| create | [jvm] suspend fun create(request: CreateKnowledgeBaseRequest): FluxbaseResponse<KnowledgeBase> POST /api/v1/ai/knowledge-bases — create a KB owned by the caller. |
| delete | [jvm] suspend fun delete(kbId: String): FluxbaseResponse<Unit> DELETE /api/v1/ai/knowledge-bases/:id — delete (owner only). |
| deleteDocument | [jvm] suspend fun deleteDocument(kbId: String, documentId: String): FluxbaseResponse<Unit> DELETE /api/v1/ai/knowledge-bases/:id/documents/:docId — delete a document. |
| get | [jvm] suspend fun get(kbId: String): FluxbaseResponse<KnowledgeBase> GET /api/v1/ai/knowledge-bases/:id — get a KB (requires access). |
| getDocument | [jvm] suspend fun getDocument(kbId: String, documentId: String): FluxbaseResponse<KnowledgeBaseDocument> GET /api/v1/ai/knowledge-bases/:id/documents/:docId — get a document. |
| getEntityRelationships | [jvm] suspend fun getEntityRelationships(kbId: String, entityId: String): FluxbaseResponse<List<EntityRelationship>> GET /api/v1/ai/knowledge-bases/:id/entities/:entityId/relationships. |
| getKnowledgeGraph | [jvm] suspend fun getKnowledgeGraph(kbId: String): FluxbaseResponse<KnowledgeGraphData> GET /api/v1/ai/knowledge-bases/:id/graph — full knowledge graph. |
| list | [jvm] suspend fun list(namespace: String? = null): FluxbaseResponse<List<KnowledgeBaseSummary>> GET /api/v1/ai/knowledge-bases — list KBs the user can access. |
| listChatbots | [jvm] suspend fun listChatbots(kbId: String): FluxbaseResponse<List<KBLinkedChatbot>> GET /api/v1/ai/knowledge-bases/:id/chatbots — chatbots linked to this KB. |
| listDocuments | [jvm] suspend fun listDocuments(kbId: String): FluxbaseResponse<List<KnowledgeBaseDocument>> GET /api/v1/ai/knowledge-bases/:id/documents — list documents. |
| listEntities | [jvm] suspend fun listEntities(kbId: String, type: String? = null): FluxbaseResponse<List<Entity>> GET /api/v1/ai/knowledge-bases/:id/entities — list entities. |
| listPermissions | [jvm] suspend fun listPermissions(kbId: String): FluxbaseResponse<List<KBPermissionGrant>> GET /api/v1/ai/knowledge-bases/:id/permissions — list grants (owner). |
| revokePermission | [jvm] suspend fun revokePermission(kbId: String, userId: String): FluxbaseResponse<Unit> DELETE /api/v1/ai/knowledge-bases/:id/permissions/:userId — revoke (owner). |
| search | [jvm] suspend fun search(kbId: String, request: KBSearchRequest): FluxbaseResponse<List<KBSearchResult>> POST /api/v1/ai/knowledge-bases/:id/search — hybrid search. |
| searchEntities | [jvm] suspend fun searchEntities(kbId: String, query: String): FluxbaseResponse<List<Entity>> GET /api/v1/ai/knowledge-bases/:id/entities/search?q=… — search entities by name. |
| share | [jvm] suspend fun share(kbId: String, request: GrantKBPermissionRequest): FluxbaseResponse<KBPermissionGrant> POST /api/v1/ai/knowledge-bases/:id/share — grant a user permission (owner). |
| update | [jvm] suspend fun update(kbId: String, request: UpdateKnowledgeBaseRequest): FluxbaseResponse<KnowledgeBase> PATCH /api/v1/ai/knowledge-bases/:id — update (editor permission). |
| uploadDocument | [jvm] suspend fun uploadDocument(kbId: String, fileName: String, content: ByteArray, mimeType: String, metadata: Map<String, String>? = null): FluxbaseResponse<KnowledgeBaseDocument> POST /api/v1/ai/knowledge-bases/:id/documents/upload — upload a file as a multipart form document. The multipart body is assembled manually (the HTTP transport has no multipart helper); error statuses throw inside the transport and are converted by fluxbaseResponse. |