ws-bom-robot-app 0.0.87__py3-none-any.whl → 0.0.88__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.
@@ -1,9 +1,10 @@
1
1
  import asyncio
2
2
  from ws_bom_robot_app.llm.vector_store.integration.base import IntegrationStrategy, UnstructuredIngest
3
- from unstructured_ingest.processes.connectors.confluence import ConfluenceIndexerConfig, ConfluenceDownloaderConfig, ConfluenceConnectionConfig, ConfluenceAccessConfig
3
+ from unstructured_ingest.processes.connectors.confluence import ConfluenceIndexerConfig, ConfluenceIndexer, ConfluenceDownloaderConfig, ConfluenceConnectionConfig, ConfluenceAccessConfig
4
+ from unstructured_ingest.pipeline.pipeline import Pipeline
4
5
  from langchain_core.documents import Document
5
6
  from ws_bom_robot_app.llm.vector_store.loader.base import Loader
6
- from typing import Optional, Union
7
+ from typing import List, Optional, Union
7
8
  from pydantic import BaseModel, Field, AliasChoices
8
9
 
9
10
  class ConfluenceParams(BaseModel):
@@ -16,6 +17,7 @@ class ConfluenceParams(BaseModel):
16
17
  password: Confluence password or Cloud API token, if filled, set the access_token to None and vice versa.
17
18
  access_token (str): The personal access token for authenticating with Confluence, e.g., 'AT....'
18
19
  spaces (list[str]): A list of Confluence spaces to interact with, e.g., ['SPACE1', 'SPACE2'].
20
+ max_num_of_docs_from_each_space (int): The maximum number of documents to fetch from each space. Defaults to 500, with a maximum limit of 5000.
19
21
  extension (list[str], optional): A list of file extensions to filter by. Defaults to None, e.g., ['.pdf', '.docx'].
20
22
  """
21
23
  url: str
@@ -23,6 +25,7 @@ class ConfluenceParams(BaseModel):
23
25
  password: Optional[str] = None
24
26
  access_token: Optional[str] = Field(None, validation_alias=AliasChoices("accessToken","access_token"))
25
27
  spaces: list[str] = []
28
+ max_num_of_docs_from_each_space: int = Field(default=500, ge=1, le=5000,validation_alias=AliasChoices("maxNumOfDocsFromEachSpace","max_num_of_docs_from_each_space"))
26
29
  extension: list[str] = Field(default=None)
27
30
  class Confluence(IntegrationStrategy):
28
31
  def __init__(self, knowledgebase_path: str, data: dict[str, Union[str,int,list]]):
@@ -33,7 +36,8 @@ class Confluence(IntegrationStrategy):
33
36
  return 'confluence'
34
37
  def run(self) -> None:
35
38
  indexer_config = ConfluenceIndexerConfig(
36
- spaces=self.__data.spaces
39
+ spaces=self.__data.spaces,
40
+ max_num_of_docs_from_each_space=self.__data.max_num_of_docs_from_each_space
37
41
  )
38
42
  downloader_config = ConfluenceDownloaderConfig(
39
43
  download_dir=self.working_directory
@@ -43,13 +47,37 @@ class Confluence(IntegrationStrategy):
43
47
  url=self.__data.url,
44
48
  username=self.__data.username
45
49
  )
46
- self.__unstructured_ingest.pipeline(
50
+ pipeline: Pipeline = self.__unstructured_ingest.pipeline(
47
51
  indexer_config,
48
52
  downloader_config,
49
53
  connection_config,
50
- extension=self.__data.extension).run()
54
+ extension=self.__data.extension
55
+ )
56
+ pipeline.indexer_step.process = CustomConfluenceIndexer(**vars(pipeline.indexer_step.process))
57
+ pipeline.run()
51
58
  async def load(self) -> list[Document]:
52
59
  await asyncio.to_thread(self.run)
53
60
  await asyncio.sleep(1)
54
61
  return await Loader(self.working_directory).load()
55
62
 
63
+ class CustomConfluenceIndexer(ConfluenceIndexer):
64
+ def __init__(self, **kwargs):
65
+ for key, value in kwargs.items():
66
+ try:
67
+ setattr(super(), key, value)
68
+ except AttributeError:
69
+ setattr(self, key, value)
70
+ def _get_docs_ids_within_one_space(self, space_key: str) -> List[dict]:
71
+ with self.connection_config.get_client() as client:
72
+ pages = client.get_all_pages_from_space(
73
+ space=space_key,
74
+ start=0,
75
+ limit=self.index_config.max_num_of_docs_from_each_space, #explicitly limit the number of pages fetched (omitted in unstructured-ingest)
76
+ expand=None,
77
+ content_type="page", # blogpost and comment types not currently supported
78
+ status=None,
79
+ )
80
+ limited_pages = pages[: self.index_config.max_num_of_docs_from_each_space]
81
+ doc_ids = [{"space_id": space_key, "doc_id": page["id"]} for page in limited_pages]
82
+ return doc_ids
83
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ws_bom_robot_app
3
- Version: 0.0.87
3
+ Version: 0.0.88
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
@@ -51,7 +51,7 @@ ws_bom_robot_app/llm/vector_store/db/qdrant.py,sha256=HfEtFqMF0wIn5SNbst6glw7gG4
51
51
  ws_bom_robot_app/llm/vector_store/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
52
  ws_bom_robot_app/llm/vector_store/integration/azure.py,sha256=OEa96Dlf1CX0tjrTjX4KP3D_HTn249ukc9sluPbdOyU,3389
53
53
  ws_bom_robot_app/llm/vector_store/integration/base.py,sha256=4zI1TtacyVw0jcY0wFv_4y93iX2cgFGn6rAGXd-nSxk,4331
54
- ws_bom_robot_app/llm/vector_store/integration/confluence.py,sha256=UwnDR-TG1jq1Z4bQomY7XnUpPNjWKtuR8ZfTQ7xsajs,2722
54
+ ws_bom_robot_app/llm/vector_store/integration/confluence.py,sha256=TMmGe53tHRTgHJ7nA8DqZVodo3aMEzHrrSdl0-I0-S0,4350
55
55
  ws_bom_robot_app/llm/vector_store/integration/dropbox.py,sha256=vDEVTq7xkXNvpirMkJHm90WzxcSQqCXNc8PBwzLvSH4,2626
56
56
  ws_bom_robot_app/llm/vector_store/integration/gcs.py,sha256=P-NKwNag6fkY3bzFvVkAK5Ayl5CKM8T0MvkaFFwSyT0,3181
57
57
  ws_bom_robot_app/llm/vector_store/integration/github.py,sha256=1J4Ph3s58ngEIH5HyCMeeD6lVo2GzdU8y41BvPSLZcc,2441
@@ -69,7 +69,7 @@ ws_bom_robot_app/llm/vector_store/loader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
69
69
  ws_bom_robot_app/llm/vector_store/loader/base.py,sha256=GjUS2oaz0LHOSal5pipBkomZtrYUNcKPSd8bzhUU5Dc,6889
70
70
  ws_bom_robot_app/llm/vector_store/loader/docling.py,sha256=IOv1A0HSIWiHWQFzI4fdApfxrKgXOqwmC3mPXlKplqQ,4012
71
71
  ws_bom_robot_app/llm/vector_store/loader/json_loader.py,sha256=LDppW0ZATo4_1hh-KlsAM3TLawBvwBxva_a7k5Oz1sc,858
72
- ws_bom_robot_app-0.0.87.dist-info/METADATA,sha256=3pNNKhvD9yn8STxW00dHyEGUgedYB_bSKzK7ioNkmZ0,9985
73
- ws_bom_robot_app-0.0.87.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
74
- ws_bom_robot_app-0.0.87.dist-info/top_level.txt,sha256=Yl0akyHVbynsBX_N7wx3H3ZTkcMLjYyLJs5zBMDAKcM,17
75
- ws_bom_robot_app-0.0.87.dist-info/RECORD,,
72
+ ws_bom_robot_app-0.0.88.dist-info/METADATA,sha256=31SMpndBYfgv0PylO85JpVzD13y9bqTDgXD-1_aHAug,9985
73
+ ws_bom_robot_app-0.0.88.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
74
+ ws_bom_robot_app-0.0.88.dist-info/top_level.txt,sha256=Yl0akyHVbynsBX_N7wx3H3ZTkcMLjYyLJs5zBMDAKcM,17
75
+ ws_bom_robot_app-0.0.88.dist-info/RECORD,,