ws-bom-robot-app 0.0.34__py3-none-any.whl → 0.0.35__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.
@@ -25,7 +25,7 @@ class Settings(BaseSettings):
25
25
  robot_debugger_llm_key: str = ''
26
26
  robot_debugger_embedding_key: str = ''
27
27
  OPENAI_API_KEY: str = '' # used for dall-e api
28
- GOOGLE_APPLICATION_CREDENTIALS: str = './.data/credentials/google.json' # path to google credentials iam file
28
+ GOOGLE_APPLICATION_CREDENTIALS: str = './.secrets/google.json' # path to google credentials iam file
29
29
  model_config = ConfigDict(
30
30
  env_file='./.env',
31
31
  extra='ignore',
@@ -0,0 +1,26 @@
1
+ import json, os, logging
2
+ from typing import Union
3
+ class Secrets:
4
+ @staticmethod
5
+ def from_file(path: str) -> dict[str, Union[str, int, list]] | None:
6
+ if os.path.exists(path):
7
+ with open(path, 'r') as file:
8
+ _content = file.read()
9
+ try:
10
+ return json.loads(_content)
11
+ except json.JSONDecodeError:
12
+ logging.error(f"Failed to parse secret file: {path}")
13
+ else:
14
+ logging.error(f"Secret file not found: {path}")
15
+ return None
16
+ @staticmethod
17
+ def from_env(key: str) -> dict[str, Union[str, int, list]] | None:
18
+ _content = os.getenv(key)
19
+ if _content:
20
+ try:
21
+ return json.loads(_content)
22
+ except json.JSONDecodeError:
23
+ logging.error(f"Failed to parse environment variable: {key}")
24
+ else:
25
+ logging.error(f"Environment variable not found: {key}")
26
+ return None
@@ -4,11 +4,22 @@ from abc import ABC, abstractmethod
4
4
  from unstructured_ingest.v2.interfaces import ProcessorConfig
5
5
  from unstructured_ingest.v2.pipeline.pipeline import Pipeline, PartitionerConfig, FiltererConfig
6
6
  from typing import Union
7
+ from ws_bom_robot_app.llm.utils.secrets import Secrets
7
8
 
8
9
  class IntegrationStrategy(ABC):
10
+ @classmethod
11
+ def _parse_data(cls, data: dict[str, Union[str, int, list]]) -> dict[str, Union[str, int, list]]:
12
+ for key, fn in (
13
+ ("__from_env", Secrets.from_env),
14
+ ("__from_file", Secrets.from_file),
15
+ ):
16
+ if key in data:
17
+ if secret := fn(data[key]):
18
+ return secret
19
+ return data
9
20
  def __init__(self, knowledgebase_path: str, data: dict[str, Union[str,int,list]]):
10
21
  self.knowledgebase_path = knowledgebase_path
11
- self.data = data
22
+ self.data = self._parse_data(data)
12
23
  self.working_directory = os.path.join(self.knowledgebase_path,self.working_subdirectory())
13
24
  os.makedirs(self.working_directory, exist_ok=True)
14
25
  @property
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ws_bom_robot_app
3
- Version: 0.0.34
3
+ Version: 0.0.35
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
@@ -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=Y1WjrUYyCX6-pMApEWgWK23TNgSl-J2mLJY1qrG-nRo,3644
3
+ ws_bom_robot_app/config.py,sha256=zjqr_tx8tkxZ94YXrZ-xQFZiM5es3mcQlZG1VEnj0ac,3635
4
4
  ws_bom_robot_app/cron_manager.py,sha256=0Yt5AMTPGlXZ_M5ck0SKMX8wvzoPsseEezg_s0Q3HKY,9224
5
5
  ws_bom_robot_app/main.py,sha256=zO3B-v-v9ESASvw8IaQj9Y9hNvNmOxohFmA0R82EybQ,6518
6
6
  ws_bom_robot_app/task_manager.py,sha256=Zedzs2R3O-wNSQOqs4jorgFwPRi-ji_0TN4mGfk-VvE,15958
@@ -31,12 +31,13 @@ ws_bom_robot_app/llm/utils/chunker.py,sha256=N7570xBYlObneg-fsvDhPAJ-Pv8C8OaYZOB
31
31
  ws_bom_robot_app/llm/utils/download.py,sha256=iAUxH_NiCpTPtGzhC4hBtxotd2HPFt2MBhttslIxqiI,3194
32
32
  ws_bom_robot_app/llm/utils/kb.py,sha256=jja45WCbNI7SGEgqDS99nErlwB5eY8Ga7BMnhdMHZ90,1279
33
33
  ws_bom_robot_app/llm/utils/print.py,sha256=ZonoLPcfM6Cpw4_Ec455LiCovExOwvnIgvw1QORSCBY,799
34
+ ws_bom_robot_app/llm/utils/secrets.py,sha256=-HtqLIDVIJrpvGC5YhPAVyLsq8P4ChVM5g3GOfdwqVk,878
34
35
  ws_bom_robot_app/llm/utils/webhooks.py,sha256=LAAZqyN6VhV13wu4X-X85TwdDgAV2rNvIwQFIIc0FJM,2114
35
36
  ws_bom_robot_app/llm/vector_store/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
37
  ws_bom_robot_app/llm/vector_store/generator.py,sha256=9_xdtCKJhmt1OP0GXDjvFERXMP7ozLZT92KuYEBDgC0,6314
37
38
  ws_bom_robot_app/llm/vector_store/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
39
  ws_bom_robot_app/llm/vector_store/integration/azure.py,sha256=R37TaPQP-HJJJiaKE9rmMc9kpeXeRvdebbTY_982om0,3392
39
- ws_bom_robot_app/llm/vector_store/integration/base.py,sha256=IvIu8RkISuurrVKr2YPG96fsOI2kqhaEGyTGzjB-jCI,1550
40
+ ws_bom_robot_app/llm/vector_store/integration/base.py,sha256=8r6XO_XM8PcDXhsKst6q_Xw-P48rCiEtowmkBEDVd08,1957
40
41
  ws_bom_robot_app/llm/vector_store/integration/confluence.py,sha256=4fiRHB3J-SHZZxNGHwVkCrT-xSPbc91z4WrDE9fy6xU,2505
41
42
  ws_bom_robot_app/llm/vector_store/integration/dropbox.py,sha256=yhGvHTN0TEpUfhdvvV7RX5MxBwTUyddAX95Fgqp3mCg,2629
42
43
  ws_bom_robot_app/llm/vector_store/integration/gcs.py,sha256=fFDVDUR6eNB7FVTzDSEpMHFEWMgG16GLnpSf_mqGDdE,3184
@@ -53,7 +54,7 @@ ws_bom_robot_app/llm/vector_store/loader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
53
54
  ws_bom_robot_app/llm/vector_store/loader/base.py,sha256=L_ugekNuAq0N9O-24wtlHSNHkqSeD-KsJrfGt_FX9Oc,5340
54
55
  ws_bom_robot_app/llm/vector_store/loader/docling.py,sha256=yP0zgXLeFAlByaYuj-6cYariuknckrFds0dxdRcnVz8,3456
55
56
  ws_bom_robot_app/llm/vector_store/loader/json_loader.py,sha256=qo9ejRZyKv_k6jnGgXnu1W5uqsMMtgqK_uvPpZQ0p74,833
56
- ws_bom_robot_app-0.0.34.dist-info/METADATA,sha256=HCUzilY-vetvweKfyzz3ixQdeUC8lP-oOGaE3-re6EE,8270
57
- ws_bom_robot_app-0.0.34.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
58
- ws_bom_robot_app-0.0.34.dist-info/top_level.txt,sha256=Yl0akyHVbynsBX_N7wx3H3ZTkcMLjYyLJs5zBMDAKcM,17
59
- ws_bom_robot_app-0.0.34.dist-info/RECORD,,
57
+ ws_bom_robot_app-0.0.35.dist-info/METADATA,sha256=gwxWX98wtRsmod8DpysLX38QBX_Rl0MHdyCnclliUTs,8270
58
+ ws_bom_robot_app-0.0.35.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
59
+ ws_bom_robot_app-0.0.35.dist-info/top_level.txt,sha256=Yl0akyHVbynsBX_N7wx3H3ZTkcMLjYyLJs5zBMDAKcM,17
60
+ ws_bom_robot_app-0.0.35.dist-info/RECORD,,