|
| 1 | +name: "SQLite AI - AI search for documents" |
| 2 | +description: "Parses document files to create a database on your SQLite Cloud project." |
| 3 | +author: "SQLite AI Team" |
| 4 | + |
| 5 | +inputs: |
| 6 | + connection_string: |
| 7 | + description: The SQLite Cloud project connection string. |
| 8 | + required: true |
| 9 | + base_url: |
| 10 | + description: Your website's documentation base url. |
| 11 | + required: true |
| 12 | + database: |
| 13 | + description: The name of the database to use on SQLite Cloud, just remeber to create first a database on your project! |
| 14 | + required: true |
| 15 | + source_files: |
| 16 | + description: The path of the files, by default it will parse every file recursively starting from the working directory. |
| 17 | + required: false |
| 18 | + default: $(pwd) |
| 19 | + hf_model_id: |
| 20 | + description: The Hugging Face model ID to use for generating embeddings. |
| 21 | + required: false |
| 22 | + default: "Qwen/Qwen3-Embedding-0.6B-GGUF" |
| 23 | + hf_gguf_file: |
| 24 | + description: The GGUF file name for the Hugging Face model. |
| 25 | + required: false |
| 26 | + default: "Qwen3-Embedding-0.6B-f16.gguf" |
| 27 | + hf_gguf_update_date: |
| 28 | + description: The date to force update the GGUF model cache, format YYYYMMDD. |
| 29 | + required: false |
| 30 | + default: "202507014" |
| 31 | + hf_model_local_path: |
| 32 | + description: The local path to store the downloaded Hugging Face model. |
| 33 | + required: false |
| 34 | + default: "./models" |
| 35 | + |
| 36 | + |
| 37 | +branding: |
| 38 | + icon: "search" |
| 39 | + color: "blue" |
| 40 | + |
| 41 | +runs: |
| 42 | + using: "composite" |
| 43 | + steps: |
| 44 | + |
| 45 | + - name: Set GitHub Path |
| 46 | + run: echo "${{ github.action_path }}/src" >> $GITHUB_PATH |
| 47 | + shell: bash |
| 48 | + |
| 49 | + - name: Set up Python |
| 50 | + uses: actions/setup-python@v5 |
| 51 | + |
| 52 | + - name: Install SQLite RAG |
| 53 | + run: | |
| 54 | + python -m pip install --upgrade pip |
| 55 | + pip install -i https://test.pypi.org/simple/ sqlite-rag |
| 56 | + shell: bash |
| 57 | + |
| 58 | + # Cache the downloaded model between workflows |
| 59 | + - name: Restore GGUF model cache |
| 60 | + uses: actions/cache@v4 |
| 61 | + id: cache-model |
| 62 | + with: |
| 63 | + path: ${{ inputs.hf_model_local_path }} |
| 64 | + # Change the HF_GGUF_UPDATE_DATE variable to force update the cache |
| 65 | + key: gguf-${{ inputs.hf_model_id }}-${{ inputs.hf_gguf_file }}-${{ inputs.hf_gguf_update_date }} |
| 66 | + restore-keys: | |
| 67 | + gguf-${{ inputs.hf_model_id }}-${{ inputs.hf_gguf_file }}-${{ inputs.hf_gguf_update_date }}- |
| 68 | +
|
| 69 | + - name: Parse documents and create the database |
| 70 | + run: | |
| 71 | + sqlite-rag download-model "${{ inputs.hf_model_id }}" "${{ inputs.hf_gguf_file }}" --local-dir="${{ inputs.hf_model_local_path }}" |
| 72 | + sqlite-rag add \ |
| 73 | + --recursive {{ inputs.source_files }} \ |
| 74 | + --metadata '{"base_url": "{{ inputs.base_url }}"}' |
| 75 | + shell: bash |
| 76 | + |
| 77 | + - name: Upload the database to SQLite Cloud |
| 78 | + run: bash $GITHUB_ACTION_PATH/upload.sh |
| 79 | + env: |
| 80 | + GITHUB_ACTION_PATH: ${{ github.action_path }} |
| 81 | + CONNECTION_STRING: ${{ inputs.connection_string }} |
| 82 | + DATABASE_PATH: ${{ inputs.database_path }} |
| 83 | + DATABASE: ${{ inputs.database }} |
| 84 | + shell: bash |
0 commit comments