Choose Data Sources to Embed

>
>
>
true, '_builtin' => false], 'objects'); $selected_cpts = get_option('rag_embed_cpts', []); ?>
name, $selected_cpts) ? 'checked' : ''; ?>>

Select multiple custom post types to embed.

Post Meta Data Settings PRO

disabled>

Enable this to include custom fields/meta data in the embeddings.


Specify the meta keys you want to include in the context. Leave empty to include all meta (not recommended).

Sync Settings

>

Automatically update embeddings when a post or product is saved/updated.

Embedding started...

wp_rag_embed_all_sources(); ?>

Choose Data Sources to Embed

These options are available with the WPBot Pro Professional and Master Licenses

>
$table_name, 'table_field' => $table_field]; } } if (!empty($sql_tables)) { foreach ($sql_tables as $table) { ?>
Table Name Table Field(s) Actions

Add multiple tables and fields. Separate multiple fields in the same table with commas. Click "Create Missing Tables" to generate empty tables in the database if they don't exist.

Google Sheets & CSV Database Sync

Directly import Google Sheets or upload CSV data into SQL tables for Text-to-SQL querying.


Sync all your previously uploaded sheets into SQL tables:



>

Automatically update embeddings


'(Hourly)', 'twicedaily' => '(Twice Daily)', 'daily' => '(Daily)', 'weekly' => '(Weekly)', ]; $sql_interval_desc = [ 'hourly' => 'once per hour', 'twicedaily' => 'twice per day', 'daily' => 'once per day', 'weekly' => 'once per week', ]; $sql_current_label = $sql_interval_labels[$sql_sync_interval] ?? '(Daily)'; $sql_current_desc = $sql_interval_desc[$sql_sync_interval] ?? 'once per day'; ?>

Choose how often to run the automated synchronization.

These options are available with the WPBot Pro Professional and Master Licenses

Sync Settings

>

Automatically update embeddings when a post or product is saved/updated.


'(Hourly)', 'twicedaily' => '(Twice Daily)', 'daily' => '(Daily)', 'weekly' => '(Weekly)', ]; $interval_desc = [ 'hourly' => 'once per hour', 'twicedaily' => 'twice per day', 'daily' => 'once per day', 'weekly' => 'once per week', ]; $current_label = $interval_labels[$sync_interval] ?? '(Daily)'; $current_desc = $interval_desc[$sync_interval] ?? 'once per day'; ?>
>

Automatically re-sync all Google Sheets in the knowledge base .

>

Automatically re-sync all Google Docs in the knowledge base .

Choose how often to run the automated synchronization.

Upload PDF for RAG



Upload CSV Data for RAG

Upload CSV files with data to be embedded. Each row will be processed as a separate document. Download Test Data



Upload Word (.docx) for RAG

Upload MS Word files to be indexed in the knowledge base.



Upload XML Data for RAG

Upload XML files with data to be embedded.



Submit Sitemap for RAG

Enter your XML Sitemap URL to crawl and embed all pages.

Submit Google Sheet for RAG

Enter your publicly published Google Sheet URL (Publish to web -> Web page).

Submit Google Doc for RAG

Enter your publicly published Google Doc URL (File -> Share -> Publish to web).

Notes: These are based on AI system, so make sure you have enabled any AI features and set up valid API keys. Check this Tutorial for more details.

These options are available with the WPBot Pro Professional and Master Licenses

Manage Knowledge Base Sources

Manage entire files or spreadsheets instead of individual rows.

prefix . 'rag_documents'; $sources = $wpdb->get_results("SELECT source_url, source_type, COUNT(*) as count, MAX(title) as display_name FROM {$table} GROUP BY source_url, source_type ORDER BY count DESC"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter if ($sources) { foreach ($sources as $source) { $display_url = $source->source_url ?: "Manual Upload"; ?> '; } ?>
Source Name / URL Type Documents Actions
display_name); ?>
source_type); ?> count); ?> chunks
No sources found.

Database Utilities

Upgrade your database to the new **High-Speed Binary Format**. This makes similarity searches significantly faster (10x+ speed improvement).

Knowledge Base


prefix . 'rag_documents'; // Handle Table Creation if (isset($_POST['rag_create_table']) && check_admin_referer('rag_create_table_nonce')) { $charset = $wpdb->get_charset_collate(); $sql_rag_documents = "CREATE TABLE $table_rag_documents ( id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, doc_id VARCHAR(100) DEFAULT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, embedding LONGTEXT NOT NULL, source_type VARCHAR(20) DEFAULT 'post', source_url VARCHAR(255) DEFAULT NULL, file_url TEXT DEFAULT NULL, metadata LONGTEXT DEFAULT NULL, status VARCHAR(50) DEFAULT 'complete', created_at DATETIME DEFAULT CURRENT_TIMESTAMP ) $charset;"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta($sql_rag_documents); echo '

Database table created successfully.

'; } // Check if table exists $table_exists = $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($table_rag_documents))) === $table_rag_documents; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching if (!$table_exists) { ?>

Knowledge Base Database

The table does not exist. Please create it to start using the Knowledge Base.

esc_like($search_query) . '%'; $total_items = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM {$table_name} WHERE title LIKE %s OR content LIKE %s", $like, $like)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter } else { $total_items = $wpdb->get_var("SELECT COUNT(id) FROM {$table_name}"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter } $items_per_page = 50; $page = isset($_GET['paged']) ? absint(wp_unslash($_GET['paged'])) : 1; $offset = ($page - 1) * $items_per_page; $total_pages = ceil($total_items / $items_per_page); $pagination_args = array( 'base' => add_query_arg(array('paged' => '%#%', 's' => $search_query), '?page=wpbot_openAi') . '#ai-knowledge-base-tab#rag-database', 'format' => '', 'prev_text' => __( '«', 'chatbot' ), 'next_text' => __( '»', 'chatbot' ), 'total' => $total_pages, 'current' => $page, 'type' => 'plain', ); if ($total_pages > 1) { // translators: %s: number of items. echo '
' . sprintf( esc_html( _n( '%s item', '%s items', $total_items, 'chatbot' ) ), esc_html( number_format_i18n($total_items) ) ) . ''; echo wp_kses_post( paginate_links($pagination_args) ); echo '
'; } ?> esc_like($search_query) . '%'; $documents = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$table_name} WHERE title LIKE %s OR content LIKE %s ORDER BY created_at DESC LIMIT %d OFFSET %d", $like, $like, $items_per_page, $offset)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter } else { $documents = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$table_name} ORDER BY created_at DESC LIMIT %d OFFSET %d", $items_per_page, $offset)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter } if ($documents) { foreach ($documents as $doc) { ?> '; } ?>
Title Content Source Type URL/File Status Actions
title); ?>
content); ?>
source_type); ?> source_url ?: $doc->file_url); ?> status); ?> source_type, ['csv', 'xml', 'xaml','sitemap'])): ?>
No documents found in knowledge base.
1) { // translators: %s: number of items. echo '
' . sprintf( esc_html( _n( '%s item', '%s items', $total_items, 'chatbot' ) ), esc_html( number_format_i18n($total_items) ) ) . ''; echo wp_kses_post( paginate_links($pagination_args) ); echo '
'; } ?>