dropbox.mdx 1.0 KB

123456789101112131415161718192021222324252627
  1. ---
  2. title: '💾 Dropbox'
  3. ---
  4. To load folders or files from your Dropbox account, configure the `data_type` parameter as `dropbox` and specify the path to the desired file or folder, starting from the root directory of your Dropbox account.
  5. For Dropbox access, an **access token** is required. Obtain this token by visiting [Dropbox Developer Apps](https://www.dropbox.com/developers/apps). There, create a new app and generate an access token for it.
  6. Ensure your app has the following settings activated:
  7. - In the Permissions section, enable `files.content.read` and `files.metadata.read`.
  8. ```python
  9. import os
  10. from embedchain import Pipeline as App
  11. os.environ["DROPBOX_ACCESS_TOKEN"] = "sl.xxx"
  12. os.environ["OPENAI_API_KEY"] = "sk-xxx"
  13. app = App()
  14. # any path from the root of your dropbox account, you can leave it "" for the root folder
  15. app.add("/test", data_type="dropbox")
  16. print(app.query("Which two celebrities are mentioned here?"))
  17. # The two celebrities mentioned in the given context are Elon Musk and Jeff Bezos.
  18. ```