Skip to content

FluxbaseAdminAI

Admin AI manager for managing AI chatbots and providers Provides create, update, delete, sync, and monitoring operations

new FluxbaseAdminAI(fetch): FluxbaseAdminAI

ParameterType
fetchFluxbaseFetch

FluxbaseAdminAI

clearEmbeddingProvider(id): Promise<{ data: { use_for_embeddings: boolean; } | null; error: Error | null; }>

Clear the embedding provider assignment for a provider

ParameterTypeDescription
idstringProvider ID

Promise<{ data: { use_for_embeddings: boolean; } | null; error: Error | null; }>

Promise resolving to { data, error } tuple


createProvider(params): Promise<{ data: AIProvider | null; error: Error | null; }>

Create a new AI provider

ParameterTypeDescription
params{ config?: Record<string, unknown>; display_name?: string; is_default?: boolean; name: string; provider_type: string; }Provider configuration including name, provider_type, and optional config
params.config?Record<string, unknown>-
params.display_name?string-
params.is_default?boolean-
params.namestring-
params.provider_typestring-

Promise<{ data: AIProvider | null; error: Error | null; }>

Promise resolving to { data, error } tuple with created provider


deleteChatbot(id): Promise<{ data: null; error: Error | null; }>

Delete a chatbot

ParameterTypeDescription
idstringChatbot ID

Promise<{ data: null; error: Error | null; }>

Promise resolving to { data, error } tuple

const { data, error } = await client.admin.ai.deleteChatbot('uuid')

deleteProvider(id): Promise<{ data: null; error: Error | null; }>

Delete an AI provider

ParameterTypeDescription
idstringProvider ID

Promise<{ data: null; error: Error | null; }>

Promise resolving to { data, error } tuple


getChatbot(id): Promise<{ data: AIChatbot | null; error: Error | null; }>

Get details of a specific chatbot

ParameterTypeDescription
idstringChatbot ID

Promise<{ data: AIChatbot | null; error: Error | null; }>

Promise resolving to { data, error } tuple with chatbot details

const { data, error } = await client.admin.ai.getChatbot('uuid')
if (data) {
console.log('Chatbot:', data.name)
}

getProvider(id): Promise<{ data: AIProvider | null; error: Error | null; }>

Get details of a specific AI provider

ParameterTypeDescription
idstringProvider ID

Promise<{ data: AIProvider | null; error: Error | null; }>

Promise resolving to { data, error } tuple with provider details


getTableDetails(schema, table): Promise<{ data: TableDetails | null; error: Error | null; }>

Get detailed table information including columns

Use this to discover available columns before exporting.

ParameterTypeDescription
schemastringSchema name (e.g., ‘public’)
tablestringTable name

Promise<{ data: TableDetails | null; error: Error | null; }>

Promise resolving to { data, error } tuple with table details

const { data, error } = await client.admin.ai.getTableDetails('public', 'users')
if (data) {
console.log('Columns:', data.columns.map(c => c.name))
console.log('Primary key:', data.primary_key)
}

linkKnowledgeBase(chatbotId, request): Promise<{ data: ChatbotKnowledgeBaseLink | null; error: Error | null; }>

Link a knowledge base to a chatbot

ParameterTypeDescription
chatbotIdstringChatbot ID
requestLinkKnowledgeBaseRequestLink configuration

Promise<{ data: ChatbotKnowledgeBaseLink | null; error: Error | null; }>

Promise resolving to { data, error } tuple with link details

const { data, error } = await client.admin.ai.linkKnowledgeBase('chatbot-uuid', {
knowledge_base_id: 'kb-uuid',
priority: 1,
max_chunks: 5,
similarity_threshold: 0.7,
})

listChatbotKnowledgeBases(chatbotId): Promise<{ data: ChatbotKnowledgeBaseLink[] | null; error: Error | null; }>

List knowledge bases linked to a chatbot

ParameterTypeDescription
chatbotIdstringChatbot ID

Promise<{ data: ChatbotKnowledgeBaseLink[] | null; error: Error | null; }>

Promise resolving to { data, error } tuple with linked knowledge bases

const { data, error } = await client.admin.ai.listChatbotKnowledgeBases('chatbot-uuid')
if (data) {
console.log('Linked KBs:', data.map(l => l.knowledge_base_id))
}

listChatbots(namespace?): Promise<{ data: AIChatbotSummary[] | null; error: Error | null; }>

List all chatbots (admin view)

ParameterTypeDescription
namespace?stringOptional namespace filter

Promise<{ data: AIChatbotSummary[] | null; error: Error | null; }>

Promise resolving to { data, error } tuple with array of chatbot summaries

const { data, error } = await client.admin.ai.listChatbots()
if (data) {
console.log('Chatbots:', data.map(c => c.name))
}

listProviders(): Promise<{ data: AIProvider[] | null; error: Error | null; }>

List all AI providers

Promise<{ data: AIProvider[] | null; error: Error | null; }>

Promise resolving to { data, error } tuple with array of providers

const { data, error } = await client.admin.ai.listProviders()
if (data) {
console.log('Providers:', data.map(p => p.name))
}

setDefaultProvider(id): Promise<{ data: AIProvider | null; error: Error | null; }>

Set a provider as the default provider

ParameterTypeDescription
idstringProvider ID

Promise<{ data: AIProvider | null; error: Error | null; }>

Promise resolving to { data, error } tuple with updated provider


setEmbeddingProvider(id): Promise<{ data: { use_for_embeddings: boolean; } | null; error: Error | null; }>

Set a provider as the embedding provider

ParameterTypeDescription
idstringProvider ID

Promise<{ data: { use_for_embeddings: boolean; } | null; error: Error | null; }>

Promise resolving to { data, error } tuple with updated provider


sync(options?): Promise<{ data: SyncChatbotsResult | null; error: Error | null; }>

Sync chatbots from filesystem or API payload

Can sync from:

  1. Filesystem (if no chatbots provided) - loads from configured chatbots directory
  2. API payload (if chatbots array provided) - syncs provided chatbot specifications

Requires service_role or admin authentication.

ParameterTypeDescription
options?SyncChatbotsOptionsSync options including namespace and optional chatbots array

Promise<{ data: SyncChatbotsResult | null; error: Error | null; }>

Promise resolving to { data, error } tuple with sync results

// Sync from filesystem
const { data, error } = await client.admin.ai.sync()
// Sync with provided chatbot code
const { data, error } = await client.admin.ai.sync({
namespace: 'default',
chatbots: [{
name: 'sql-assistant',
code: myChatbotCode,
}],
options: {
delete_missing: false, // Don't remove chatbots not in this sync
dry_run: false, // Preview changes without applying
}
})
if (data) {
console.log(`Synced: ${data.summary.created} created, ${data.summary.updated} updated`)
}

toggleChatbot(id, enabled): Promise<{ data: AIChatbot | null; error: Error | null; }>

Enable or disable a chatbot

ParameterTypeDescription
idstringChatbot ID
enabledbooleanWhether to enable or disable

Promise<{ data: AIChatbot | null; error: Error | null; }>

Promise resolving to { data, error } tuple with updated chatbot

const { data, error } = await client.admin.ai.toggleChatbot('uuid', true)

unlinkKnowledgeBase(chatbotId, knowledgeBaseId): Promise<{ data: null; error: Error | null; }>

Unlink a knowledge base from a chatbot

ParameterTypeDescription
chatbotIdstringChatbot ID
knowledgeBaseIdstringKnowledge base ID

Promise<{ data: null; error: Error | null; }>

Promise resolving to { data, error } tuple

const { data, error } = await client.admin.ai.unlinkKnowledgeBase('chatbot-uuid', 'kb-uuid')

updateChatbotKnowledgeBase(chatbotId, knowledgeBaseId, updates): Promise<{ data: ChatbotKnowledgeBaseLink | null; error: Error | null; }>

Update a chatbot-knowledge base link

ParameterTypeDescription
chatbotIdstringChatbot ID
knowledgeBaseIdstringKnowledge base ID
updatesUpdateChatbotKnowledgeBaseRequestFields to update

Promise<{ data: ChatbotKnowledgeBaseLink | null; error: Error | null; }>

Promise resolving to { data, error } tuple with updated link

const { data, error } = await client.admin.ai.updateChatbotKnowledgeBase(
'chatbot-uuid',
'kb-uuid',
{ max_chunks: 10, enabled: true }
)

updateProvider(id, updates): Promise<{ data: AIProvider | null; error: Error | null; }>

Update an existing AI provider

ParameterTypeDescription
idstringProvider ID
updates{ config?: Record<string, unknown>; display_name?: string; enabled?: boolean; }Fields to update
updates.config?Record<string, unknown>-
updates.display_name?string-
updates.enabled?boolean-

Promise<{ data: AIProvider | null; error: Error | null; }>

Promise resolving to { data, error } tuple with updated provider