LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
Tweak run script (#72)
Hari John Kuriakose8004f1a917ad
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.mdindex 376557848..6fbfc2dfc 100644--- a/.github/pull_request_template.md+++ b/.github/pull_request_template.md@@ -1,14 +1,22 @@## What-...+-## Why-...+-## How-...+-++## Database Migrations++-++## Env Config++-## Relevant Docs@@ -18,18 +26,16 @@--## Dependencies Versions / Env Variables+## Dependencies Versions-## Notes on Testing-...+-## Screenshots-...-## ChecklistI have read and understood the [Contribution Guidelines]().diff --git a/README.md b/README.mdindex 8a0f28b5b..19cf3e86e 100644--- a/README.md+++ b/README.md@@ -15,7 +15,7 @@ Use LLMs to eliminate manual processes involving unstructured data.Just run the `run-platform.sh` launch script to get started in few minutes.-The launch script does env setup with default values, pulls public Docker images or builds them locally and finally runs them in containers.+The launch script does env setup with default values, pulls public docker images or builds them locally and finally runs them in containers.```bash# Pull and run entire Unstract platform with default env config.@@ -24,8 +24,8 @@ The launch script does env setup with default values, pulls public Docker images# Pull and run docker containers with a specific version tag../run-platform.sh -v v0.1.0-# Build docker images and run as containers with a specific version tag.-./run-platform.sh -B -v v0.1.0+# Build docker images locally and run with a specific version tag.+./run-platform.sh -b -v v0.1.0# Display the help information../run-platform.sh -h@@ -33,10 +33,13 @@ The launch script does env setup with default values, pulls public Docker images# Only do setup of environment files../run-platform.sh -e-# Only do docker images pull/build with a specific version tag.-./run-platform.sh -b v0.1.0+# Only do docker images pull with a specific version tag.+./run-platform.sh -p -v v0.1.0-# Pull and run Docker containers in detached mode.+# Only do docker images pull by building locally with a specific version tag.+./run-platform.sh -p -b -v v0.1.0++# Pull and run docker containers in detached mode../run-platform.sh -d -v v0.1.0```diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yamlindex ed2e772c1..49005993e 100644--- a/docker/docker-compose.yaml+++ b/docker/docker-compose.yaml@@ -17,6 +17,9 @@ services:- redis- reverse-proxy- minio+ - platform-service+ - prompt-service+ - x2text-servicevolumes:- ./workflow_data:/dataenvironment:@@ -140,6 +143,7 @@ services:- ../worker/.envvolumes:- ./workflow_data:/data+ # Docker socket bind mount to spawn tool containers- /var/run/docker.sock:/var/run/docker.sockdepends_on:- redisdiff --git a/docker/dockerfiles/document.Dockerfile b/docker/dockerfiles/document.Dockerfileindex e9ddf16c5..ed49c4d3b 100644--- a/docker/dockerfiles/document.Dockerfile+++ b/docker/dockerfiles/document.Dockerfile@@ -24,13 +24,17 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update; \unoconv; \apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*; \\- pip install --no-cache-dir -U pip pdm~=${PDM_VERSION};+ pip install --no-cache-dir -U pip pdm~=${PDM_VERSION}; \+ \+ # Creates a non-root user with an explicit UID and adds permission to access the /app folder+ # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers+ adduser -u 5678 --disabled-password --gecos "" unstract;-EXPOSE 3002+USER unstractWORKDIR /app-COPY ${BUILD_CONTEXT_PATH}/ .+COPY --chown=unstract ${BUILD_CONTEXT_PATH}/ .RUN set -e; \\@@ -45,13 +49,10 @@ RUN set -e; \# REF: https://docs.gunicorn.org/en/stable/deploy.html#using-virtualenvpip install --no-cache-dir gunicorn; \\+ # Storage for document uploads and processingmkdir /app/uploads /app/processed;-# Creates a non-root user with an explicit UID and adds permission to access the /app folder-# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers-RUN adduser -u 5678 --disabled-password --gecos "" unstract;--USER unstract+EXPOSE 3002# Wrapper to run both python server and libreoffice.CMD [ "/app/wrapper.sh" ]diff --git a/docker/dockerfiles/platform.Dockerfile b/docker/dockerfiles/platform.Dockerfileindex 31237ec7a..10dc1bb08 100644--- a/docker/dockerfiles/platform.Dockerfile+++ b/docker/dockerfiles/platform.Dockerfile@@ -12,13 +12,19 @@ ENV BUILD_CONTEXT_PATH platform-serviceENV BUILD_PACKAGES_PATH unstractENV PDM_VERSION 2.12.3-RUN pip install --no-cache-dir -U pip pdm~=${PDM_VERSION};+RUN pip install --no-cache-dir -U pip pdm~=${PDM_VERSION}; \+ \+ # Creates a non-root user with an explicit UID and adds permission to access the /app folder+ # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers+ adduser -u 5678 --disabled-password --gecos "" unstract;++USER unstractWORKDIR /app-COPY ${BUILD_CONTEXT_PATH} .+COPY --chown=unstract ${BUILD_CONTEXT_PATH} .# Copy local dependency packages-COPY ${BUILD_PACKAGES_PATH} /unstract+COPY --chown=unstract ${BUILD_PACKAGES_PATH} /unstractRUN set -e; \\@@ -35,11 +41,5 @@ RUN set -e; \EXPOSE 3001-# Creates a non-root user with an explicit UID and adds permission to access the /app folder-# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers-RUN adduser -u 5678 --disabled-password --gecos "" unstract;--USER unstract-# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debugCMD [".venv/bin/gunicorn", "--bind", "0.0.0.0:3001", "--timeout", "300", "unstract.platform_service.main:app"]diff --git a/docker/dockerfiles/prompt.Dockerfile b/docker/dockerfiles/prompt.Dockerfileindex da9f5f121..aaf219cc8 100644--- a/docker/dockerfiles/prompt.Dockerfile+++ b/docker/dockerfiles/prompt.Dockerfile@@ -19,11 +19,17 @@ RUN apt-get update; \git; \apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*; \\- pip install --no-cache-dir -U pip pdm~=${PDM_VERSION};+ pip install --no-cache-dir -U pip pdm~=${PDM_VERSION}; \+ \+ # Creates a non-root user with an explicit UID and adds permission to access the /app folder+ # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers+ adduser -u 5678 --disabled-password --gecos "" unstract;++USER unstractWORKDIR /app-COPY ${BUILD_CONTEXT_PATH} .+COPY --chown=unstract ${BUILD_CONTEXT_PATH} .RUN set -e; \\@@ -61,10 +67,10 @@ RUN set -e; \#\# REF: https://docs.gunicorn.org/en/stable/deploy.html#using-virtualenv- pip install --no-cache-dir gunicorn;--# Storage for prompt studio uploads-RUN mkdir prompt-studio-data+ pip install --no-cache-dir gunicorn; \+ \+ # Storage for prompt studio uploads+ mkdir prompt-studio-data;EXPOSE 3003diff --git a/docker/dockerfiles/worker.Dockerfile b/docker/dockerfiles/worker.Dockerfileindex 1c0f185da..2cc8a0f47 100644--- a/docker/dockerfiles/worker.Dockerfile+++ b/docker/dockerfiles/worker.Dockerfile@@ -33,13 +33,8 @@ RUN set -e; \# REF: https://docs.gunicorn.org/en/stable/deploy.html#using-virtualenvpip install --no-cache-dir gunicorn gevent;-EXPOSE 5002-# Creates a non-root user with an explicit UID and adds permission to access the /app folder-# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers-RUN adduser -u 5678 --disabled-password --gecos "" unstract;-# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug# The suggested maximum concurrent requests when using workers and threads is (2*CPU)+1CMD [ "./entrypoint.sh" ]diff --git a/docker/dockerfiles/x2text.Dockerfile b/docker/dockerfiles/x2text.Dockerfileindex d710eae47..39b4b1d29 100644--- a/docker/dockerfiles/x2text.Dockerfile+++ b/docker/dockerfiles/x2text.Dockerfile@@ -10,11 +10,17 @@ ENV PYTHONUNBUFFERED 1ENV BUILD_CONTEXT_PATH x2text-serviceENV PDM_VERSION 2.12.3-RUN pip install --no-cache-dir -U pip pdm~=${PDM_VERSION}+RUN pip install --no-cache-dir -U pip pdm~=${PDM_VERSION}; \+ \+ # Creates a non-root user with an explicit UID and adds permission to access the /app folder+ # For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers+ adduser -u 5678 --disabled-password --gecos "" unstract;++USER unstractWORKDIR /app-COPY ${BUILD_CONTEXT_PATH} .+COPY --chown=unstract ${BUILD_CONTEXT_PATH} .RUN set -e; \\@@ -31,12 +37,6 @@ RUN set -e; \EXPOSE 3004-# Creates a non-root user with an explicit UID and adds permission to access the /app folder-# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers-RUN adduser -u 5678 --disabled-password --gecos "" unstract;--USER unstract-# During debugging, this entry point will be overridden.# For more information, please refer to https://aka.ms/vscode-docker-python-debugCMD [".venv/bin/gunicorn", "--bind", "0.0.0.0:3004", "--timeout", "300", "run:app"]diff --git a/run-platform.sh b/run-platform.shindex b82b23b1e..2713d5738 100755--- a/run-platform.sh+++ b/run-platform.sh@@ -42,12 +42,12 @@ display_help() {echo -e "Options:"echo -e " -h, --help Displays the help information"echo -e " -e, --only-env Only do env files setup"- echo -e " -b, --only-build Only do docker images build"- echo -e " -B, --build-local Build docker images locally"+ echo -e " -p, --only-pull Only do docker images pull"+ echo -e " -b, --build-local Build docker images locally"echo -e " -d, --detach Run docker containers in detached mode"echo -e " -x, --trace Enables trace mode"echo -e " -V, --verbose Print verbose logs"- echo -e " -v, --version Docker images version tag (default \"dev\")"+ echo -e " -v, --version Docker images version tag (default \"latest\")"echo -e ""}@@ -62,10 +62,10 @@ parse_args() {-e | --only-env)opt_only_env=true;;- -b | --only-build)- opt_only_build=true+ -p | --only-pull)+ opt_only_pull=true;;- -B | --build-local)+ -b | --build-local)opt_build_local=true;;-d | --detach)@@ -92,7 +92,7 @@ parse_args() {donedebug "OPTION only_env: $opt_only_env"- debug "OPTION only_build: $opt_only_build"+ debug "OPTION only_pull: $opt_only_pull"debug "OPTION build_local: $opt_build_local"debug "OPTION detach: $opt_detach"debug "OPTION verbose: $opt_verbose"@@ -163,7 +163,7 @@ build_services() {popd 1>/dev/null- if [ "$opt_only_build" = true ]; then+ if [ "$opt_only_pull" = true ]; thenecho "Done." && exit 0fi}@@ -192,11 +192,11 @@ if ! command -v docker compose &> /dev/null; thenfiopt_only_env=false-opt_only_build=false+opt_only_pull=falseopt_build_local=falseopt_detach=""opt_verbose=false-opt_version="dev"+opt_version="latest"script_dir=$(dirname "$(readlink -f "$BASH_SOURCE")")# Extract service names from docker compose file.