FluxbaseAdminAI
Admin AI manager for managing AI chatbots and providers Provides create, update, delete, sync, and monitoring operations
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FluxbaseAdminAI(
fetch):FluxbaseAdminAI
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fetch |
FluxbaseFetch |
Returns
Section titled “Returns”FluxbaseAdminAI
Methods
Section titled “Methods”clearEmbeddingProvider()
Section titled “clearEmbeddingProvider()”clearEmbeddingProvider(
id):Promise<{data: {use_for_embeddings:boolean; } |null;error:Error|null; }>
Clear the embedding provider assignment for a provider
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
string |
Provider ID |
Returns
Section titled “Returns”Promise<{ data: { use_for_embeddings: boolean; } | null; error: Error | null; }>
Promise resolving to { data, error } tuple
createIntegration()
Section titled “createIntegration()”createIntegration(
request):Promise<{data:ToolIntegration|null;error:Error|null; }>
Create a new tool integration. api_key in config is encrypted at the storage layer; never appears in plaintext in API responses.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
request |
CreateToolIntegrationRequest |
Returns
Section titled “Returns”Promise<{ data: ToolIntegration | null; error: Error | null; }>
createProvider()
Section titled “createProvider()”createProvider(
params):Promise<{data:AIProvider|null;error:Error|null; }>
Create a new AI provider
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
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.name |
string |
- |
params.provider_type |
string |
- |
Returns
Section titled “Returns”Promise<{ data: AIProvider | null; error: Error | null; }>
Promise resolving to { data, error } tuple with created provider
deleteChatbot()
Section titled “deleteChatbot()”deleteChatbot(
id):Promise<{data:null;error:Error|null; }>
Delete a chatbot
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
string |
Chatbot ID |
Returns
Section titled “Returns”Promise<{ data: null; error: Error | null; }>
Promise resolving to { data, error } tuple
Example
Section titled “Example”const { data, error } = await client.admin.ai.deleteChatbot('uuid')deleteIntegration()
Section titled “deleteIntegration()”deleteIntegration(
id):Promise<{error:Error|null; }>
Delete a tool integration. Refuses to delete read-only integrations configured via env/YAML.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”Promise<{ error: Error | null; }>
deleteProvider()
Section titled “deleteProvider()”deleteProvider(
id):Promise<{data:null;error:Error|null; }>
Delete an AI provider
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
string |
Provider ID |
Returns
Section titled “Returns”Promise<{ data: null; error: Error | null; }>
Promise resolving to { data, error } tuple
getChatbot()
Section titled “getChatbot()”getChatbot(
id):Promise<{data:AIChatbot|null;error:Error|null; }>
Get details of a specific chatbot
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
string |
Chatbot ID |
Returns
Section titled “Returns”Promise<{ data: AIChatbot | null; error: Error | null; }>
Promise resolving to { data, error } tuple with chatbot details
Example
Section titled “Example”const { data, error } = await client.admin.ai.getChatbot('uuid')if (data) { console.log('Chatbot:', data.name)}getIntegration()
Section titled “getIntegration()”getIntegration(
id):Promise<{data:ToolIntegration|null;error:Error|null; }>
Get a single tool integration by ID.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”Promise<{ data: ToolIntegration | null; error: Error | null; }>
getProvider()
Section titled “getProvider()”getProvider(
id):Promise<{data:AIProvider|null;error:Error|null; }>
Get details of a specific AI provider
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
string |
Provider ID |
Returns
Section titled “Returns”Promise<{ data: AIProvider | null; error: Error | null; }>
Promise resolving to { data, error } tuple with provider details
getTableDetails()
Section titled “getTableDetails()”getTableDetails(
schema,table):Promise<{data:TableDetails|null;error:Error|null; }>
Get detailed table information including columns
Use this to discover available columns before exporting.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
schema |
string |
Schema name (e.g., ‘public’) |
table |
string |
Table name |
Returns
Section titled “Returns”Promise<{ data: TableDetails | null; error: Error | null; }>
Promise resolving to { data, error } tuple with table details
Example
Section titled “Example”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()
Section titled “linkKnowledgeBase()”linkKnowledgeBase(
chatbotId,request):Promise<{data:ChatbotKnowledgeBaseLink|null;error:Error|null; }>
Link a knowledge base to a chatbot
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
chatbotId |
string |
Chatbot ID |
request |
LinkKnowledgeBaseRequest |
Link configuration |
Returns
Section titled “Returns”Promise<{ data: ChatbotKnowledgeBaseLink | null; error: Error | null; }>
Promise resolving to { data, error } tuple with link details
Example
Section titled “Example”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()
Section titled “listChatbotKnowledgeBases()”listChatbotKnowledgeBases(
chatbotId):Promise<{data:ChatbotKnowledgeBaseLink[] |null;error:Error|null; }>
List knowledge bases linked to a chatbot
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
chatbotId |
string |
Chatbot ID |
Returns
Section titled “Returns”Promise<{ data: ChatbotKnowledgeBaseLink[] | null; error: Error | null; }>
Promise resolving to { data, error } tuple with linked knowledge bases
Example
Section titled “Example”const { data, error } = await client.admin.ai.listChatbotKnowledgeBases('chatbot-uuid')if (data) { console.log('Linked KBs:', data.map(l => l.knowledge_base_id))}listChatbots()
Section titled “listChatbots()”listChatbots(
namespace?):Promise<{data:AIChatbotSummary[] |null;error:Error|null; }>
List all chatbots (admin view)
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
namespace? |
string |
Optional namespace filter |
Returns
Section titled “Returns”Promise<{ data: AIChatbotSummary[] | null; error: Error | null; }>
Promise resolving to { data, error } tuple with array of chatbot summaries
Example
Section titled “Example”const { data, error } = await client.admin.ai.listChatbots()if (data) { console.log('Chatbots:', data.map(c => c.name))}listIntegrations()
Section titled “listIntegrations()”listIntegrations(
params?):Promise<{data:ToolIntegration[] |null;error:Error|null; }>
List tool integrations, optionally filtered by integration_type.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params? |
{ integration_type?: IntegrationType; } |
params.integration_type? |
IntegrationType |
Returns
Section titled “Returns”Promise<{ data: ToolIntegration[] | null; error: Error | null; }>
Example
Section titled “Example”const { data, error } = await client.admin.ai.listIntegrations({ integration_type: "web_search" })listProviders()
Section titled “listProviders()”listProviders():
Promise<{data:AIProvider[] |null;error:Error|null; }>
List all AI providers
Returns
Section titled “Returns”Promise<{ data: AIProvider[] | null; error: Error | null; }>
Promise resolving to { data, error } tuple with array of providers
Example
Section titled “Example”const { data, error } = await client.admin.ai.listProviders()if (data) { console.log('Providers:', data.map(p => p.name))}setDefaultIntegration()
Section titled “setDefaultIntegration()”setDefaultIntegration(
id):Promise<{error:Error|null; }>
Mark an integration as the default for its integration_type within the current tenant. The server clears any prior default in the same transaction.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”Promise<{ error: Error | null; }>
setDefaultProvider()
Section titled “setDefaultProvider()”setDefaultProvider(
id):Promise<{data:AIProvider|null;error:Error|null; }>
Set a provider as the default provider
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
string |
Provider ID |
Returns
Section titled “Returns”Promise<{ data: AIProvider | null; error: Error | null; }>
Promise resolving to { data, error } tuple with updated provider
setEmbeddingProvider()
Section titled “setEmbeddingProvider()”setEmbeddingProvider(
id):Promise<{data: {use_for_embeddings:boolean; } |null;error:Error|null; }>
Set a provider as the embedding provider
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
string |
Provider ID |
Returns
Section titled “Returns”Promise<{ data: { use_for_embeddings: boolean; } | null; error: Error | null; }>
Promise resolving to { data, error } tuple with updated provider
sync()
Section titled “sync()”sync(
options?):Promise<{data:SyncChatbotsResult|null;error:Error|null; }>
Sync chatbots from filesystem or API payload
Can sync from:
- Filesystem (if no chatbots provided) - loads from configured chatbots directory
- API payload (if chatbots array provided) - syncs provided chatbot specifications
Requires service_role or admin authentication.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options? |
SyncChatbotsOptions |
Sync options including namespace and optional chatbots array |
Returns
Section titled “Returns”Promise<{ data: SyncChatbotsResult | null; error: Error | null; }>
Promise resolving to { data, error } tuple with sync results
Example
Section titled “Example”// Sync from filesystemconst { data, error } = await client.admin.ai.sync()
// Sync with provided chatbot codeconst { 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`)}testIntegration()
Section titled “testIntegration()”testIntegration(
id):Promise<{data:TestToolIntegrationResult|null;error:Error|null; }>
Test an integration by running a real “hello world” call against its provider. Stores last_tested_at + last_test_status + error on the integration row so the admin UI can display health.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”Promise<{ data: TestToolIntegrationResult | null; error: Error | null; }>
Example
Section titled “Example”const { data, error } = await client.admin.ai.testIntegration(integrationId)if (data?.status === "ok") { console.log("Tavily credentials verified") }toggleChatbot()
Section titled “toggleChatbot()”toggleChatbot(
id,enabled):Promise<{data:AIChatbot|null;error:Error|null; }>
Enable or disable a chatbot
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
string |
Chatbot ID |
enabled |
boolean |
Whether to enable or disable |
Returns
Section titled “Returns”Promise<{ data: AIChatbot | null; error: Error | null; }>
Promise resolving to { data, error } tuple with updated chatbot
Example
Section titled “Example”const { data, error } = await client.admin.ai.toggleChatbot('uuid', true)unlinkKnowledgeBase()
Section titled “unlinkKnowledgeBase()”unlinkKnowledgeBase(
chatbotId,knowledgeBaseId):Promise<{data:null;error:Error|null; }>
Unlink a knowledge base from a chatbot
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
chatbotId |
string |
Chatbot ID |
knowledgeBaseId |
string |
Knowledge base ID |
Returns
Section titled “Returns”Promise<{ data: null; error: Error | null; }>
Promise resolving to { data, error } tuple
Example
Section titled “Example”const { data, error } = await client.admin.ai.unlinkKnowledgeBase('chatbot-uuid', 'kb-uuid')updateChatbotKnowledgeBase()
Section titled “updateChatbotKnowledgeBase()”updateChatbotKnowledgeBase(
chatbotId,knowledgeBaseId,updates):Promise<{data:ChatbotKnowledgeBaseLink|null;error:Error|null; }>
Update a chatbot-knowledge base link
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
chatbotId |
string |
Chatbot ID |
knowledgeBaseId |
string |
Knowledge base ID |
updates |
UpdateChatbotKnowledgeBaseRequest |
Fields to update |
Returns
Section titled “Returns”Promise<{ data: ChatbotKnowledgeBaseLink | null; error: Error | null; }>
Promise resolving to { data, error } tuple with updated link
Example
Section titled “Example”const { data, error } = await client.admin.ai.updateChatbotKnowledgeBase( 'chatbot-uuid', 'kb-uuid', { max_chunks: 10, enabled: true })updateIntegration()
Section titled “updateIntegration()”updateIntegration(
id,request):Promise<{data:ToolIntegration|null;error:Error|null; }>
Update an existing tool integration. Passing config.api_key = “masked” preserves the existing encrypted value (useful when the admin changes only the name and not the API key).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
request |
UpdateToolIntegrationRequest |
Returns
Section titled “Returns”Promise<{ data: ToolIntegration | null; error: Error | null; }>
updateProvider()
Section titled “updateProvider()”updateProvider(
id,updates):Promise<{data:AIProvider|null;error:Error|null; }>
Update an existing AI provider
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id |
string |
Provider ID |
updates |
{ config?: Record<string, unknown>; display_name?: string; embedding_model?: string | null; enabled?: boolean; } |
Fields to update |
updates.config? |
Record<string, unknown> |
- |
updates.display_name? |
string |
- |
updates.embedding_model? |
string | null |
- |
updates.enabled? |
boolean |
- |
Returns
Section titled “Returns”Promise<{ data: AIProvider | null; error: Error | null; }>
Promise resolving to { data, error } tuple with updated provider