ws-bom-robot-app 0.0.97__py3-none-any.whl → 0.0.99__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. ws_bom_robot_app/llm/agent_description.py +123 -123
  2. ws_bom_robot_app/llm/agent_handler.py +176 -176
  3. ws_bom_robot_app/llm/agent_lcel.py +50 -63
  4. ws_bom_robot_app/llm/defaut_prompt.py +15 -15
  5. ws_bom_robot_app/llm/feedbacks/feedback_manager.py +66 -66
  6. ws_bom_robot_app/llm/main.py +158 -159
  7. ws_bom_robot_app/llm/models/api.py +0 -2
  8. ws_bom_robot_app/llm/models/feedback.py +30 -30
  9. ws_bom_robot_app/llm/nebuly_handler.py +185 -185
  10. ws_bom_robot_app/llm/providers/llm_manager.py +2 -7
  11. ws_bom_robot_app/llm/tools/tool_builder.py +68 -68
  12. ws_bom_robot_app/llm/tools/tool_manager.py +332 -332
  13. ws_bom_robot_app/llm/tools/utils.py +41 -41
  14. ws_bom_robot_app/llm/utils/agent.py +34 -34
  15. ws_bom_robot_app/llm/utils/cms.py +114 -114
  16. ws_bom_robot_app/llm/utils/download.py +183 -183
  17. ws_bom_robot_app/llm/utils/print.py +29 -29
  18. ws_bom_robot_app/llm/vector_store/db/qdrant.py +28 -14
  19. ws_bom_robot_app/llm/vector_store/generator.py +137 -137
  20. ws_bom_robot_app/llm/vector_store/integration/base.py +1 -0
  21. ws_bom_robot_app/llm/vector_store/integration/shopify.py +143 -143
  22. ws_bom_robot_app/llm/vector_store/integration/thron.py +236 -236
  23. ws_bom_robot_app/llm/vector_store/loader/base.py +3 -2
  24. ws_bom_robot_app/llm/vector_store/loader/docling.py +32 -12
  25. ws_bom_robot_app/llm/vector_store/loader/json_loader.py +25 -25
  26. {ws_bom_robot_app-0.0.97.dist-info → ws_bom_robot_app-0.0.99.dist-info}/METADATA +364 -333
  27. {ws_bom_robot_app-0.0.97.dist-info → ws_bom_robot_app-0.0.99.dist-info}/RECORD +29 -29
  28. {ws_bom_robot_app-0.0.97.dist-info → ws_bom_robot_app-0.0.99.dist-info}/WHEEL +0 -0
  29. {ws_bom_robot_app-0.0.97.dist-info → ws_bom_robot_app-0.0.99.dist-info}/top_level.txt +0 -0
@@ -1,333 +1,364 @@
1
- Metadata-Version: 2.4
2
- Name: ws_bom_robot_app
3
- Version: 0.0.97
4
- Summary: A FastAPI application serving ws bom/robot/llm platform ai.
5
- Home-page: https://github.com/websolutespa/bom
6
- Author: Websolute Spa
7
- Author-email: dev@websolute.it
8
- License: MIT
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.12
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: standardwebhooks==1.0.0
14
- Requires-Dist: apscheduler==3.11.0
15
- Requires-Dist: aiofiles==24.1.0
16
- Requires-Dist: pydantic==2.11.9
17
- Requires-Dist: pydantic-settings==2.11.0
18
- Requires-Dist: fastapi[standard]==0.118.0
19
- Requires-Dist: chevron==0.14.0
20
- Requires-Dist: msoffcrypto-tool==5.4.2
21
- Requires-Dist: langchain==0.3.27
22
- Requires-Dist: langchain-community==0.3.30
23
- Requires-Dist: langchain-core==0.3.76
24
- Requires-Dist: langchain-openai==0.3.33
25
- Requires-Dist: langchain-anthropic==0.3.21
26
- Requires-Dist: langchain-ibm==0.3.18
27
- Requires-Dist: langchain-google-genai==2.1.12
28
- Requires-Dist: langchain-google-vertexai==2.1.2
29
- Requires-Dist: langchain-groq==0.3.8
30
- Requires-Dist: langchain-ollama==0.3.8
31
- Requires-Dist: openevals==0.1.0
32
- Requires-Dist: faiss-cpu==1.12.0
33
- Requires-Dist: chromadb==1.1.0
34
- Requires-Dist: langchain-chroma==0.2.6
35
- Requires-Dist: langchain-qdrant==0.2.1
36
- Requires-Dist: qdrant-client[fastembed]==1.15.1
37
- Requires-Dist: lark==1.3.0
38
- Requires-Dist: unstructured==0.18.15
39
- Requires-Dist: unstructured[image]
40
- Requires-Dist: unstructured-ingest==1.2.18
41
- Requires-Dist: unstructured-ingest[azure]
42
- Requires-Dist: unstructured-ingest[confluence]
43
- Requires-Dist: unstructured-ingest[dropbox]
44
- Requires-Dist: unstructured-ingest[gcs]
45
- Requires-Dist: unstructured-ingest[github]
46
- Requires-Dist: unstructured-ingest[google_drive]
47
- Requires-Dist: unstructured-ingest[jira]
48
- Requires-Dist: unstructured-ingest[s3]
49
- Requires-Dist: unstructured-ingest[sftp]
50
- Requires-Dist: unstructured-ingest[sharepoint]
51
- Requires-Dist: unstructured-ingest[slack]
52
- Requires-Dist: html5lib==1.1
53
- Requires-Dist: markdownify==1.2.0
54
- Requires-Dist: duckduckgo-search==8.1.1
55
- Requires-Dist: langchain-google-community==2.0.10
56
- Requires-Dist: trafilatura==2.0.0
57
- Dynamic: author
58
- Dynamic: author-email
59
- Dynamic: classifier
60
- Dynamic: description
61
- Dynamic: description-content-type
62
- Dynamic: home-page
63
- Dynamic: license
64
- Dynamic: requires-dist
65
- Dynamic: requires-python
66
- Dynamic: summary
67
-
68
- # 🤖 ws-bom-robot-app
69
-
70
- A `FastAPI` application serving ws bom/robot/llm platform ai
71
-
72
- ## 🌵 Minimal app structure
73
-
74
- ```env
75
- app/
76
- |-- .env
77
- |-- main.py
78
- ```
79
-
80
- Fill `main.py` with the following code:
81
-
82
- ```python
83
- from ws_bom_robot_app import main
84
- app = main.app
85
- ```
86
-
87
- Create a `.env` file in the root directory with the following configuration:
88
-
89
- ```properties
90
- # robot configuration
91
- robot_env=development
92
- robot_user=your_username
93
- USER_AGENT=ws-bom-robot-app
94
-
95
- # cms (bowl) configuration
96
- robot_cms_host='http://localhost:4000'
97
- robot_cms_auth='users API-Key your-api-key-here'
98
-
99
- # llm providers: fill one or more of these with your API keys
100
- DEEPSEEK_API_KEY="your-deepseek-api-key"
101
- OPENAI_API_KEY="your-openai-api-key"
102
- GOOGLE_API_KEY="your-google-api-key"
103
- ANTHROPIC_API_KEY="your-anthropic-api-key"
104
- GROQ_API_KEY="your-groq-api-key"
105
- # ibm
106
- WATSONX_URL="https://eu-gb.ml.cloud.ibm.com"
107
- WATSONX_APIKEY="your-watsonx-api-key"
108
- WATSONX_PROJECTID="your-watsonx-project-id"
109
- # gvertex: ensure to mount the file in docker
110
- GOOGLE_APPLICATION_CREDENTIALS="./.data/secrets/google-credentials.json"
111
- ```
112
-
113
- ## 🚀 Run the app
114
-
115
- - development
116
-
117
- ```bash
118
- fastapi dev --port 6001
119
- #uvicorn main:app --app-dir ./ws_bom_robot_app --reload --reload-dir ws_bom_robot_app --host 0.0.0.0 --port 6001
120
- ```
121
-
122
- - production
123
-
124
- ```bash
125
- uvicorn main:app --host 0.0.0.0 --port 6001
126
- ```
127
-
128
- - production with [multipler workers](https://fastapi.tiangolo.com/deployment/server-workers/#multiple-workers)
129
-
130
- ```bash
131
- fastapi run --port 6001 --workers 4
132
- #uvicorn main:app --host 0.0.0.0 --port 6001 --workers 4
133
- #gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app --bind
134
- ```
135
-
136
- ## 📖 API documentation
137
-
138
- - [swagger](http://localhost:6001/docs)
139
- - [redoc](http://localhost:6001/redoc)
140
-
141
- ---
142
-
143
- ## 🐳 Docker
144
-
145
- dockerize base image
146
-
147
- ```pwsh
148
- <# cpu #>
149
- #docker build -f Dockerfile-robot-base-cpu -t ws-bom-robot-base:cpu .
150
- #docker tag ws-bom-robot-base:cpu ghcr.io/websolutespa/ws-bom-robot-base:cpu
151
- docker build -f Dockerfile-robot-base-cpu -t ghcr.io/websolutespa/ws-bom-robot-base:cpu .
152
- docker push ghcr.io/websolutespa/ws-bom-robot-base:cpu
153
- <# gpu #>
154
- docker build -f Dockerfile-robot-base-gpu -t ghcr.io/websolutespa/ws-bom-robot-base:gpu .
155
- docker push ghcr.io/websolutespa/ws-bom-robot-base:gpu
156
- ```
157
-
158
- dockerize app (from src)
159
-
160
- ```pwsh
161
- docker build -f Dockerfile -t ws-bom-robot-app .
162
- docker run --rm -d --name ws-bom-robot-app --env-file .env -p 6001:6001 ws-bom-robot-app
163
- ```
164
-
165
- dockerize app (from latest)
166
-
167
- ```pwsh
168
- docker build -f Dockerfile-pkg -t ws-bom-robot-app-pkg .
169
- docker run --rm -d --name ws-bom-robot-app-pkg --env-file .env -p 6001:6001 ws-bom-robot-app-pkg
170
- ```
171
-
172
- docker run mounted to src (dev mode)
173
-
174
- ```pwsh
175
- 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
176
- 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
177
- ```
178
-
179
- ---
180
-
181
- ## 🔖 Windows requirements (for RAG functionality only)
182
-
183
- > ⚠️ While it's strongly recommended to use a docker container for development, you can run the app on Windows with the following requirements
184
-
185
- ### libmagic (mandatory)
186
-
187
- ```bash
188
- py -m pip install --upgrade python-magic-bin
189
- ```
190
-
191
- ### tesseract-ocr (mandatory)
192
-
193
- [Install tesseract](https://github.com/UB-Mannheim/tesseract/wiki)
194
- [Last win-64 release](https://github.com/tesseract-ocr/tesseract/releases/download/5.5.0/tesseract-ocr-w64-setup-5.5.0.20241111.exe)
195
-
196
- Add tesseract executable (C:\Program Files\Tesseract-OCR) to system PATH
197
-
198
- ```pwsh
199
- $pathToAdd = "C:\Program Files\Tesseract-OCR"; `
200
- $currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
201
- if ($currentPath -split ';' -notcontains $pathToAdd) { `
202
- [System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
203
- }
204
- ```
205
-
206
- ### docling
207
-
208
- Set the following environment variables
209
-
210
- ```pwsh
211
- KMP_DUPLICATE_LIB_OK=TRUE
212
- ```
213
-
214
- ### libreoffice (optional: for robot_env set to development/production)
215
-
216
- [Install libreoffice](https://www.libreoffice.org/download/download-libreoffice/)
217
- [Last win-64 release](https://download.documentfoundation.org/libreoffice/stable/24.8.2/win/x86_64/LibreOffice_24.8.2_Win_x86-64.msi)
218
-
219
- Add libreoffice executable (C:\Program Files\LibreOffice\program) to system PATH
220
-
221
- ```pwsh
222
- $pathToAdd = "C:\Program Files\LibreOffice\program"; `
223
- $currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
224
- if ($currentPath -split ';' -notcontains $pathToAdd) { `
225
- [System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
226
- }
227
- ```
228
-
229
- ### poppler (optional: for robot_env set to development/production)
230
-
231
- [Download win poppler release](https://github.com/oschwartz10612/poppler-windows/releases)
232
- Extract the zip, copy the nested folder "poppler-x.x.x." to a program folder (e.g. C:\Program Files\poppler-24.08.0)
233
- Add poppler executable (C:\Program Files\poppler-24.08.0\Library\bin) to system PATH
234
-
235
- ```pwsh
236
- $pathToAdd = "C:\Program Files\poppler-24.08.0\Library\bin"; `
237
- $currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
238
- if ($currentPath -split ';' -notcontains $pathToAdd) { `
239
- [System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
240
- }
241
- ```
242
-
243
- ---
244
-
245
- ## 👷 Contributors
246
-
247
- Build/distribute pkg from `websolutespa` bom [[Github](https://github.com/websolutespa/bom)]
248
-
249
- > dir in `robot` project folder
250
-
251
- ```bash
252
- cd ./src/robot
253
- ```
254
-
255
- ### 🔖 requirements
256
-
257
- - project requirements update
258
-
259
- ```bash
260
- py requirement_update.py
261
- ```
262
-
263
- - build tools
264
-
265
- ```bash
266
- py -m pip install --upgrade setuptools build twine streamlit
267
- ```
268
-
269
- ### 🪛 build
270
-
271
- ```pwsh
272
- if (Test-Path ./dist) {rm ./dist -r -force}; `
273
- py -m build && twine check dist/*
274
- ```
275
-
276
- ### 📦 test / 🧪 debugger
277
-
278
- Install the package in editable project location
279
-
280
- ```pwsh
281
- py -m pip install -U -e .
282
- py -m pip show ws-bom-robot-app
283
- ```
284
-
285
- code quality tools
286
-
287
- ```pwsh
288
- # .\src\robot
289
- !py -m pip install -U scanreq prospector[with_everything]
290
- ## unused requirements
291
- scanreq -r requirements.txt -p ./ws_bom_robot_app
292
- ## style/linting
293
- prospector ./ws_bom_robot_app -t pylint -t pydocstyle
294
- ## code quality/complexity
295
- prospector ./ws_bom_robot_app -t vulture -t mccabe -t mypy
296
- ## security
297
- prospector ./ws_bom_robot_app -t dodgy -t bandit
298
- ## package
299
- prospector ./ws_bom_robot_app -t pyroma
300
- ```
301
-
302
- #### 🧪 run tests
303
-
304
- ```pwsh
305
- !py -m pip install -U pytest pytest-asyncio pytest-mock pytest-cov pyclean
306
- # clean cache if needed
307
- # pyclean --verbose .
308
- pytest --cov=ws_bom_robot_app --log-cli-level=info
309
- # directory
310
- # pytest --cov=ws_bom_robot_app.llm.vector_store --log-cli-level=info ./tests/app/llm/vector_store
311
- ```
312
-
313
- #### 🐞 start debugger
314
-
315
- ```pwsh
316
- streamlit run debugger.py --server.port 8051
317
- ```
318
-
319
- ### ✈️ publish
320
-
321
- - [testpypi](https://test.pypi.org/project/ws-bom-robot-app/)
322
-
323
- ```pwsh
324
- twine upload --verbose -r testpypi dist/*
325
- #pip install -i https://test.pypi.org/simple/ -U ws-bom-robot-app
326
- ```
327
-
328
- - [pypi](https://pypi.org/project/ws-bom-robot-app/)
329
-
330
- ```pwsh
331
- twine upload --verbose dist/*
332
-
333
- ```
1
+ Metadata-Version: 2.4
2
+ Name: ws_bom_robot_app
3
+ Version: 0.0.99
4
+ Summary: A FastAPI application serving ws bom/robot/llm platform ai.
5
+ Home-page: https://github.com/websolutespa/bom
6
+ Author: Websolute Spa
7
+ Author-email: dev@websolute.it
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.12
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: standardwebhooks==1.0.0
14
+ Requires-Dist: apscheduler==3.11.1
15
+ Requires-Dist: aiofiles==25.1.0
16
+ Requires-Dist: pydantic==2.12.4
17
+ Requires-Dist: pydantic-settings==2.12.0
18
+ Requires-Dist: fastapi[standard]==0.121.1
19
+ Requires-Dist: chevron==0.14.0
20
+ Requires-Dist: msoffcrypto-tool==5.4.2
21
+ Requires-Dist: langchain==0.3.27
22
+ Requires-Dist: langchain-community==0.3.30
23
+ Requires-Dist: langchain-core==0.3.76
24
+ Requires-Dist: langchain-openai==0.3.33
25
+ Requires-Dist: langchain-anthropic==0.3.21
26
+ Requires-Dist: langchain-ibm==0.3.18
27
+ Requires-Dist: langchain-google-genai==2.1.12
28
+ Requires-Dist: langchain-google-vertexai==2.1.2
29
+ Requires-Dist: langchain-groq==0.3.8
30
+ Requires-Dist: langchain-ollama==0.3.8
31
+ Requires-Dist: openevals==0.1.2
32
+ Requires-Dist: faiss-cpu==1.12.0
33
+ Requires-Dist: chromadb==1.3.4
34
+ Requires-Dist: langchain-chroma==0.2.6
35
+ Requires-Dist: langchain-qdrant==0.2.1
36
+ Requires-Dist: qdrant-client[fastembed]==1.15.1
37
+ Requires-Dist: lark==1.3.1
38
+ Requires-Dist: unstructured==0.18.18
39
+ Requires-Dist: unstructured[image]
40
+ Requires-Dist: unstructured-ingest==1.2.21
41
+ Requires-Dist: unstructured-ingest[azure]
42
+ Requires-Dist: unstructured-ingest[confluence]
43
+ Requires-Dist: unstructured-ingest[dropbox]
44
+ Requires-Dist: unstructured-ingest[gcs]
45
+ Requires-Dist: unstructured-ingest[github]
46
+ Requires-Dist: unstructured-ingest[google_drive]
47
+ Requires-Dist: unstructured-ingest[jira]
48
+ Requires-Dist: unstructured-ingest[s3]
49
+ Requires-Dist: unstructured-ingest[sftp]
50
+ Requires-Dist: unstructured-ingest[sharepoint]
51
+ Requires-Dist: unstructured-ingest[slack]
52
+ Requires-Dist: html5lib==1.1
53
+ Requires-Dist: markdownify==1.2.0
54
+ Requires-Dist: duckduckgo-search==8.1.1
55
+ Requires-Dist: langchain-google-community==2.0.10
56
+ Requires-Dist: trafilatura==2.0.0
57
+ Dynamic: author
58
+ Dynamic: author-email
59
+ Dynamic: classifier
60
+ Dynamic: description
61
+ Dynamic: description-content-type
62
+ Dynamic: home-page
63
+ Dynamic: license
64
+ Dynamic: requires-dist
65
+ Dynamic: requires-python
66
+ Dynamic: summary
67
+
68
+ # 🤖 ws-bom-robot-app
69
+
70
+ A `FastAPI` application serving ws bom/robot/llm platform ai
71
+
72
+ ## 🌵 Minimal app structure
73
+
74
+ ```env
75
+ app/
76
+ |-- .env
77
+ |-- main.py
78
+ ```
79
+
80
+ Fill `main.py` with the following code:
81
+
82
+ ```python
83
+ from ws_bom_robot_app import main
84
+ app = main.app
85
+ ```
86
+
87
+ Create a `.env` file in the root directory with the following configuration:
88
+
89
+ ```properties
90
+ # robot configuration
91
+ robot_env=development
92
+ robot_user=your_username
93
+ USER_AGENT=ws-bom-robot-app
94
+
95
+ # cms (bowl) configuration
96
+ robot_cms_host='http://localhost:4000'
97
+ robot_cms_auth='users API-Key your-api-key-here'
98
+
99
+ # llm providers: fill one or more of these with your API keys
100
+ DEEPSEEK_API_KEY="your-deepseek-api-key"
101
+ OPENAI_API_KEY="your-openai-api-key"
102
+ GOOGLE_API_KEY="your-google-api-key"
103
+ ANTHROPIC_API_KEY="your-anthropic-api-key"
104
+ GROQ_API_KEY="your-groq-api-key"
105
+ # ibm
106
+ WATSONX_URL="https://eu-gb.ml.cloud.ibm.com"
107
+ WATSONX_APIKEY="your-watsonx-api-key"
108
+ WATSONX_PROJECTID="your-watsonx-project-id"
109
+ # gvertex: ensure to mount the file in docker
110
+ GOOGLE_APPLICATION_CREDENTIALS="./.data/secrets/google-credentials.json"
111
+ ```
112
+
113
+ ## 🚀 Run the app
114
+
115
+ - development
116
+
117
+ ```bash
118
+ fastapi dev --port 6001
119
+ #uvicorn main:app --app-dir ./ws_bom_robot_app --reload --reload-dir ws_bom_robot_app --host 0.0.0.0 --port 6001
120
+ #uvicorn main:app --app-dir ./ws_bom_robot_app --host 0.0.0.0 --port 6001
121
+ ```
122
+
123
+ - production
124
+
125
+ ```bash
126
+ uvicorn main:app --host 0.0.0.0 --port 6001
127
+ ```
128
+
129
+ - production with [multipler workers](https://fastapi.tiangolo.com/deployment/server-workers/#multiple-workers)
130
+
131
+ ```bash
132
+ fastapi run --port 6001 --workers 4
133
+ #uvicorn main:app --host 0.0.0.0 --port 6001 --workers 4
134
+ #gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app --bind
135
+ ```
136
+
137
+ ## 📖 API documentation
138
+
139
+ - [swagger](http://localhost:6001/docs)
140
+ - [redoc](http://localhost:6001/redoc)
141
+
142
+ ---
143
+
144
+ ## 🐳 Docker
145
+
146
+ dockerize base image
147
+
148
+ ```pwsh
149
+ <# cpu #>
150
+ #docker build -f Dockerfile-robot-base-cpu -t ws-bom-robot-base:cpu .
151
+ #docker tag ws-bom-robot-base:cpu ghcr.io/websolutespa/ws-bom-robot-base:cpu
152
+ docker build -f Dockerfile-robot-base-cpu -t ghcr.io/websolutespa/ws-bom-robot-base:cpu .
153
+ docker push ghcr.io/websolutespa/ws-bom-robot-base:cpu
154
+ <# gpu #>
155
+ docker build -f Dockerfile-robot-base-gpu -t ghcr.io/websolutespa/ws-bom-robot-base:gpu .
156
+ docker push ghcr.io/websolutespa/ws-bom-robot-base:gpu
157
+ ```
158
+
159
+ dockerize app (from src)
160
+
161
+ - cpu
162
+ ```pwsh
163
+ docker build -f Dockerfile -t ws-bom-robot-app:cpu --build-arg DEVICE=cpu .
164
+ docker run --rm -d --name ws-bom-robot-app --env-file .env -p 6001:6001 ws-bom-robot-app:cpu
165
+ ```
166
+ - gpu
167
+ ```pwsh
168
+ docker build -f Dockerfile -t ws-bom-robot-app:gpu --build-arg DEVICE=gpu .
169
+ docker run --rm -d --name ws-bom-robot-app --gpus all --env-file .env -p 6001:6001 ws-bom-robot-app:gpu
170
+ ```
171
+
172
+ dockerize app (from latest)
173
+
174
+ - cpu
175
+ ```pwsh
176
+ docker build -f Dockerfile-pkg -t ws-bom-robot-app-pkg:cpu --build-arg DEVICE=cpu .
177
+ docker run --rm -d --name ws-bom-robot-app-pkg --env-file .env -p 6001:6001 ws-bom-robot-app-pkg:cpu
178
+ ```
179
+ - gpu
180
+ ```pwsh
181
+ docker build -f Dockerfile-pkg -t ws-bom-robot-app-pkg:gpu --build-arg DEVICE=gpu .
182
+ docker run --rm -d --name ws-bom-robot-app-pkg --gpus all --env-file .env -p 6001:6001 ws-bom-robot-app-pkg:gpu
183
+ <# test gpu: nvidia-smi #>
184
+ ```
185
+
186
+ docker run mounted to src (dev mode)
187
+
188
+ ```pwsh
189
+ 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
190
+ 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
191
+ ```
192
+
193
+ ---
194
+
195
+ ## 🔖 Windows requirements (for RAG functionality only)
196
+
197
+ > ⚠️ While it's strongly recommended to use a docker container for development, you can run the app on Windows with the following requirements
198
+
199
+ ### libmagic (mandatory)
200
+
201
+ ```bash
202
+ py -m pip install --upgrade python-magic-bin
203
+ ```
204
+
205
+ ### tesseract-ocr (mandatory)
206
+
207
+ [Install tesseract](https://github.com/UB-Mannheim/tesseract/wiki)
208
+ [Last win-64 release](https://github.com/tesseract-ocr/tesseract/releases/download/5.5.0/tesseract-ocr-w64-setup-5.5.0.20241111.exe)
209
+
210
+ Add tesseract executable (C:\Program Files\Tesseract-OCR) to system PATH
211
+
212
+ ```pwsh
213
+ $pathToAdd = "C:\Program Files\Tesseract-OCR"; `
214
+ $currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
215
+ if ($currentPath -split ';' -notcontains $pathToAdd) { `
216
+ [System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
217
+ }
218
+ ```
219
+
220
+ ### docling
221
+
222
+ Set the following environment variables
223
+
224
+ ```pwsh
225
+ KMP_DUPLICATE_LIB_OK=TRUE
226
+ ```
227
+
228
+ ### libreoffice (optional: for robot_env set to development/production)
229
+
230
+ [Install libreoffice](https://www.libreoffice.org/download/download-libreoffice/)
231
+ [Last win-64 release](https://download.documentfoundation.org/libreoffice/stable/24.8.2/win/x86_64/LibreOffice_24.8.2_Win_x86-64.msi)
232
+
233
+ Add libreoffice executable (C:\Program Files\LibreOffice\program) to system PATH
234
+
235
+ ```pwsh
236
+ $pathToAdd = "C:\Program Files\LibreOffice\program"; `
237
+ $currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
238
+ if ($currentPath -split ';' -notcontains $pathToAdd) { `
239
+ [System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
240
+ }
241
+ ```
242
+
243
+ ### poppler (optional: for robot_env set to development/production)
244
+
245
+ [Download win poppler release](https://github.com/oschwartz10612/poppler-windows/releases)
246
+ Extract the zip, copy the nested folder "poppler-x.x.x." to a program folder (e.g. C:\Program Files\poppler-24.08.0)
247
+ Add poppler executable (C:\Program Files\poppler-24.08.0\Library\bin) to system PATH
248
+
249
+ ```pwsh
250
+ $pathToAdd = "C:\Program Files\poppler-24.08.0\Library\bin"; `
251
+ $currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
252
+ if ($currentPath -split ';' -notcontains $pathToAdd) { `
253
+ [System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
254
+ }
255
+ ```
256
+
257
+ ---
258
+
259
+ ## 👷 Contributors
260
+
261
+ Build/distribute pkg from `websolutespa` bom [[Github](https://github.com/websolutespa/bom)]
262
+
263
+ > dir in `robot` project folder
264
+
265
+ ```bash
266
+ cd ./src/robot
267
+ ```
268
+
269
+ ### 🔖 requirements
270
+
271
+ - install uv venv package management
272
+
273
+ ```bash
274
+ py -m pip install --upgrade uv
275
+ # create venv
276
+ uv venv
277
+ # activate venv
278
+ #win: .venv/Scripts/activate
279
+ #linux: source .venv/bin/activate
280
+ ```
281
+
282
+ - project requirements update
283
+
284
+ ```bash
285
+ uv pip install --upgrade -r requirements.txt
286
+ ```
287
+
288
+ - build tools
289
+
290
+ ```bash
291
+ uv pip install --upgrade setuptools build twine streamlit
292
+ ```
293
+
294
+ ### 🪛 build
295
+
296
+ - clean dist and build package
297
+ ```pwsh
298
+ if (Test-Path ./dist) {rm ./dist -r -force}; `
299
+ py -m build && twine check dist/*
300
+ ```
301
+ - linux/mac
302
+ ```bash
303
+ [ -d ./dist ] && rm -rf ./dist
304
+ python -m build && twine check dist/*
305
+ ```
306
+
307
+ ### 📦 test / 🧪 debugger
308
+
309
+ Install the package in editable project location
310
+
311
+ ```pwsh
312
+ uv pip install -U -e .
313
+ uv pip show ws-bom-robot-app
314
+ ```
315
+
316
+ code quality tools
317
+
318
+ ```pwsh
319
+ # .\src\robot
320
+ !py -m uv pip install -U scanreq prospector[with_everything]
321
+ ## unused requirements
322
+ scanreq -r requirements.txt -p ./ws_bom_robot_app
323
+ ## style/linting
324
+ prospector ./ws_bom_robot_app -t pylint -t pydocstyle
325
+ ## code quality/complexity
326
+ prospector ./ws_bom_robot_app -t vulture -t mccabe -t mypy
327
+ ## security
328
+ prospector ./ws_bom_robot_app -t dodgy -t bandit
329
+ ## package
330
+ prospector ./ws_bom_robot_app -t pyroma
331
+ ```
332
+
333
+ #### 🧪 run tests
334
+
335
+ ```pwsh
336
+ !py -m uv pip install -U pytest pytest-asyncio pytest-mock pytest-cov pyclean
337
+ # clean cache if needed
338
+ # pyclean --verbose .
339
+ pytest --cov=ws_bom_robot_app --log-cli-level=info
340
+ # directory
341
+ # pytest --cov=ws_bom_robot_app.llm.vector_store --log-cli-level=info ./tests/app/llm/vector_store
342
+ ```
343
+
344
+ #### 🐞 start debugger
345
+
346
+ ```pwsh
347
+ streamlit run debugger.py --server.port 8051
348
+ ```
349
+
350
+ ### ✈️ publish
351
+
352
+ - [testpypi](https://test.pypi.org/project/ws-bom-robot-app/)
353
+
354
+ ```pwsh
355
+ twine upload --verbose -r testpypi dist/*
356
+ #pip install -i https://test.pypi.org/simple/ -U ws-bom-robot-app
357
+ ```
358
+
359
+ - [pypi](https://pypi.org/project/ws-bom-robot-app/)
360
+
361
+ ```pwsh
362
+ twine upload --verbose dist/*
363
+
364
+ ```