Skip to content

Commit 141379b

Browse files
committed
feat(aisearch): aisearch-action guide
1 parent e9eab67 commit 141379b

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

sqlite-cloud/aisearch-docs.mdx

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: AI Search for your documents and files
3+
description: SQLite AI Search for your documents and files
4+
category: getting-started
5+
status: publish
6+
slug: aisearch-documents
7+
---
8+
9+
# AI Search for Your Documents and Files
10+
11+
This guide shows you how to set up a ready-to-use AI semantic search for your documents and files.
12+
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 chat bot on your site in just a few steps.
13+
14+
The semantic search is powered by [SQLite RAG](https://github.com/sqliteai/sqlite-rag).
15+
16+
## Set Up Your GitHub Workflow
17+
18+
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.
19+
20+
2. **Set GitHub Secret**: Add your connection string as `SQLITECLOUD_CONNECTION_STRING` in your repository secrets.
21+
22+
3. **Add to Workflow**: Create or update your GitHub workflow:
23+
24+
```yaml
25+
name: AI Search Index
26+
27+
on:
28+
push:
29+
branches: [main]
30+
workflow_dispatch:
31+
32+
jobs:
33+
build-search:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Build AI Search Database
39+
uses: sqliteai/sqlite-aisearch-action@v1
40+
with:
41+
connection_string: ${{ secrets.SQLITECLOUD_CONNECTION_STRING }}
42+
base_url: https://docs.yoursite.com
43+
database_name: aidocs_search.db
44+
source_files: ./path/to/documents
45+
```
46+
47+
## Create the Search Edge Function
48+
49+
To enable search functionality on your indexed database, create an Edge Function using the provided template:
50+
51+
1. Access your dashboard at https://dashboard.sqlitecloud.io
52+
2. Navigate to the same project where your database was uploaded
53+
3. Go to the **Edge Functions** section
54+
![AISearch Edge Function](@docs-website-assets/aisearch-docs/edgefn_aisearch.png)
55+
4. Create a new `Javascript Function` and copy the code from [aisearch-docs.js](search_edge_function_template/aisearch-docs.js) into the editor
56+
5. Deploy and test
57+
58+
### How to Perform a Search
59+
60+
1. Go to **Details** in the Edge Function panel and copy the **Function URL**
61+
![AISearch Edge Function Details](@docs-website-assets/aisearch-docs/edgefn_aisearch_details.png)
62+
2. Execute a GET request with a URL-encoded query as the `query` parameter
63+
64+
Example:
65+
```
66+
GET https://myproject.cloud/v2/functions/aisearch-docs?query=what%27s+Offsync%3F
67+
```

0 commit comments

Comments
 (0)