Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Go to the [examples directory](examples) to try out with any of the examples, fo
| [Code Embedding](examples/code_embedding) | Index code embeddings for semantic search |
| [PDF Embedding](examples/pdf_embedding) | Parse PDF and index text embeddings for semantic search |
| [Manuals LLM Extraction](examples/manuals_llm_extraction) | Extract structured information from a manual using LLM |
| [Google Drive Text Embedding](examples/gdrive_text_embedding) | Index text documents from Google Drive |

More coming and stay tuned! If there's any specific examples you would like to see, please let us know in our [Discord community](https://discord.com/invite/zpA9S2DR7s) 🌱.

Expand Down
10 changes: 6 additions & 4 deletions examples/gdrive_text_embedding/.env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Postgres database address for cocoindex
COCOINDEX_DATABASE_URL=postgres://cocoindex:cocoindex@localhost/cocoindex

# Google Drive service account credential path
# GOOGLE_SERVICE_ACCOUNT_CREDENTIAL=/path/to/service_account_credential.json
# Google Drive service account credential path.
#! PLEASE FILL IN
GOOGLE_SERVICE_ACCOUNT_CREDENTIAL=/path/to/service_account_credential.json

# Google Drive root folder IDs, comma separated
# GOOGLE_DRIVE_ROOT_FOLDER_IDS=id1,id2
# Google Drive root folder IDs, comma separated.
#! PLEASE FILL IN
GOOGLE_DRIVE_ROOT_FOLDER_IDS=id1,id2
20 changes: 19 additions & 1 deletion examples/gdrive_text_embedding/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
Simple example for cocoindex: build embedding index based on Google Drive files.

## Prerequisite
[Install Postgres](https://cocoindex.io/docs/getting_started/installation#-install-postgres) if you don't have one.

Before running the example, you need to:

1. [Install Postgres](https://cocoindex.io/docs/getting_started/installation#-install-postgres) if you don't have one.

2. Prepare for Google Drive:

- Setup a service account in Google Cloud, and download the credential file.
- Share folders containing files you want to import with the service account's email address.

See [Setup for Google Drive](https://cocoindex.io/docs/ops/sources#setup-for-google-drive) for more details.

3. Create `.env` file with your credential file and folder IDs.
Starting from copying the `.env.example`, and then edit it to fill in your credential file path and folder IDs.

```bash
cp .env.exmaple .env
$EDITOR .env
```

## Run

Expand Down