🤖 ws-bom-robot-app
A FastAPI application serving ws bom/robot/llm platform ai
🌵 Minimal app structure
app/
|-- .env
|-- main.py
Fill main.py with the following code:
from ws_bom_robot_app import main
app = main.app
Create a .env file in the root directory with the following configuration:
# robot configuration
robot_env=development
robot_user=your_username
USER_AGENT=ws-bom-robot-app
# cms (bowl) configuration
robot_cms_host='http://localhost:4000'
robot_cms_auth='users API-Key your-api-key-here'
# llm providers: fill one or more of these with your API keys
DEEPSEEK_API_KEY="your-deepseek-api-key"
OPENAI_API_KEY="your-openai-api-key"
GOOGLE_API_KEY="your-google-api-key"
ANTHROPIC_API_KEY="your-anthropic-api-key"
GROQ_API_KEY="your-groq-api-key"
# ibm
WATSONX_URL="https://eu-gb.ml.cloud.ibm.com"
WATSONX_APIKEY="your-watsonx-api-key"
WATSONX_PROJECTID="your-watsonx-project-id"
# gvertex: ensure to mount the file in docker
GOOGLE_APPLICATION_CREDENTIALS="./.data/secrets/google-credentials.json"
🚀 Run the app
-
development
fastapi dev --port 6001 #uvicorn main:app --app-dir ./ws_bom_robot_app --reload --reload-dir ws_bom_robot_app --host 0.0.0.0 --port 6001 #uvicorn main:app --app-dir ./ws_bom_robot_app --host 0.0.0.0 --port 6001
-
production
uvicorn main:app --host 0.0.0.0 --port 6001
-
production with multipler workers
fastapi run --port 6001 --workers 4 #uvicorn main:app --host 0.0.0.0 --port 6001 --workers 4 #gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app --bind
📖 API documentation
🐳 Docker
dockerize base image
<# cpu #>
docker build -f Dockerfile-robot-base-cpu -t ws-bom-robot-base:cpu .
docker tag ws-bom-robot-base:cpu ghcr.io/websolutespa/ws-bom-robot-base:cpu
docker push ghcr.io/websolutespa/ws-bom-robot-base:cpu
<# gpu #>
docker build -f Dockerfile-robot-base-gpu -t ws-bom-robot-base:gpu .
docker tag ws-bom-robot-base:gpu ghcr.io/websolutespa/ws-bom-robot-base:gpu
docker push ghcr.io/websolutespa/ws-bom-robot-base:gpu
dockerize app (from src)
- cpu
docker build -f Dockerfile -t ws-bom-robot-app:cpu --build-arg DEVICE=cpu .
docker run --rm -d --name ws-bom-robot-app --env-file .env -p 6001:6001 ws-bom-robot-app:cpu
- gpu
docker build -f Dockerfile -t ws-bom-robot-app:gpu --build-arg DEVICE=gpu .
docker run --rm -d --name ws-bom-robot-app --gpus all --env-file .env -p 6001:6001 ws-bom-robot-app:gpu
dockerize app (from latest)
- cpu
docker build -f Dockerfile-pkg -t ws-bom-robot-app-pkg:cpu --build-arg DEVICE=cpu .
docker run --rm -d --name ws-bom-robot-app-pkg --env-file .env -p 6001:6001 ws-bom-robot-app-pkg:cpu
- gpu
docker build -f Dockerfile-pkg -t ws-bom-robot-app-pkg:gpu --build-arg DEVICE=gpu .
docker run --rm -d --name ws-bom-robot-app-pkg --gpus all --env-file .env -p 6001:6001 ws-bom-robot-app-pkg:gpu
<# test gpu: nvidia-smi #>
docker run mounted to src (dev mode)
docker run --rm -d --env-file .env -v "$(pwd)/.data:/app/.data" -p 6001:6001 ws-bom-robot-app fastapi dev ./ws_bom_robot_app/main.py --host 0.0.0.0 --port 6001
docker run --rm -d --env-file .env -v "$(pwd)/.data:/app/.data" -p 6001:6001 ws-bom-robot-app uvicorn ws_bom_robot_app.main:app --reload --host 0.0.0.0 --port 6001
🔖 Windows requirements (for RAG functionality only)
⚠️ While it's strongly recommended to use a docker container for development, you can run the app on Windows with the following requirements
libmagic (mandatory)
py -m pip install --upgrade python-magic-bin
tesseract-ocr (mandatory)
Install tesseract Last win-64 release
Add tesseract executable (C:\Program Files\Tesseract-OCR) to system PATH
$pathToAdd = "C:\Program Files\Tesseract-OCR"; `
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
if ($currentPath -split ';' -notcontains $pathToAdd) { `
[System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
}
docling
Set the following environment variables
KMP_DUPLICATE_LIB_OK=TRUE
libreoffice (optional: for robot_env set to development/production)
Install libreoffice Last win-64 release
Add libreoffice executable (C:\Program Files\LibreOffice\program) to system PATH
$pathToAdd = "C:\Program Files\LibreOffice\program"; `
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
if ($currentPath -split ';' -notcontains $pathToAdd) { `
[System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
}
poppler (optional: for robot_env set to development/production)
Download win poppler release Extract the zip, copy the nested folder "poppler-x.x.x." to a program folder (e.g. C:\Program Files\poppler-24.08.0) Add poppler executable (C:\Program Files\poppler-24.08.0\Library\bin) to system PATH
$pathToAdd = "C:\Program Files\poppler-24.08.0\Library\bin"; `
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
if ($currentPath -split ';' -notcontains $pathToAdd) { `
[System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
}
👷 Contributors
Build/distribute pkg from websolutespa bom [Github]
dir in
robotproject folder
cd ./src/robot
🔖 requirements
- install uv venv package management
py -m pip install --upgrade uv
# create venv
uv venv
# activate venv
#win: .venv/Scripts/activate
#linux: source .venv/bin/activate
- project requirements update
uv pip install --upgrade -r requirements.txt
- build tools
uv pip install --upgrade setuptools build twine streamlit
🪛 build
- clean dist and build package
if (Test-Path ./dist) {rm ./dist -r -force}; `
py -m build && twine check dist/*
- linux/mac
[ -d ./dist ] && rm -rf ./dist
python -m build && twine check dist/*
📦 test / 🧪 debugger
Install the package in editable project location
uv pip install -U -e .
uv pip show ws-bom-robot-app
code quality tools
# .\src\robot
uv pip install -U scanreq prospector[with_everything]
## unused requirements
scanreq -r requirements.txt -p ./ws_bom_robot_app
## style/linting
prospector ./ws_bom_robot_app -t pylint -t pydocstyle
## code quality/complexity
prospector ./ws_bom_robot_app -t vulture -t mccabe -t mypy
## security
prospector ./ws_bom_robot_app -t dodgy -t bandit
## package
prospector ./ws_bom_robot_app -t pyroma
🧪 run tests
uv pip install -U pytest pytest-asyncio pytest-mock pytest-cov pyclean
# clean cache if needed
# pyclean --verbose .
pytest --cov=ws_bom_robot_app --log-cli-level=info
# directory
# pytest --cov=ws_bom_robot_app.llm.vector_store --log-cli-level=info ./tests/app/llm/vector_store
🐞 start debugger
streamlit run debugger.py --server.port 8051
✈️ publish
Metadata
Release files for ws-bom-robot-app 0.0.137
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ws_bom_robot_app-0.0.137.tar.gz | 114.4 kB | Without provenance | Details for ws_bom_robot_app-0.0.137.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ws_bom_robot_app-0.0.137-py3-none-any.whl | Python 3 | none | any | Details for ws_bom_robot_app-0.0.137-py3-none-any.whl |
Total release size: 259.1 kB
Release files / ws_bom_robot_app-0.0.137.tar.gz
| Download URL | ws_bom_robot_app-0.0.137.tar.gz |
|---|---|
| Size | 114.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45ed0a71d28f27970d86e3f1cfd4301a181d3801fb7a7f9276b197c55332302b
|
|
BLAKE2b-256 checksum How to use checksums |
df91cb03628a405eb4e02a5769f99554eb2755cfe4ffd2d3487a0b72f12d3afd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / ws_bom_robot_app-0.0.137-py3-none-any.whl
| Download URL | ws_bom_robot_app-0.0.137-py3-none-any.whl |
|---|---|
| Size | 144.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23ef497c0032eee998458824ebb0b7224b12cb9791d65530038849e51c7afd8e
|
|
BLAKE2b-256 checksum How to use checksums |
581771882534ff56998b9a65185346f734aaa701ce08a7b3e314d99b330998ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for ws-bom-robot-app 0.0.137
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.