Giter VIP home page Giter VIP logo

dropbox-ai-chat's Introduction

Dropbox AI Chat

Quickly summarize the content and get the information you need in real-time from private large unstructured documents in your Dropbox. The same tool can be used with OneDrive.

Demo

See how the tool works:

Dropbox AI search tool demo

As you can see the LLM App enables AI-powered search from multiple unstructured documents like tax information from different countries, and indexes input data in real-time just after you upload files to the cloud storage.

How to run the tool

There are 3 ways to run the app:

Run with Conda

For a step-by-step walkthrough in real time (~7 mins) check out the video below:

Thumbnail of YouTube walkthrough

Run with Docker

  1. Create .env file in the root directory of the project, copy and paste the below config. Replace the OPENAI_API_TOKEN configuration value with your key {OPENAI_API_KEY} and replace DROPBOX_LOCAL_FOLDER_PATH with a path where Dropbox folder is located {REPLACE_WITH_DROPBOX_FOLDER_PATH}. For example, if the current project folder is DROPBOX-SEARCH-TOOL, you navigate to the Dropbox path in the home directory: ../Dropbox/documents. Other properties are optional to change and be default.
OPENAI_API_TOKEN={OPENAI_API_KEY}
EMBEDDER_LOCATOR=text-embedding-ada-002
EMBEDDING_DIMENSION=1536
MODEL_LOCATOR=gpt-3.5-turbo
MAX_TOKENS=200
TEMPERATURE=0.0
DROPBOX_LOCAL_FOLDER_PATH={REPLACE_WITH_DROPBOX_RELATIVE_PATH}
  1. From the project root folder, open your terminal and run docker compose up.
  2. Navigate to localhost:8501 on your browser when docker installion is successful.

Run from the source

Prerequisites

  1. Make sure that Python 3.10 or above installed on your machine.
  2. Download and Install Pip to manage project packages.
  3. Create an OpenAI account and generate a new API Key: To access the OpenAI API, you will need to create an API Key. You can do this by logging into the OpenAI website and navigating to the API Key management page.
  4. Use your Dropbox/OneDrive account.

Then, follow the easy steps to install and get started using the sample app.

Step 1: Clone the repository

This is done with the git clone command followed by the URL of the repository:

git clone https://github.com/pathway-labs/dropbox-ai-chat

Next, navigate to the project folder:

cd dropbox-ai-chat

Step 2: Set environment variables

Create .env file in the root directory of the project, copy and paste the below config, and replace the {OPENAI_API_KEY} configuration value with your key.

OPENAI_API_TOKEN={OPENAI_API_KEY}
HOST=0.0.0.0
PORT=8080
EMBEDDER_LOCATOR=text-embedding-ada-002
EMBEDDING_DIMENSION=1536
MODEL_LOCATOR=gpt-3.5-turbo
MAX_TOKENS=200
TEMPERATURE=0.0
DROPBOX_LOCAL_FOLDER_PATH="../../../mnt/c/Users/bumur/Dropbox/documents"

Replace DROPBOX_LOCAL_FOLDER_PATH with your local Dropbox folder path and optionally, you customize other values.

Step 3 (Optional): Create a new virtual environment

Create a new virtual environment in the same folder and activate that environment:

python -m venv pw-env && source pw-env/bin/activate

Step 4: Install the app dependencies

Install the required packages:

pip install --upgrade -r requirements.txt

Step 5: Run the Pathway API

You start the application by running main.py:

python main.py

Step 6: Run Streamlit UI

You can run the UI separately by running Streamlit app streamlit run ui.py command. It connects to the Pathway's backend API automatically and you will see the UI frontend is running on your browser.

dropbox-ai-chat's People

Contributors

arjun-ms avatar avriiil avatar berkecanrizai avatar boburmirzo avatar szymondudycz avatar zxqfd555-pw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dropbox-ai-chat's Issues

docker compose up error

Ubuntu 20.04.6 LTS
Docker version 25.0.3, build 4debf41

ui-1   |   You can now view your Streamlit app in your browser.
ui-1   | 
ui-1   |   Network URL: http://172.19.0.3:8501
ui-1   |   External URL: http://45.138.53.66:8501
ui-1   | 
api-1  | /usr/local/lib/python3.11/site-packages/beartype/_util/hint/pep/utilpeptest.py:311: BeartypeDecorHintPep585DeprecationWarning: PEP 484 type hint typing.Sequence[str] deprecated by PEP 585. This hint is scheduled for removal in the first Python version released after October 5th, 2025. To resolve this, import this hint from "beartype.typing" rather than "typing". For further commentary and alternatives, see also:
api-1  |     https://beartype.readthedocs.io/en/latest/api_roar/#pep-585-deprecations
api-1  |   warn(
api-1  | /usr/local/lib/python3.11/site-packages/pathway/io/http/_server.py:622: UserWarning: delete_completed_queries arg of rest_connector should be set explicitly. It will soon be required.
api-1  |   warn(
api-1  | Traceback (most recent call last):
api-1  |   File "/app/main.py", line 12, in <module>
api-1  |     app_api.run(host=host, port=port)
api-1  |   File "/app/api.py", line 32, in run
api-1  |     documents = input_data.select(texts=parser(pw.this.data))
api-1  |                                         ^^^^^^^^^^^^^^^^^^^^
api-1  |   File "/usr/local/lib/python3.11/site-packages/pathway/internals/udfs/__init__.py", line 194, in __call__
api-1  |     return self.executor._apply_expression_type(
api-1  |            ^^^^^^^^^^^^^
api-1  | AttributeError: 'ParseUnstructured' object has no attribute 'executor'
api-1 exited with code 1
ui-1   | 2024-03-16 15:29:33.898 Uncaught app exception
ui-1   | Traceback (most recent call last):
ui-1   |   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 198, in _new_conn
ui-1   |     sock = connection.create_connection(
ui-1   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ui-1   |   File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 60, in create_connection
ui-1   |     for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
ui-1   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ui-1   |   File "/usr/local/lib/python3.11/socket.py", line 962, in getaddrinfo
ui-1   |     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
ui-1   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ui-1   | socket.gaierror: [Errno -2] Name or service not known
ui-1   | 
ui-1   | The above exception was the direct cause of the following exception:
ui-1   | 
ui-1   | Traceback (most recent call last):
ui-1   |   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 793, in urlopen
ui-1   |     response = self._make_request(
ui-1   |                ^^^^^^^^^^^^^^^^^^^
ui-1   |   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 496, in _make_request
ui-1   |     conn.request(
ui-1   |   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 400, in request
ui-1   |     self.endheaders()
ui-1   |   File "/usr/local/lib/python3.11/http/client.py", line 1293, in endheaders
ui-1   |     self._send_output(message_body, encode_chunked=encode_chunked)
ui-1   |   File "/usr/local/lib/python3.11/http/client.py", line 1052, in _send_output
ui-1   |     self.send(msg)
ui-1   |   File "/usr/local/lib/python3.11/http/client.py", line 990, in send
ui-1   |     self.connect()
ui-1   |   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 238, in connect
ui-1   |     self.sock = self._new_conn()
ui-1   |                 ^^^^^^^^^^^^^^^^
ui-1   |   File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 205, in _new_conn
ui-1   |     raise NameResolutionError(self.host, self, e) from e
ui-1   | urllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPConnection object at 0x7f67dd4c0550>: Failed to resolve 'api' ([Errno -2] Name or service not known)
ui-1   | 
ui-1   | The above exception was the direct cause of the following exception:
ui-1   | 
ui-1   | Traceback (most recent call last):
ui-1   |   File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
ui-1   |     resp = conn.urlopen(
ui-1   |            ^^^^^^^^^^^^^
ui-1   |   File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 847, in urlopen
ui-1   |     retries = retries.increment(
ui-1   |               ^^^^^^^^^^^^^^^^^^
ui-1   |   File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 515, in increment
ui-1   |     raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
ui-1   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ui-1   | urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='api', port=8080): Max retries exceeded with url: / (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7f67dd4c0550>: Failed to resolve 'api' ([Errno -2] Name or service not known)"))
ui-1   | 
ui-1   | During handling of the above exception, another exception occurred:
ui-1   | 
ui-1   | Traceback (most recent call last):
ui-1   |   File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 542, in _run_script
ui-1   |     exec(code, module.__dict__)
ui-1   |   File "/app/ui.py", line 25, in <module>
ui-1   |     response = requests.post(url, json=data)
ui-1   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ui-1   |   File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 115, in post
ui-1   |     return request("post", url, data=data, json=json, **kwargs)
ui-1   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ui-1   |   File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request
ui-1   |     return session.request(method=method, url=url, **kwargs)
ui-1   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ui-1   |   File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
ui-1   |     resp = self.send(prep, **send_kwargs)
ui-1   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ui-1   |   File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
ui-1   |     r = adapter.send(request, **kwargs)
ui-1   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ui-1   |   File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
ui-1   |     raise ConnectionError(e, request=request)
ui-1   | requests.exceptions.ConnectionError: HTTPConnectionPool(host='api', port=8080): Max retries exceeded with url: / (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7f67dd4c0550>: Failed to resolve 'api' ([Errno -2] Name or service not known)"))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.