ws-bom-robot-app 0.0.79__py3-none-any.whl → 0.0.80__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.
- ws_bom_robot_app/config.py +1 -1
- ws_bom_robot_app/llm/models/api.py +33 -0
- {ws_bom_robot_app-0.0.79.dist-info → ws_bom_robot_app-0.0.80.dist-info}/METADATA +51 -62
- {ws_bom_robot_app-0.0.79.dist-info → ws_bom_robot_app-0.0.80.dist-info}/RECORD +6 -6
- {ws_bom_robot_app-0.0.79.dist-info → ws_bom_robot_app-0.0.80.dist-info}/WHEEL +0 -0
- {ws_bom_robot_app-0.0.79.dist-info → ws_bom_robot_app-0.0.80.dist-info}/top_level.txt +0 -0
ws_bom_robot_app/config.py
CHANGED
|
@@ -32,7 +32,7 @@ class Settings(BaseSettings):
|
|
|
32
32
|
WATSONX_URL: str = ''
|
|
33
33
|
WATSONX_APIKEY: str = ''
|
|
34
34
|
WATSONX_PROJECTID: str = ''
|
|
35
|
-
NEBULY_API_URL: str =''
|
|
35
|
+
NEBULY_API_URL: str ='https://backend.nebuly.com/'
|
|
36
36
|
GOOGLE_APPLICATION_CREDENTIALS: str = '' # path to google credentials iam file, e.d. ./.secrets/google-credentials.json
|
|
37
37
|
model_config = ConfigDict(
|
|
38
38
|
env_file='./.env',
|
|
@@ -11,6 +11,39 @@ import os, shutil, uuid
|
|
|
11
11
|
from ws_bom_robot_app.config import Settings, config
|
|
12
12
|
|
|
13
13
|
class LlmMessage(BaseModel):
|
|
14
|
+
"""
|
|
15
|
+
💬 multimodal chat
|
|
16
|
+
|
|
17
|
+
The multimodal message allows users to interact with the application using both text and media files.
|
|
18
|
+
`robot` accept multimodal input in a uniform way, regarding the llm provider used.
|
|
19
|
+
|
|
20
|
+
- simple message
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"role": "user",
|
|
25
|
+
"content": "What is the capital of France?"
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- multimodal message
|
|
30
|
+
|
|
31
|
+
```jsonc
|
|
32
|
+
{
|
|
33
|
+
"role": "user",
|
|
34
|
+
"content": [
|
|
35
|
+
{ "type": "text", "text": "Read carefully all the attachments, analize the content and provide a summary for each one:" },
|
|
36
|
+
{ "type": "image", "url": "https://www.example.com/image/foo.jpg" },
|
|
37
|
+
{ "type": "file", "url": "https://www.example.com/pdf/bar.pdf" },
|
|
38
|
+
{ "type": "file", "url": "data:plain/text;base64,CiAgICAgIF9fX19fCiAgICAgLyAgIC..." }, // base64 encoded file
|
|
39
|
+
{ "type": "media", "mime_type": "plain/text", "data": "CiAgICAgIF9fX19fCiAgICAgLyAgIC..." } // google/gemini specific input format
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> 💡 `url` can be a remote url or a base64 representation of the file: [rfc 2397](https://datatracker.ietf.org/doc/html/rfc2397).
|
|
45
|
+
Can also be used the llm/model specific input format.
|
|
46
|
+
"""
|
|
14
47
|
role: str
|
|
15
48
|
content: Union[str, list]
|
|
16
49
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ws_bom_robot_app
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.80
|
|
4
4
|
Summary: A FastAPI application serving ws bom/robot/llm platform ai.
|
|
5
5
|
Home-page: https://github.com/websolutespa/bom
|
|
6
6
|
Author: Websolute Spa
|
|
@@ -83,18 +83,30 @@ from ws_bom_robot_app import main
|
|
|
83
83
|
app = main.app
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
#
|
|
90
|
-
robot_env=
|
|
91
|
-
robot_user=
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
robot_cms_host='
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
Create a `.env` file in the root directory with the following configuration:
|
|
87
|
+
|
|
88
|
+
```properties
|
|
89
|
+
# robot configuration
|
|
90
|
+
robot_env=development
|
|
91
|
+
robot_user=your_username
|
|
92
|
+
USER_AGENT=ws-bom-robot-app
|
|
93
|
+
|
|
94
|
+
# cms (bowl) configuration
|
|
95
|
+
robot_cms_host='http://localhost:4000'
|
|
96
|
+
robot_cms_auth='users API-Key your-api-key-here'
|
|
97
|
+
|
|
98
|
+
# llm providers: fill one or more of these with your API keys
|
|
99
|
+
DEEPSEEK_API_KEY="your-deepseek-api-key"
|
|
100
|
+
OPENAI_API_KEY="your-openai-api-key"
|
|
101
|
+
GOOGLE_API_KEY="your-google-api-key"
|
|
102
|
+
ANTHROPIC_API_KEY="your-anthropic-api-key"
|
|
103
|
+
GROQ_API_KEY="your-groq-api-key"
|
|
104
|
+
# ibm
|
|
105
|
+
WATSONX_URL="https://eu-gb.ml.cloud.ibm.com"
|
|
106
|
+
WATSONX_APIKEY="your-watsonx-api-key"
|
|
107
|
+
WATSONX_PROJECTID="your-watsonx-project-id"
|
|
108
|
+
# gvertex: ensure to mount the file in docker
|
|
109
|
+
GOOGLE_APPLICATION_CREDENTIALS="./.data/secrets/google-credentials.json"
|
|
98
110
|
```
|
|
99
111
|
|
|
100
112
|
## 🚀 Run the app
|
|
@@ -125,38 +137,39 @@ robot_cms_files_folder=llmKbFile
|
|
|
125
137
|
- [swagger](http://localhost:6001/docs)
|
|
126
138
|
- [redoc](http://localhost:6001/redoc)
|
|
127
139
|
|
|
128
|
-
|
|
140
|
+
---
|
|
129
141
|
|
|
130
|
-
|
|
131
|
-
`robot` accept multimodal input in a uniform way, regarding the llm provider used. Can also be used the llm/model specific input format.
|
|
142
|
+
## 🐳 Docker
|
|
132
143
|
|
|
133
|
-
|
|
144
|
+
dockerize base image
|
|
134
145
|
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
```pwsh
|
|
147
|
+
<# cpu #>
|
|
148
|
+
docker build -f Dockerfile-robot-base-cpu -t ghcr.io/websolutespa/ws-bom-robot-base:cpu .
|
|
149
|
+
docker push ghcr.io/websolutespa/ws-bom-robot-base:cpu
|
|
150
|
+
<# gpu #>
|
|
151
|
+
docker build -f Dockerfile-robot-base-gpu -t ghcr.io/websolutespa/ws-bom-robot-base:gpu .
|
|
152
|
+
docker push ghcr.io/websolutespa/ws-bom-robot-base:gpu
|
|
140
153
|
```
|
|
141
154
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
+
dockerize app
|
|
156
|
+
|
|
157
|
+
```pwsh
|
|
158
|
+
docker build -f Dockerfile -t ws-bom-robot-app .
|
|
159
|
+
docker run --rm --name ws-bom-robot-app -d --env-file .env -p 6001:6001 ws-bom-robot-app
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
docker run mounted to src (dev mode)
|
|
163
|
+
|
|
164
|
+
```pwsh
|
|
165
|
+
docker run --rm --name ws-bom-robot-app-src -d --env-file .env -v "$(pwd)/ws_bom_robot_app:/app/ws_bom_robot_app" -v "$(pwd)/.data:/app/.data" -v "$(pwd)/tmp:/tmp" -p 6001:6001 ws-bom-robot-app fastapi dev ./ws_bom_robot_app/main.py --host 0.0.0.0 --port 6001
|
|
155
166
|
```
|
|
156
167
|
|
|
157
168
|
---
|
|
158
169
|
|
|
159
|
-
## 🔖 Windows requirements
|
|
170
|
+
## 🔖 Windows requirements (for RAG functionality only)
|
|
171
|
+
|
|
172
|
+
> ⚠️ While it's strongly recommended to use a docker container for development, you can run the app on Windows with the following requirements
|
|
160
173
|
|
|
161
174
|
### libmagic (mandatory)
|
|
162
175
|
|
|
@@ -267,7 +280,7 @@ prospector ./ws_bom_robot_app -t dodgy -t bandit
|
|
|
267
280
|
prospector ./ws_bom_robot_app -t pyroma
|
|
268
281
|
```
|
|
269
282
|
|
|
270
|
-
|
|
283
|
+
#### 🧪 run tests
|
|
271
284
|
|
|
272
285
|
```pwsh
|
|
273
286
|
!py -m pip install -U pytest pytest-asyncio pytest-mock pytest-cov pyclean
|
|
@@ -278,36 +291,12 @@ pytest --cov=ws_bom_robot_app --log-cli-level=info
|
|
|
278
291
|
# pytest --cov=ws_bom_robot_app --log-cli-level=info ./tests/app/llm/vector_store/db
|
|
279
292
|
```
|
|
280
293
|
|
|
281
|
-
|
|
294
|
+
#### 🐞 start debugger
|
|
282
295
|
|
|
283
296
|
```pwsh
|
|
284
297
|
streamlit run debugger.py --server.port 8051
|
|
285
298
|
```
|
|
286
299
|
|
|
287
|
-
dockerize base image
|
|
288
|
-
|
|
289
|
-
```pwsh
|
|
290
|
-
<# cpu #>
|
|
291
|
-
docker build -f Dockerfile-robot-base-cpu -t ghcr.io/websolutespa/ws-bom-robot-base:cpu .
|
|
292
|
-
docker push ghcr.io/websolutespa/ws-bom-robot-base:cpu
|
|
293
|
-
<# gpu #>
|
|
294
|
-
docker build -f Dockerfile-robot-base-gpu -t ghcr.io/websolutespa/ws-bom-robot-base:gpu .
|
|
295
|
-
docker push ghcr.io/websolutespa/ws-bom-robot-base:gpu
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
dockerize app
|
|
299
|
-
|
|
300
|
-
```pwsh
|
|
301
|
-
docker build -f Dockerfile -t ws-bom-robot-app .
|
|
302
|
-
docker run --rm --name ws-bom-robot-app -d -p 6001:6001 ws-bom-robot-app
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
docker run mounted to src
|
|
306
|
-
|
|
307
|
-
```pwsh
|
|
308
|
-
docker run --rm --name ws-bom-robot-app-src -d -v "$(pwd)/ws_bom_robot_app:/app/ws_bom_robot_app" -v "$(pwd)/.data:/app/.data" -v "$(pwd)/tmp:/tmp" -p 6001:6001 ws-bom-robot-app
|
|
309
|
-
```
|
|
310
|
-
|
|
311
300
|
### ✈️ publish
|
|
312
301
|
|
|
313
302
|
- [testpypi](https://test.pypi.org/project/ws-bom-robot-app/)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
ws_bom_robot_app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
ws_bom_robot_app/auth.py,sha256=84nIbmJsMrNs0sxIQGEHbjsjc2P6ZrZZGSn8dkiL6is,895
|
|
3
|
-
ws_bom_robot_app/config.py,sha256=
|
|
3
|
+
ws_bom_robot_app/config.py,sha256=58dIVRSd-2jpkCfSYmyI5E7zld3GpBr9m3TGh1nxhgU,4624
|
|
4
4
|
ws_bom_robot_app/cron_manager.py,sha256=jk79843WEU-x-rc78O_0KpzWY4AZDBuFRXRwaczXTq8,9370
|
|
5
5
|
ws_bom_robot_app/main.py,sha256=LZH4z9BmVlxpFJf8TrIo_JxH1YhpeZRrrOYgKky7S7w,6712
|
|
6
6
|
ws_bom_robot_app/task_manager.py,sha256=Q3Il2TtkP0FoG9zHEBu48pZGXzimTtvWQsoH6wdvQs0,16077
|
|
@@ -17,7 +17,7 @@ ws_bom_robot_app/llm/nebuly_handler.py,sha256=Z4_GS-N4vQYPLnlXlwhJrwpUvf2uG53diY
|
|
|
17
17
|
ws_bom_robot_app/llm/feedbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
ws_bom_robot_app/llm/feedbacks/feedback_manager.py,sha256=WcKgzlOb8VFG7yqHoIOO_R6LAzdzE4YIRFCVOGBSgfM,2856
|
|
19
19
|
ws_bom_robot_app/llm/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
ws_bom_robot_app/llm/models/api.py,sha256=
|
|
20
|
+
ws_bom_robot_app/llm/models/api.py,sha256=3fnl9uZDk7SUR53vnoM-YsRdNy2-8M3m2vkQ_LwXiHs,12194
|
|
21
21
|
ws_bom_robot_app/llm/models/base.py,sha256=1TqxuTK3rjJEALn7lvgoen_1ba3R2brAgGx6EDTtDZo,152
|
|
22
22
|
ws_bom_robot_app/llm/models/feedback.py,sha256=zh1jLqPRLzNlxInkCMoiJbfSu0-tiOEYHM7FhC46PkM,1692
|
|
23
23
|
ws_bom_robot_app/llm/models/kb.py,sha256=oVSw6_dmNxikAHrPqcfxDXz9M0ezLIYuxpgvzfs_Now,9514
|
|
@@ -66,7 +66,7 @@ ws_bom_robot_app/llm/vector_store/loader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
|
|
|
66
66
|
ws_bom_robot_app/llm/vector_store/loader/base.py,sha256=L_ugekNuAq0N9O-24wtlHSNHkqSeD-KsJrfGt_FX9Oc,5340
|
|
67
67
|
ws_bom_robot_app/llm/vector_store/loader/docling.py,sha256=yP0zgXLeFAlByaYuj-6cYariuknckrFds0dxdRcnVz8,3456
|
|
68
68
|
ws_bom_robot_app/llm/vector_store/loader/json_loader.py,sha256=qo9ejRZyKv_k6jnGgXnu1W5uqsMMtgqK_uvPpZQ0p74,833
|
|
69
|
-
ws_bom_robot_app-0.0.
|
|
70
|
-
ws_bom_robot_app-0.0.
|
|
71
|
-
ws_bom_robot_app-0.0.
|
|
72
|
-
ws_bom_robot_app-0.0.
|
|
69
|
+
ws_bom_robot_app-0.0.80.dist-info/METADATA,sha256=nRY0FtH8gCw1Jr7rRS-r_WVqJnmsz1y7_HXTOxEizyk,9499
|
|
70
|
+
ws_bom_robot_app-0.0.80.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
71
|
+
ws_bom_robot_app-0.0.80.dist-info/top_level.txt,sha256=Yl0akyHVbynsBX_N7wx3H3ZTkcMLjYyLJs5zBMDAKcM,17
|
|
72
|
+
ws_bom_robot_app-0.0.80.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|