diff --git a/sqlite-cloud/_nav.ts b/sqlite-cloud/_nav.ts index d66e587..8919cfc 100644 --- a/sqlite-cloud/_nav.ts +++ b/sqlite-cloud/_nav.ts @@ -3,86 +3,302 @@ import type { SidebarNavStruct } from "@docs-website/types/sidebar-navigation"; const sidebarNav: SidebarNavStruct = [ { title: "", type: "primary" }, // ### AI ### - { title: "AI", type: "secondary", icon: "docs-star",}, + { title: "AI", type: "secondary", icon: "docs-star" }, { title: "Overview", filePath: "ai-overview", type: "inner", level: 0 }, { title: "SQLite-AI", filePath: "sqlite-ai", type: "inner", level: 0 }, { title: "SQLite-JS", filePath: "sqlite-js", type: "inner", level: 0 }, { title: "SQLite-Sync", type: "inner", level: 0 }, - { title: "Introduction", filePath: "sqlite-sync-introduction", type: "inner", level: 1 }, - { title: "Getting Started", filePath: "sqlite-sync-getting-started", type: "inner", level: 1 }, - { title: "Best Practices", filePath: "sqlite-sync-best-practices", type: "inner", level: 1 }, - { title: "Quick Starts", type: "inner", level: 1 }, - { title: "Android", filePath: "sqlite-sync-quick-start-android", type: "inner", level: 2 }, - { title: "iOS", filePath: "sqlite-sync-quick-start-ios", type: "inner", level: 2 }, - { title: "Linux", filePath: "sqlite-sync-quick-start-linux", type: "inner", level: 2 }, - { title: "macOS", filePath: "sqlite-sync-quick-start-macos", type: "inner", level: 2 }, - { title: "React Native Expo", filePath: "sqlite-sync-quick-start-expo", type: "inner", level: 2 }, - { title: "WASM", filePath: "sqlite-sync-quick-start-wasm", type: "inner", level: 2 }, - { title: "Windows", filePath: "sqlite-sync-quick-start-windows", type: "inner", level: 2 }, - { title: "API Reference", type: "inner", level: 1 }, - { title: "cloudsync_init", filePath: "sqlite-sync-api-cloudsync-init", type: "inner", level: 2 }, - { title: "cloudsync_enable", filePath: "sqlite-sync-api-cloudsync-enable", type: "inner", level: 2 }, - { title: "cloudsync_disable", filePath: "sqlite-sync-api-cloudsync-disable", type: "inner", level: 2 }, - { title: "cloudsync_is_enabled", filePath: "sqlite-sync-api-cloudsync-is-enabled", type: "inner", level: 2 }, - { title: "cloudsync_cleanup", filePath: "sqlite-sync-api-cloudsync-cleanup", type: "inner", level: 2 }, - { title: "cloudsync_terminate", filePath: "sqlite-sync-api-cloudsync-terminate", type: "inner", level: 2 }, - { title: "cloudsync_version", filePath: "sqlite-sync-api-cloudsync-version", type: "inner", level: 2 }, - { title: "cloudsync_siteid", filePath: "sqlite-sync-api-cloudsync-siteid", type: "inner", level: 2 }, - { title: "cloudsync_db_version", filePath: "sqlite-sync-api-cloudsync-db-version", type: "inner", level: 2 }, - { title: "cloudsync_uuid", filePath: "sqlite-sync-api-cloudsync-uuid", type: "inner", level: 2 }, - { title: "cloudsync_begin_alter", filePath: "sqlite-sync-api-cloudsync-begin-alter", type: "inner", level: 2 }, - { title: "cloudsync_commit_alter", filePath: "sqlite-sync-api-cloudsync-commit-alter", type: "inner", level: 2 }, - { title: "cloudsync_network_init", filePath: "sqlite-sync-api-cloudsync-network-init", type: "inner", level: 2 }, - { title: "cloudsync_network_cleanup", filePath: "sqlite-sync-api-cloudsync-network-cleanup", type: "inner", level: 2 }, - { title: "cloudsync_network_set_token", filePath: "sqlite-sync-api-cloudsync-network-set-token", type: "inner", level: 2 }, - { title: "cloudsync_network_set_apikey", filePath: "sqlite-sync-api-cloudsync-network-set-apikey", type: "inner", level: 2 }, - { title: "cloudsync_network_has_unsent_changes", filePath: "sqlite-sync-api-cloudsync-network-has-unsent-changes", type: "inner", level: 2 }, - { title: "cloudsync_network_send_changes", filePath: "sqlite-sync-api-cloudsync-network-send-changes", type: "inner", level: 2 }, - { title: "cloudsync_network_check_changes", filePath: "sqlite-sync-api-cloudsync-network-check-changes", type: "inner", level: 2 }, - { title: "cloudsync_network_sync", filePath: "sqlite-sync-api-cloudsync-network-sync", type: "inner", level: 2 }, - { title: "cloudsync_network_reset_sync_version", filePath: "sqlite-sync-api-cloudsync-network-reset-sync-version", type: "inner", level: 2 }, - { title: "cloudsync_network_logout", filePath: "sqlite-sync-api-cloudsync-network-logout", type: "inner", level: 2 }, - { title: "SQLite-Vector", filePath: "sqlite-vector", type: "inner", level: 0 }, - { title: "MCP (Model Context Protocol)", filePath: "mcp-server", type: "inner", level: 0 }, + { + title: "Introduction", + filePath: "sqlite-sync-introduction", + type: "inner", + level: 1, + }, + { + title: "Getting Started", + filePath: "sqlite-sync-getting-started", + type: "inner", + level: 1, + }, + { + title: "Best Practices", + filePath: "sqlite-sync-best-practices", + type: "inner", + level: 1, + }, + { title: "Quick Starts", type: "inner", level: 1 }, + { + title: "Android", + filePath: "sqlite-sync-quick-start-android", + type: "inner", + level: 2, + }, + { + title: "iOS", + filePath: "sqlite-sync-quick-start-ios", + type: "inner", + level: 2, + }, + { + title: "Linux", + filePath: "sqlite-sync-quick-start-linux", + type: "inner", + level: 2, + }, + { + title: "macOS", + filePath: "sqlite-sync-quick-start-macos", + type: "inner", + level: 2, + }, + { + title: "React Native Expo", + filePath: "sqlite-sync-quick-start-expo", + type: "inner", + level: 2, + }, + { + title: "WASM", + filePath: "sqlite-sync-quick-start-wasm", + type: "inner", + level: 2, + }, + { + title: "Windows", + filePath: "sqlite-sync-quick-start-windows", + type: "inner", + level: 2, + }, + { title: "API Reference", type: "inner", level: 1 }, + { + title: "cloudsync_init", + filePath: "sqlite-sync-api-cloudsync-init", + type: "inner", + level: 2, + }, + { + title: "cloudsync_enable", + filePath: "sqlite-sync-api-cloudsync-enable", + type: "inner", + level: 2, + }, + { + title: "cloudsync_disable", + filePath: "sqlite-sync-api-cloudsync-disable", + type: "inner", + level: 2, + }, + { + title: "cloudsync_is_enabled", + filePath: "sqlite-sync-api-cloudsync-is-enabled", + type: "inner", + level: 2, + }, + { + title: "cloudsync_cleanup", + filePath: "sqlite-sync-api-cloudsync-cleanup", + type: "inner", + level: 2, + }, + { + title: "cloudsync_terminate", + filePath: "sqlite-sync-api-cloudsync-terminate", + type: "inner", + level: 2, + }, + { + title: "cloudsync_version", + filePath: "sqlite-sync-api-cloudsync-version", + type: "inner", + level: 2, + }, + { + title: "cloudsync_siteid", + filePath: "sqlite-sync-api-cloudsync-siteid", + type: "inner", + level: 2, + }, + { + title: "cloudsync_db_version", + filePath: "sqlite-sync-api-cloudsync-db-version", + type: "inner", + level: 2, + }, + { + title: "cloudsync_uuid", + filePath: "sqlite-sync-api-cloudsync-uuid", + type: "inner", + level: 2, + }, + { + title: "cloudsync_begin_alter", + filePath: "sqlite-sync-api-cloudsync-begin-alter", + type: "inner", + level: 2, + }, + { + title: "cloudsync_commit_alter", + filePath: "sqlite-sync-api-cloudsync-commit-alter", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_init", + filePath: "sqlite-sync-api-cloudsync-network-init", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_cleanup", + filePath: "sqlite-sync-api-cloudsync-network-cleanup", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_set_token", + filePath: "sqlite-sync-api-cloudsync-network-set-token", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_set_apikey", + filePath: "sqlite-sync-api-cloudsync-network-set-apikey", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_has_unsent_changes", + filePath: "sqlite-sync-api-cloudsync-network-has-unsent-changes", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_send_changes", + filePath: "sqlite-sync-api-cloudsync-network-send-changes", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_check_changes", + filePath: "sqlite-sync-api-cloudsync-network-check-changes", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_sync", + filePath: "sqlite-sync-api-cloudsync-network-sync", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_reset_sync_version", + filePath: "sqlite-sync-api-cloudsync-network-reset-sync-version", + type: "inner", + level: 2, + }, + { + title: "cloudsync_network_logout", + filePath: "sqlite-sync-api-cloudsync-network-logout", + type: "inner", + level: 2, + }, + { + title: "SQLite-Vector", + filePath: "sqlite-vector", + type: "inner", + level: 0, + }, + { + title: "MCP (Model Context Protocol)", + filePath: "mcp-server", + type: "inner", + level: 0, + }, + { + title: "AI-Powered Docs Search", + filePath: "aisearch-documents", + type: "inner", + level: 0, + }, // ### CLOUD ### - { title: "Cloud", type: "secondary", icon: "docs-star",}, + { title: "Cloud", type: "secondary", icon: "docs-star" }, { title: "Overview", filePath: "overview", type: "inner", level: 0 }, { title: "Scaling", filePath: "architecture", type: "inner", level: 0 }, { title: "Getting Started", type: "inner", level: 0 }, - { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, - { title: "Creating a database", filePath: "create-database", type: "inner", level: 1 }, - { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, + { title: "Connecting", filePath: "connect-cluster", type: "inner", level: 1 }, + { + title: "Creating a database", + filePath: "create-database", + type: "inner", + level: 1, + }, + { title: "Writing data", filePath: "write-data", type: "inner", level: 1 }, { title: "Quick Start Guides", type: "inner", level: 0 }, - { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, - { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, - { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, - { title: "React Native", filePath: "quick-start-react-native", type: "inner", level: 1 }, - { title: "Apollo / GraphQL", filePath: "quick-start-apollo-graphql", type: "inner", level: 1 }, - { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, - { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, - { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, - { title: "SQLAlchemy", filePath: "quick-start-sqlalchemy-orm", type: "inner", level: 1 }, - { title: "Streamlit", filePath: "quick-start-streamlit", type: "inner", level: 1 }, - { title: "PHP / Laravel", filePath: "quick-start-php-laravel", type: "inner", level: 1 }, - { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, - { title: "Knex.js", filePath: "quick-start-knex", type: "inner", level: 1 }, + { title: "CDN", filePath: "quick-start-cdn", type: "inner", level: 1 }, + { title: "Node.js", filePath: "quick-start-node", type: "inner", level: 1 }, + { title: "React", filePath: "quick-start-react", type: "inner", level: 1 }, + { + title: "React Native", + filePath: "quick-start-react-native", + type: "inner", + level: 1, + }, + { + title: "Apollo / GraphQL", + filePath: "quick-start-apollo-graphql", + type: "inner", + level: 1, + }, + { title: "Next.js", filePath: "quick-start-next", type: "inner", level: 1 }, + { title: "Django", filePath: "quick-start-django", type: "inner", level: 1 }, + { title: "Flask", filePath: "quick-start-flask", type: "inner", level: 1 }, + { + title: "SQLAlchemy", + filePath: "quick-start-sqlalchemy-orm", + type: "inner", + level: 1, + }, + { + title: "Streamlit", + filePath: "quick-start-streamlit", + type: "inner", + level: 1, + }, + { + title: "PHP / Laravel", + filePath: "quick-start-php-laravel", + type: "inner", + level: 1, + }, + { title: "Gin", filePath: "quick-start-gin", type: "inner", level: 1 }, + { title: "Knex.js", filePath: "quick-start-knex", type: "inner", level: 1 }, // ### PLATFORM ### { title: "Platform", type: "secondary", icon: "docs-plat" }, - { title: "Edge Functions", filePath: "edge-functions", type: "inner", level: 0 }, - { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, - { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, - //{ title: "Vector", filePath: "vector", type: "inner", level: 0 }, - { title: "Users and Roles", filePath: "security", type: "inner", level: 0 }, - { title: "API Keys", filePath: "apikey", type: "inner", level: 0 }, - { title: "Row-Level Security", filePath: "rls", type: "inner", level: 0}, - { title: "OffSync", filePath: "offsync", type: "inner", level: 0 }, - { title: "Access Tokens", filePath: "access-tokens", type: "inner", level: 0 }, - { title: "Backups", filePath: "backups", type: "inner", level: 0 }, - { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, - { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, - { title: "Weblite (REST API)", filePath: "weblite", type: "inner", level: 0 }, + { + title: "Edge Functions", + filePath: "edge-functions", + type: "inner", + level: 0, + }, + { title: "Webhooks", filePath: "webhooks", type: "inner", level: 0 }, + { title: "Pub/Sub", filePath: "pub-sub", type: "inner", level: 0 }, + //{ title: "Vector", filePath: "vector", type: "inner", level: 0 }, + { title: "Users and Roles", filePath: "security", type: "inner", level: 0 }, + { title: "API Keys", filePath: "apikey", type: "inner", level: 0 }, + { title: "Row-Level Security", filePath: "rls", type: "inner", level: 0 }, + { title: "OffSync", filePath: "offsync", type: "inner", level: 0 }, + { + title: "Access Tokens", + filePath: "access-tokens", + type: "inner", + level: 0, + }, + { title: "Backups", filePath: "backups", type: "inner", level: 0 }, + { title: "Query Analyzer", filePath: "analyzer", type: "inner", level: 0 }, + { title: "Extensions", filePath: "extensions", type: "inner", level: 0 }, + { title: "Weblite (REST API)", filePath: "weblite", type: "inner", level: 0 }, // ### CLOUD SDK ### { title: "Cloud SDK", type: "secondary", icon: "docs-sdk" }, diff --git a/sqlite-cloud/sqlite-ai/aisearch-documents.mdx b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx new file mode 100644 index 0000000..e3f7588 --- /dev/null +++ b/sqlite-cloud/sqlite-ai/aisearch-documents.mdx @@ -0,0 +1,133 @@ +--- +title: Build AI Search for Your Documentation +description: SQLite AI Search for your documents and files +category: platform +status: publish +slug: aisearch-documents +--- + +import Callout from "@commons-components/Information/Callout.astro"; + +This guide shows you how to set up a ready-to-use AI semantic search for your documents and files. +Using the [sqlite-aisearch-action](https://github.com/sqliteai/sqlite-aisearch-action), you can integrate document processing into your GitHub workflow and set up a chatbot on your site in just a few steps. + +The semantic search is powered by [SQLite RAG](https://github.com/sqliteai/sqlite-rag). + +## Step 1: Set Up Your GitHub Workflow + +1. **Get Your Connection String**: Ensure you have a project on the [SQLite Cloud dashboard](https://dashboard.sqlitecloud.io). If not, sign up for [SQLite AI](https://sqlite.ai) to create one for free. + +2. **Set GitHub Secret**: Add your connection string as `SQLITECLOUD_CONNECTION_STRING` in your repository secrets. + +3. **Add to Workflow**: Create or update your GitHub workflow: + +```yaml +name: AI Search Index + +on: + push: + branches: [main] + workflow_dispatch: + +jobs: + build-search: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build AI Search Database + uses: sqliteai/sqlite-aisearch-action@v1 + with: + connection_string: ${{ secrets.SQLITECLOUD_CONNECTION_STRING }} + base_url: https://docs.yoursite.com + database_name: aidocs_search.db + source_files: ./path/to/documents +``` + +## Step 2: Create the Search Edge Function + +To enable search functionality on your indexed database, create an Edge Function using the provided template: + +1. Access your dashboard at https://dashboard.sqlitecloud.io +2. Navigate to the same project where your database was uploaded +3. Go to the **Edge Functions** section + ![AISearch Edge Function](@docs-website-assets/aisearch-docs/edgefn_aisearch.png) +4. Create a new `Javascript Function` and copy the code from [aisearch-docs.js](https://github.com/sqliteai/sqlite-aisearch-action/blob/main/search_edge_function_template/aisearch-docs.js) into the editor +5. Deploy and test + +### How to Perform a Search + +1. Go to **Details** in the Edge Function panel and copy the **Function URL** + ![AISearch Edge Function Details](@docs-website-assets/aisearch-docs/edgefn_aisearch_details.png) +2. Execute a GET request with a URL-encoded query as the `query` parameter + + Example: + + ``` + GET https://myproject.cloud/v2/functions/aisearch-docs?query=what%27s+Offsync%3F + ``` + +## Step 3: Integrate the Docs Chatbot in Your Website + +Once you have your search edge function deployed, you can easily add an interactive AI chatbot to your website. The chatbot provides a user-friendly interface for your documentation search, powered by the indexed content. + +![Docs Chatbot](@docs-website-assets/aisearch-docs/docs_chatbot.png) + +### React Integration + +Install the chatbot package: + +```bash +npm install @sqliteai/docs-chatbot +``` + +Then add it to your React application: + +```tsx +import { DocsChatbot } from "@sqliteai/docs-chatbot"; +import "@sqliteai/docs-chatbot/style.css"; + +function App() { + return ( + + ); +} +``` + + + - Replace the `searchUrl` with your **Function URL** from Step 2 + - For the `apiKey`, you need to use an API key with read + permissions on your AI docs database. Learn how to create and manage API keys + in the [API Key documentation](/docs/apikey). + + +### Vanilla JavaScript + +For non-React applications, use the web component: + +```html + + + + + + + + + + + + + +``` + +By default, the chatbot displays as a floating button in the bottom-right corner. +For advanced configuration options including custom triggers, theming, and API reference, see the [full docs chatbot documentation](https://github.com/sqliteai/docs-chatbot).