listKnowledgeBases()
This method lists deployment knowledge bases.
Usage
The following example shows a basic usage of the backend client from @wacht/nextjs/server.
import { wachtClient } from '@wacht/nextjs/server';export async function example() { const client = await wachtClient(); const options: ListOptions & { search?: string } = { limit: 20, search: 'support', }; return client.ai.listKnowledgeBases(options);}Signature
function listKnowledgeBases( options?: ListOptions & { search?: string }, client?: WachtClient,): Promise<KnowledgeBaseListResponse>Parameters
›options?: ListOptions & { search?: string } | undefined;
options?: ListOptions & { search?: string } | undefined;Optional query/filter object used to shape list/search behavior.
›limit?: number | undefined;
limit?: number | undefined;limit value used by this request.
›search?: string | undefined;
search?: string | undefined;search value used by this request.
Return value
›result?: KnowledgeBaseListResponse | undefined;
result?: KnowledgeBaseListResponse | undefined;Operation result payload.
Examples
AI usage pattern
import { wachtClient } from '@wacht/nextjs/server';export async function createKbAndUpload(file: File) { const client = await wachtClient(); const kb = await client.ai.createKnowledgeBase({ name: 'Support Docs', description: 'Knowledge base for support runbooks', }); const doc = await client.ai.uploadKnowledgeBaseDocument(kb.id, file, 'runbook.md', 'Support runbook'); return { kb, doc };}