TriCacheLLM-MMA 0.1.5__tar.gz → 0.1.6__tar.gz

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 (23) hide show
  1. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/PKG-INFO +7 -19
  2. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/README.md +7 -19
  3. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA/portable_cache_bgWorkers/portable_cache_celery_conf.py +1 -1
  4. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA/portable_cache_bgWorkers/portable_cache_workers.py +0 -2
  5. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA/portable_cache_main.py +1 -1
  6. tricachellm_mma-0.1.6/TriCacheLLM_MMA/portable_cache_utils/portable_cache_embedding_model.py +31 -0
  7. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA.egg-info/PKG-INFO +7 -19
  8. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/pyproject.toml +1 -1
  9. tricachellm_mma-0.1.5/TriCacheLLM_MMA/portable_cache_utils/portable_cache_embedding_model.py +0 -8
  10. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/LICENSE +0 -0
  11. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA/__init__.py +0 -0
  12. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA/portable_cache_Ai/portable_cache_rerankAi.py +0 -0
  13. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA/portable_cache_dbSchema.py +0 -0
  14. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA/portable_cache_redis.py +0 -0
  15. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA/portable_cache_schemas/portable_cache_dbBase.py +0 -0
  16. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA/portable_cache_schemas/portable_cache_dbConf.py +0 -0
  17. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA/portable_cache_schemas/portable_cache_schemas.py +0 -0
  18. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA/portable_cache_utils/protable_cache_DynamicEnv_maker.py +0 -0
  19. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA.egg-info/SOURCES.txt +0 -0
  20. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA.egg-info/dependency_links.txt +0 -0
  21. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA.egg-info/requires.txt +0 -0
  22. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/TriCacheLLM_MMA.egg-info/top_level.txt +0 -0
  23. {tricachellm_mma-0.1.5 → tricachellm_mma-0.1.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TriCacheLLM_MMA
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: A robust three-tier LLM-aware caching SDK using Redis, ChromaDB, and automatic SQLite bootstrap.
5
5
  Author-email: Mohib Ashfaq Butt <inboxmohib@gmail.com>
6
6
  License-Expression: LGPL-3.0-only
@@ -76,7 +76,6 @@ The internal infrastructure handles the multi-tier lookup and promotion logic.
76
76
 
77
77
  > **💡 Note for PyPI Visitors:** If you are reading this on PyPI, please check out the [TriCacheLLM_MMA GitHub Repository](https://github.com/mohib-ash/TriCacheLLM_MMA) for the most up-to-date documentation, integration guides, and advanced examples!
78
78
 
79
-
80
79
  ---
81
80
 
82
81
  # Architecture
@@ -172,7 +171,7 @@ Tier 2 is intentionally optimized for fast semantic cache retrieval.
172
171
 
173
172
  Tier 3 is the persistent cache layer.
174
173
 
175
- The persistent vector database acts as the long-term backing store for cached Q&A entries.
174
+ The persistent vector database acts as the long-term backing store for cached Q\&A entries.
176
175
 
177
176
  When Tier 1 and Tier 2 miss, Tier 3 performs the persistent lookup.
178
177
 
@@ -293,8 +292,6 @@ Persistent cache seeded
293
292
 
294
293
  `populate_cache()` and `check_cache()` have intentionally different responsibilities.
295
294
 
296
-
297
-
298
295
  `populate_cache()` seeds the persistent cache VDB.
299
296
 
300
297
  It does **not** directly populate every cache tier.
@@ -427,7 +424,7 @@ Or install the development version directly from the repository:
427
424
  pip install .
428
425
  ```
429
426
 
430
- PyPI link: https://pypi.org/project/TriCacheLLM-MMA/0.1.3/
427
+ PyPI link: [https://pypi.org/project/TriCacheLLM-MMA/0.1.6/](https://pypi.org/project/TriCacheLLM-MMA/0.1.6/)​
431
428
 
432
429
  ---
433
430
 
@@ -459,7 +456,7 @@ TriCacheLLM_MMA uses Celery for background operations such as:
459
456
  After installing the package, start the cache worker in a **separate terminal**:
460
457
 
461
458
  ```bash
462
- celery -A portable_cache_bgWorkers.portable_cache_celery_conf.celery_app worker --loglevel=info -Q ai
459
+ celery -A TriCacheLLM_MMA.portable_cache_bgWorkers.portable_cache_celery_conf.celery_app worker --loglevel=info -Q ai
463
460
  ```
464
461
 
465
462
  You do **not** need to navigate into the package's `site-packages` directory.
@@ -571,13 +568,12 @@ The core cache operations are asynchronous Python APIs and are not inherently ti
571
568
  The included integration example uses FastAPI because it provides a convenient demonstration of multi-user request handling.
572
569
 
573
570
  V1 is primarily demonstrated in a web-service architecture, while future versions aim to make standalone application integration equally straightforward.
574
- ***NOTE: On first initialization, the embedding model may contact Hugging Face to obtain the model if it is not already available in the local cache. Subsequent process reloads and reuse the locally cached model files Blazing fast.***
575
-
576
- ---
577
-
578
571
 
579
572
 
573
+ > **Note on Model Initialization:**
574
+ > On the first request or system initialization, the embedding model will load into RAM (fetching from Hugging Face if it's not already present in your local cache). Subsequent requests and code reloads reuse the cached instance instantly for blazing-fast performance.
580
575
 
576
+ ---
581
577
 
582
578
  # Cache Data Model
583
579
 
@@ -613,9 +609,6 @@ For example, you may want to restrict cache retrieval to:
613
609
 
614
610
  The persistent retrieval logic can be extended around the VDB lookup.
615
611
 
616
-
617
-
618
-
619
612
  This allows applications to combine semantic retrieval with deterministic metadata constraints.
620
613
 
621
614
  ---
@@ -626,8 +619,6 @@ Additional metadata can be added to the cache payload.
626
619
 
627
620
  The cache population path constructs metadata similar to:
628
621
 
629
-
630
-
631
622
  For example:
632
623
 
633
624
  ```python
@@ -880,8 +871,6 @@ These can be considered for future versions.
880
871
 
881
872
  ---
882
873
 
883
-
884
-
885
874
  # Consumer Responsibility
886
875
 
887
876
  The consuming application is responsible for:
@@ -938,7 +927,6 @@ The current V1 intentionally keeps the architecture close to the underlying impl
938
927
 
939
928
  ---
940
929
 
941
-
942
930
  # License
943
931
 
944
932
  This project is licensed under the **GNU Lesser General Public License v3.0 (LGPLv3)**.
@@ -34,7 +34,6 @@ The internal infrastructure handles the multi-tier lookup and promotion logic.
34
34
 
35
35
  > **💡 Note for PyPI Visitors:** If you are reading this on PyPI, please check out the [TriCacheLLM_MMA GitHub Repository](https://github.com/mohib-ash/TriCacheLLM_MMA) for the most up-to-date documentation, integration guides, and advanced examples!
36
36
 
37
-
38
37
  ---
39
38
 
40
39
  # Architecture
@@ -130,7 +129,7 @@ Tier 2 is intentionally optimized for fast semantic cache retrieval.
130
129
 
131
130
  Tier 3 is the persistent cache layer.
132
131
 
133
- The persistent vector database acts as the long-term backing store for cached Q&A entries.
132
+ The persistent vector database acts as the long-term backing store for cached Q\&A entries.
134
133
 
135
134
  When Tier 1 and Tier 2 miss, Tier 3 performs the persistent lookup.
136
135
 
@@ -251,8 +250,6 @@ Persistent cache seeded
251
250
 
252
251
  `populate_cache()` and `check_cache()` have intentionally different responsibilities.
253
252
 
254
-
255
-
256
253
  `populate_cache()` seeds the persistent cache VDB.
257
254
 
258
255
  It does **not** directly populate every cache tier.
@@ -385,7 +382,7 @@ Or install the development version directly from the repository:
385
382
  pip install .
386
383
  ```
387
384
 
388
- PyPI link: https://pypi.org/project/TriCacheLLM-MMA/0.1.3/
385
+ PyPI link: [https://pypi.org/project/TriCacheLLM-MMA/0.1.6/](https://pypi.org/project/TriCacheLLM-MMA/0.1.6/)​
389
386
 
390
387
  ---
391
388
 
@@ -417,7 +414,7 @@ TriCacheLLM_MMA uses Celery for background operations such as:
417
414
  After installing the package, start the cache worker in a **separate terminal**:
418
415
 
419
416
  ```bash
420
- celery -A portable_cache_bgWorkers.portable_cache_celery_conf.celery_app worker --loglevel=info -Q ai
417
+ celery -A TriCacheLLM_MMA.portable_cache_bgWorkers.portable_cache_celery_conf.celery_app worker --loglevel=info -Q ai
421
418
  ```
422
419
 
423
420
  You do **not** need to navigate into the package's `site-packages` directory.
@@ -529,13 +526,12 @@ The core cache operations are asynchronous Python APIs and are not inherently ti
529
526
  The included integration example uses FastAPI because it provides a convenient demonstration of multi-user request handling.
530
527
 
531
528
  V1 is primarily demonstrated in a web-service architecture, while future versions aim to make standalone application integration equally straightforward.
532
- ***NOTE: On first initialization, the embedding model may contact Hugging Face to obtain the model if it is not already available in the local cache. Subsequent process reloads and reuse the locally cached model files Blazing fast.***
533
-
534
- ---
535
-
536
529
 
537
530
 
531
+ > **Note on Model Initialization:**
532
+ > On the first request or system initialization, the embedding model will load into RAM (fetching from Hugging Face if it's not already present in your local cache). Subsequent requests and code reloads reuse the cached instance instantly for blazing-fast performance.
538
533
 
534
+ ---
539
535
 
540
536
  # Cache Data Model
541
537
 
@@ -571,9 +567,6 @@ For example, you may want to restrict cache retrieval to:
571
567
 
572
568
  The persistent retrieval logic can be extended around the VDB lookup.
573
569
 
574
-
575
-
576
-
577
570
  This allows applications to combine semantic retrieval with deterministic metadata constraints.
578
571
 
579
572
  ---
@@ -584,8 +577,6 @@ Additional metadata can be added to the cache payload.
584
577
 
585
578
  The cache population path constructs metadata similar to:
586
579
 
587
-
588
-
589
580
  For example:
590
581
 
591
582
  ```python
@@ -838,8 +829,6 @@ These can be considered for future versions.
838
829
 
839
830
  ---
840
831
 
841
-
842
-
843
832
  # Consumer Responsibility
844
833
 
845
834
  The consuming application is responsible for:
@@ -896,7 +885,6 @@ The current V1 intentionally keeps the architecture close to the underlying impl
896
885
 
897
886
  ---
898
887
 
899
-
900
888
  # License
901
889
 
902
890
  This project is licensed under the **GNU Lesser General Public License v3.0 (LGPLv3)**.
@@ -929,4 +917,4 @@ with the goal of making expensive LLM inference the **last resort rather than th
929
917
  ---
930
918
 
931
919
  # Disclaimer:
932
- This software is provided "as is" without warranty of any kind. The author is not responsible for any data loss, system failures, or damages arising from its use.
920
+ This software is provided "as is" without warranty of any kind. The author is not responsible for any data loss, system failures, or damages arising from its use.
@@ -34,7 +34,7 @@ celery_app = Celery(
34
34
  )
35
35
 
36
36
  celery_app.conf.imports = (
37
- "portable_cache_bgWorkers.portable_cache_workers",
37
+ "TriCacheLLM_MMA.portable_cache_bgWorkers.portable_cache_workers",
38
38
  )
39
39
 
40
40
  celery_app.conf.task_default_queue = "default"
@@ -46,7 +46,6 @@ async def create_cache_vdb_async(task_instance: Any, user_id: int):
46
46
  parents=True,
47
47
  exist_ok=True,
48
48
  )
49
-
50
49
  await asyncio.to_thread(
51
50
  lambda: Chroma(
52
51
  collection_name=f"question_cache_{user_id}",
@@ -142,7 +141,6 @@ async def push_response_in_cache_async(task_instance: Any, user_id, question: st
142
141
  )
143
142
 
144
143
  user_cache_vdb_path = Path(cache_res.vdb_path)
145
-
146
144
  user_cache_vdb = await asyncio.to_thread(
147
145
  lambda: Chroma(
148
146
  collection_name=f"question_cache_{user_id}",
@@ -524,7 +524,7 @@ async def populate_cache(to_cache_answer, to_cache_question, user_id: Any = 0) -
524
524
  async def close_cache_system():
525
525
  print("SHUTTING_DOWN_PORTABLE_CACHE: Cleaning up resources...")
526
526
 
527
- from portable_cache_schemas.portable_cache_dbConf import db_manager
527
+ from .portable_cache_schemas.portable_cache_dbConf import db_manager
528
528
 
529
529
  if db_manager.norma_engine is not None:
530
530
  try:
@@ -0,0 +1,31 @@
1
+ # File: portable_cache_utils/portable_cache_embedding_model.py
2
+
3
+ #on each --reload this reads weights
4
+ from langchain_huggingface import HuggingFaceEmbeddings
5
+ from ..portable_cache_utils.protable_cache_DynamicEnv_maker import get_settings
6
+
7
+ embedding_model = HuggingFaceEmbeddings(
8
+ model_name=get_settings().portable_cache_cache_proj_embedding_model,
9
+ cache_folder=get_settings().portable_cache_chroma_db_dir
10
+ )
11
+
12
+
13
+
14
+ #lazy load, on --reload it will read weights but not at the start but when needed (un-comment me if u need lazyload)
15
+ """
16
+ from langchain_huggingface import HuggingFaceEmbeddings
17
+ from ..portable_cache_utils.protable_cache_DynamicEnv_maker import get_settings
18
+
19
+ class EmbeddingModel:
20
+ def __init__(self):
21
+ self.model = None
22
+
23
+ def get_model(self):
24
+ if self.model is None:
25
+ self.model = HuggingFaceEmbeddings(
26
+ model_name=get_settings().portable_cache_cache_proj_embedding_model,
27
+ cache_folder=get_settings().portable_cache_chroma_db_dir,
28
+ )
29
+ return self.model
30
+ embedding_manager = EmbeddingModel()
31
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TriCacheLLM_MMA
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: A robust three-tier LLM-aware caching SDK using Redis, ChromaDB, and automatic SQLite bootstrap.
5
5
  Author-email: Mohib Ashfaq Butt <inboxmohib@gmail.com>
6
6
  License-Expression: LGPL-3.0-only
@@ -76,7 +76,6 @@ The internal infrastructure handles the multi-tier lookup and promotion logic.
76
76
 
77
77
  > **💡 Note for PyPI Visitors:** If you are reading this on PyPI, please check out the [TriCacheLLM_MMA GitHub Repository](https://github.com/mohib-ash/TriCacheLLM_MMA) for the most up-to-date documentation, integration guides, and advanced examples!
78
78
 
79
-
80
79
  ---
81
80
 
82
81
  # Architecture
@@ -172,7 +171,7 @@ Tier 2 is intentionally optimized for fast semantic cache retrieval.
172
171
 
173
172
  Tier 3 is the persistent cache layer.
174
173
 
175
- The persistent vector database acts as the long-term backing store for cached Q&A entries.
174
+ The persistent vector database acts as the long-term backing store for cached Q\&A entries.
176
175
 
177
176
  When Tier 1 and Tier 2 miss, Tier 3 performs the persistent lookup.
178
177
 
@@ -293,8 +292,6 @@ Persistent cache seeded
293
292
 
294
293
  `populate_cache()` and `check_cache()` have intentionally different responsibilities.
295
294
 
296
-
297
-
298
295
  `populate_cache()` seeds the persistent cache VDB.
299
296
 
300
297
  It does **not** directly populate every cache tier.
@@ -427,7 +424,7 @@ Or install the development version directly from the repository:
427
424
  pip install .
428
425
  ```
429
426
 
430
- PyPI link: https://pypi.org/project/TriCacheLLM-MMA/0.1.3/
427
+ PyPI link: [https://pypi.org/project/TriCacheLLM-MMA/0.1.6/](https://pypi.org/project/TriCacheLLM-MMA/0.1.6/)​
431
428
 
432
429
  ---
433
430
 
@@ -459,7 +456,7 @@ TriCacheLLM_MMA uses Celery for background operations such as:
459
456
  After installing the package, start the cache worker in a **separate terminal**:
460
457
 
461
458
  ```bash
462
- celery -A portable_cache_bgWorkers.portable_cache_celery_conf.celery_app worker --loglevel=info -Q ai
459
+ celery -A TriCacheLLM_MMA.portable_cache_bgWorkers.portable_cache_celery_conf.celery_app worker --loglevel=info -Q ai
463
460
  ```
464
461
 
465
462
  You do **not** need to navigate into the package's `site-packages` directory.
@@ -571,13 +568,12 @@ The core cache operations are asynchronous Python APIs and are not inherently ti
571
568
  The included integration example uses FastAPI because it provides a convenient demonstration of multi-user request handling.
572
569
 
573
570
  V1 is primarily demonstrated in a web-service architecture, while future versions aim to make standalone application integration equally straightforward.
574
- ***NOTE: On first initialization, the embedding model may contact Hugging Face to obtain the model if it is not already available in the local cache. Subsequent process reloads and reuse the locally cached model files Blazing fast.***
575
-
576
- ---
577
-
578
571
 
579
572
 
573
+ > **Note on Model Initialization:**
574
+ > On the first request or system initialization, the embedding model will load into RAM (fetching from Hugging Face if it's not already present in your local cache). Subsequent requests and code reloads reuse the cached instance instantly for blazing-fast performance.
580
575
 
576
+ ---
581
577
 
582
578
  # Cache Data Model
583
579
 
@@ -613,9 +609,6 @@ For example, you may want to restrict cache retrieval to:
613
609
 
614
610
  The persistent retrieval logic can be extended around the VDB lookup.
615
611
 
616
-
617
-
618
-
619
612
  This allows applications to combine semantic retrieval with deterministic metadata constraints.
620
613
 
621
614
  ---
@@ -626,8 +619,6 @@ Additional metadata can be added to the cache payload.
626
619
 
627
620
  The cache population path constructs metadata similar to:
628
621
 
629
-
630
-
631
622
  For example:
632
623
 
633
624
  ```python
@@ -880,8 +871,6 @@ These can be considered for future versions.
880
871
 
881
872
  ---
882
873
 
883
-
884
-
885
874
  # Consumer Responsibility
886
875
 
887
876
  The consuming application is responsible for:
@@ -938,7 +927,6 @@ The current V1 intentionally keeps the architecture close to the underlying impl
938
927
 
939
928
  ---
940
929
 
941
-
942
930
  # License
943
931
 
944
932
  This project is licensed under the **GNU Lesser General Public License v3.0 (LGPLv3)**.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "TriCacheLLM_MMA"
7
- version = "0.1.5"
7
+ version = "0.1.6"
8
8
  description = "A robust three-tier LLM-aware caching SDK using Redis, ChromaDB, and automatic SQLite bootstrap."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -1,8 +0,0 @@
1
- # # File: portable_cache_utils/portable_cache_embedding_model.py
2
- from langchain_huggingface import HuggingFaceEmbeddings
3
- from ..portable_cache_utils.protable_cache_DynamicEnv_maker import get_settings
4
-
5
- embedding_model = HuggingFaceEmbeddings(
6
- model_name=get_settings().portable_cache_cache_proj_embedding_model,
7
- cache_folder=get_settings().portable_cache_chroma_db_dir
8
- )
File without changes