admin-api-lib 3.2.0__py3-none-any.whl → 3.3.0__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.
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.3
2
+ Name: admin-api-lib
3
+ Version: 3.3.0
4
+ Summary: The admin backend is responsible for the document management. This includes deletion, upload and returning the source document.
5
+ License: Apache-2.0
6
+ Author: STACKIT GmbH & Co. KG
7
+ Author-email: data-ai@stackit.cloud
8
+ Maintainer: Andreas Klos
9
+ Maintainer-email: andreas.klos@stackit.cloud
10
+ Requires-Python: >=3.13,<4.0
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Dist: boto3 (>=1.38.10,<2.0.0)
15
+ Requires-Dist: dependency-injector (>=4.46.0,<5.0.0)
16
+ Requires-Dist: fastapi (>=0.118.0,<0.119.0)
17
+ Requires-Dist: langchain-experimental (>=0.3.4,<0.4.0)
18
+ Requires-Dist: langfuse (==3.6.1)
19
+ Requires-Dist: nltk (>=3.9.2,<4.0.0)
20
+ Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
21
+ Requires-Dist: python-multipart (>=0.0.20,<0.0.21)
22
+ Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
23
+ Requires-Dist: rag-core-lib (>=3.3.0,<4.0.0)
24
+ Requires-Dist: redis (>=6.0.0,<7.0.0)
25
+ Requires-Dist: starlette (>=0.47.2,<0.49.0)
26
+ Requires-Dist: tenacity (==9.1.2)
27
+ Requires-Dist: tqdm (>=4.67.1,<5.0.0)
28
+ Requires-Dist: uvicorn (>=0.37.0,<0.38.0)
29
+ Project-URL: Homepage, https://pypi.org/project/admin-api-lib
30
+ Project-URL: Repository, https://github.com/stackitcloud/rag-template
31
+ Description-Content-Type: text/markdown
32
+
33
+ # admin-api-lib
34
+
35
+ Document lifecycle orchestration for the STACKIT RAG template. This library exposes a FastAPI-compatible admin surface that receives raw user content, coordinates extraction, summarisation, chunking, and storage, and finally hands normalized information pieces to the core RAG API.
36
+
37
+ It powers the [`services/admin-backend`](https://github.com/stackitcloud/rag-template/tree/main/services/admin-backend) deployment and is the primary integration point for operators managing their document corpus.
38
+
39
+ ## Responsibilities
40
+
41
+ 1. **Ingestion** – Accept files or external sources from the admin UI or API clients.
42
+ 2. **Extraction** – Call `extractor-api-lib` to obtain normalized information pieces.
43
+ 3. **Enhancement** – Summarize and enrich content using LLMs and tracing hooks from `rag-core-lib`.
44
+ 4. **Chunking** – Split content via recursive or semantic strategies before vectorization.
45
+ 5. **Persistence** – Store raw assets in S3-compatible storage and push processed chunks to `rag-core-api`.
46
+ 6. **Status tracking** – Keep track of upload progress and expose document status endpoints backed by KeyDB/Redis.
47
+
48
+ ## Feature highlights
49
+
50
+ - Ready-to-wire dependency-injector container with sensible defaults for S3 storage, KeyDB status tracking, and background tasks.
51
+ - Pluggable chunkers (`recursive` vs `semantic`) and summariser implementations with shared retry/backoff controls.
52
+ - Rich Pydantic request/response models covering uploads, non-file sources, and document status queries.
53
+ - Thin endpoint implementations that can be swapped or extended while keeping the public API stable.
54
+ - Structured tracing (Langfuse) and logging that mirror the behaviour of the chat backend.
55
+
56
+ ## Installation
57
+
58
+ ```bash
59
+ pip install admin-api-lib
60
+ ```
61
+
62
+ Requires Python 3.13 and `rag-core-lib`.
63
+
64
+ ## Module tour
65
+
66
+ - `dependency_container.py` – Configures and wires dependency-injection providers. Override registrations here to customise behaviour.
67
+ - `api_endpoints/` & `impl/api_endpoints/` – Endpoints + abstractions for file uploads, source uploads, deletions, document status, and reference retrieval.
68
+ - `apis/` – Admin API abstractions and implementations.
69
+ - `chunker/` & `impl/chunker/` – Abstractions + default text/semantic chunkers and chunker type selection class.
70
+ - `extractor_api_client/` & `rag_backend_client/` – Generated OpenAPI clients to talk to the extractor and rag core API services.
71
+ - `file_services/` & `impl/file_services/` – Abstract and default S3 interface.
72
+ - `summarizer/` & `impl/summarizer/` – Interfaces and LangChain-based summariser that leverage shared retry logic.
73
+ - `information_enhancer/` & `impl/information_enhancer/` – Abstractions + page and summary enhancer. Enhancers are centralized with general enhancer.
74
+ - `impl/key_db/` – KeyDB/Redis client implementation for document status tracking.
75
+ - `impl/mapper/` – Mapper between extractor documents and langchain documents.
76
+ - `impl/settings/` – Configuration settings for dependency injection container components.
77
+ - `prompt_templates/` – Default summarisation prompt shipped with the template.
78
+ - `utils/` – Utility functions and classes.
79
+
80
+ ## Endpoints provided
81
+
82
+ - `POST /upload_file` – Uploads user selected files
83
+ - `POST /upload_source` - Uploads user selected sources
84
+ - `DELETE /documents/{identification}` – Deletes a document from the system.
85
+ - `GET /document_reference/{identification}` – Retrieves a document reference.
86
+ - `GET /all_documents_status` – Retrieves the status of all documents.
87
+
88
+ Refer to [`libs/README.md`](../README.md#2-admin-api-lib) for in-depth API documentation.
89
+
90
+ ## Configuration overview
91
+
92
+ All settings are powered by `pydantic-settings`, so you can use environment variables or instantiate classes manually:
93
+
94
+ - `S3_*` (`S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY`, `S3_ENDPOINT`, `S3_BUCKET`) – configure storage for raw uploads.
95
+ - `DOCUMENT_EXTRACTOR_HOST` – base URL of the extractor service.
96
+ - `RAG_API_HOST` – base URL of the rag-core API.
97
+ - `CHUNKER_CLASS_TYPE_CHUNKER_TYPE` – choose `recursive` (default) or `semantic` chunking.
98
+ - `CHUNKER_*` (`CHUNKER_MAX_SIZE`, `CHUNKER_OVERLAP`, `CHUNKER_BREAKPOINT_THRESHOLD_TYPE`, …) – fine-tune chunking behaviour.
99
+ - `SUMMARIZER_MAXIMUM_INPUT_SIZE`, `SUMMARIZER_MAXIMUM_CONCURRENCY`, `SUMMARIZER_MAX_RETRIES`, etc. – tune summariser limits and retry behaviour.
100
+ - `SOURCE_UPLOADER_TIMEOUT` – adjust how long non-file source ingestions wait before timing out.
101
+ - `USECASE_KEYVALUE_HOST` / `USECASE_KEYVALUE_PORT` – configure the KeyDB/Redis instance that persists document status.
102
+
103
+ The Helm chart forwards these values through `adminBackend.envs.*`, keeping deployments declarative. Local development can rely on `.env` as described in the repository root README.
104
+
105
+ ## Typical usage
106
+
107
+ ```python
108
+ from admin_api_lib.main import app as perfect_admin_app
109
+ ```
110
+
111
+ The admin frontend (`services/frontend` → Admin app) and automation scripts talk to these endpoints to manage the corpus. Downstream, `rag-core-api` receives the processed information pieces and stores them in the vector database.
112
+
113
+ ## Extending the library
114
+
115
+ 1. Implement a new interface (e.g., `Chunker`, `Summarizer`, `FileService`).
116
+ 2. Register it in `dependency_container.py` or override via dependency-injector in your service.
117
+ 3. Update or add API endpoints if you expose new capabilities.
118
+ 4. Cover the new behaviour with pytest-based unit tests under `libs/admin-api-lib/tests`.
119
+
120
+ Because components depend on interfaces defined here, downstream services can swap behavior without modifying the public API surface.
121
+
122
+ ## Contributing
123
+
124
+ Ensure new endpoints or adapters remain thin and defer to [`rag-core-lib`](../rag-core-lib/) for shared logic. Run `poetry run pytest` and the configured linters before opening a PR. For further instructions see the [Contributing Guide](https://github.com/stackitcloud/rag-template/blob/main/CONTRIBUTING.md).
125
+
126
+ ## License
127
+
128
+ Licensed under the project license. See the root [`LICENSE`](https://github.com/stackitcloud/rag-template/blob/main/LICENSE) file.
129
+
@@ -101,6 +101,6 @@ admin_api_lib/summarizer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
101
101
  admin_api_lib/summarizer/summarizer.py,sha256=D0rkW0iZSys-68LcO1-PIkE0Faf2Grg-_9wu75Rc1OY,966
102
102
  admin_api_lib/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
103
103
  admin_api_lib/utils/utils.py,sha256=eaNQ_NzUEp4hwhCU9EEsUXvbRH_ekVariF7tTsO9Sco,834
104
- admin_api_lib-3.2.0.dist-info/METADATA,sha256=6lj_15ckxlPhHWzUZOqYtJQqOyzVWhoK82sjRJHeCBE,1049
105
- admin_api_lib-3.2.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
106
- admin_api_lib-3.2.0.dist-info/RECORD,,
104
+ admin_api_lib-3.3.0.dist-info/METADATA,sha256=PuhPx4uTP5vKqivM5zJ6UBVZcu32agtHh0pHaWIjh6U,7422
105
+ admin_api_lib-3.3.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
106
+ admin_api_lib-3.3.0.dist-info/RECORD,,
@@ -1,24 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: admin-api-lib
3
- Version: 3.2.0
4
- Summary: The admin backend is responsible for the document management. This includes deletion, upload and returning the source document.
5
- Author: STACKIT Data and AI Consulting
6
- Author-email: data-ai-consulting@stackit.cloud
7
- Requires-Python: >=3.13,<4.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.13
10
- Requires-Dist: boto3 (>=1.38.10,<2.0.0)
11
- Requires-Dist: dependency-injector (>=4.46.0,<5.0.0)
12
- Requires-Dist: fastapi (>=0.118.0,<0.119.0)
13
- Requires-Dist: langchain-experimental (>=0.3.4,<0.4.0)
14
- Requires-Dist: langfuse (==3.6.1)
15
- Requires-Dist: nltk (>=3.9.2,<4.0.0)
16
- Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
17
- Requires-Dist: python-multipart (>=0.0.20,<0.0.21)
18
- Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
19
- Requires-Dist: rag-core-lib (==3.2.0)
20
- Requires-Dist: redis (>=6.0.0,<7.0.0)
21
- Requires-Dist: starlette (>=0.47.2,<0.49.0)
22
- Requires-Dist: tenacity (==9.1.2)
23
- Requires-Dist: tqdm (>=4.67.1,<5.0.0)
24
- Requires-Dist: uvicorn (>=0.37.0,<0.38.0)