TriCacheLLM-MMA 0.1.4__tar.gz → 0.1.5__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 (22) hide show
  1. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/PKG-INFO +22 -8
  2. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/README.md +21 -7
  3. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/portable_cache_utils/portable_cache_embedding_model.py +2 -1
  4. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA.egg-info/PKG-INFO +22 -8
  5. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/pyproject.toml +1 -1
  6. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/LICENSE +0 -0
  7. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/__init__.py +0 -0
  8. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/portable_cache_Ai/portable_cache_rerankAi.py +0 -0
  9. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/portable_cache_bgWorkers/portable_cache_celery_conf.py +0 -0
  10. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/portable_cache_bgWorkers/portable_cache_workers.py +0 -0
  11. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/portable_cache_dbSchema.py +0 -0
  12. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/portable_cache_main.py +0 -0
  13. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/portable_cache_redis.py +0 -0
  14. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/portable_cache_schemas/portable_cache_dbBase.py +0 -0
  15. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/portable_cache_schemas/portable_cache_dbConf.py +0 -0
  16. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/portable_cache_schemas/portable_cache_schemas.py +0 -0
  17. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA/portable_cache_utils/protable_cache_DynamicEnv_maker.py +0 -0
  18. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA.egg-info/SOURCES.txt +0 -0
  19. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA.egg-info/dependency_links.txt +0 -0
  20. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA.egg-info/requires.txt +0 -0
  21. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/TriCacheLLM_MMA.egg-info/top_level.txt +0 -0
  22. {tricachellm_mma-0.1.4 → tricachellm_mma-0.1.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TriCacheLLM_MMA
3
- Version: 0.1.4
3
+ Version: 0.1.5
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
@@ -511,18 +511,31 @@ from TriCacheLLM_MMA import (
511
511
  check_tenant_creation_status,
512
512
  )
513
513
 
514
- app = FastAPI()
514
+
515
+ @asynccontextmanager
516
+ async def lifespan(app: FastAPI):
517
+ yield
518
+ await close_cache_system()
519
+
520
+
521
+ app = FastAPI(
522
+ title="TriCacheLLM_MMA V1 Route Test",
523
+ lifespan=lifespan,
524
+ )
525
+
515
526
 
516
527
  # 1. ADMIN SETUP (Run once on startup / first deploy with user_id=0)
517
- @app.on_event("startup")
518
- async def startup_event():
519
- await create_cache_system(
528
+ @app.post("/api/consumer/init")
529
+ async def initialize_consumer():
530
+ user_id: int = 0
531
+ result = await create_cache_system(
520
532
  redis_url="redis://localhost:6379/0",
521
- cohere_api_key="YOUR_COHERE_API_KEY",
533
+ cohere_api_key="KEY_HERE",
522
534
  chroma_db_dir="./chroma_db",
523
535
  db_path="./cache.db",
524
- user_id=0,
536
+ user_id=user_id,
525
537
  )
538
+ return {"status": "success", "details": result}
526
539
 
527
540
 
528
541
  # 2. TENANT ENDPOINT (Zero boilerplate for subsequent users)
@@ -552,12 +565,13 @@ async def ask_question(
552
565
  )
553
566
 
554
567
  return {"source": "ai", "response": llm_response}
568
+
555
569
  ```
556
570
  The core cache operations are asynchronous Python APIs and are not inherently tied to FastAPI.
557
571
  The included integration example uses FastAPI because it provides a convenient demonstration of multi-user request handling.
558
572
 
559
573
  V1 is primarily demonstrated in a web-service architecture, while future versions aim to make standalone application integration equally straightforward.
560
- ***NOTE: When you import files they'll send request to hugging face to get embedding model weights but only once! untill you reload server***
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.***
561
575
 
562
576
  ---
563
577
 
@@ -469,18 +469,31 @@ from TriCacheLLM_MMA import (
469
469
  check_tenant_creation_status,
470
470
  )
471
471
 
472
- app = FastAPI()
472
+
473
+ @asynccontextmanager
474
+ async def lifespan(app: FastAPI):
475
+ yield
476
+ await close_cache_system()
477
+
478
+
479
+ app = FastAPI(
480
+ title="TriCacheLLM_MMA V1 Route Test",
481
+ lifespan=lifespan,
482
+ )
483
+
473
484
 
474
485
  # 1. ADMIN SETUP (Run once on startup / first deploy with user_id=0)
475
- @app.on_event("startup")
476
- async def startup_event():
477
- await create_cache_system(
486
+ @app.post("/api/consumer/init")
487
+ async def initialize_consumer():
488
+ user_id: int = 0
489
+ result = await create_cache_system(
478
490
  redis_url="redis://localhost:6379/0",
479
- cohere_api_key="YOUR_COHERE_API_KEY",
491
+ cohere_api_key="KEY_HERE",
480
492
  chroma_db_dir="./chroma_db",
481
493
  db_path="./cache.db",
482
- user_id=0,
494
+ user_id=user_id,
483
495
  )
496
+ return {"status": "success", "details": result}
484
497
 
485
498
 
486
499
  # 2. TENANT ENDPOINT (Zero boilerplate for subsequent users)
@@ -510,12 +523,13 @@ async def ask_question(
510
523
  )
511
524
 
512
525
  return {"source": "ai", "response": llm_response}
526
+
513
527
  ```
514
528
  The core cache operations are asynchronous Python APIs and are not inherently tied to FastAPI.
515
529
  The included integration example uses FastAPI because it provides a convenient demonstration of multi-user request handling.
516
530
 
517
531
  V1 is primarily demonstrated in a web-service architecture, while future versions aim to make standalone application integration equally straightforward.
518
- ***NOTE: When you import files they'll send request to hugging face to get embedding model weights but only once! untill you reload server***
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.***
519
533
 
520
534
  ---
521
535
 
@@ -3,5 +3,6 @@ from langchain_huggingface import HuggingFaceEmbeddings
3
3
  from ..portable_cache_utils.protable_cache_DynamicEnv_maker import get_settings
4
4
 
5
5
  embedding_model = HuggingFaceEmbeddings(
6
- model_name=get_settings().portable_cache_cache_proj_embedding_model
6
+ model_name=get_settings().portable_cache_cache_proj_embedding_model,
7
+ cache_folder=get_settings().portable_cache_chroma_db_dir
7
8
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TriCacheLLM_MMA
3
- Version: 0.1.4
3
+ Version: 0.1.5
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
@@ -511,18 +511,31 @@ from TriCacheLLM_MMA import (
511
511
  check_tenant_creation_status,
512
512
  )
513
513
 
514
- app = FastAPI()
514
+
515
+ @asynccontextmanager
516
+ async def lifespan(app: FastAPI):
517
+ yield
518
+ await close_cache_system()
519
+
520
+
521
+ app = FastAPI(
522
+ title="TriCacheLLM_MMA V1 Route Test",
523
+ lifespan=lifespan,
524
+ )
525
+
515
526
 
516
527
  # 1. ADMIN SETUP (Run once on startup / first deploy with user_id=0)
517
- @app.on_event("startup")
518
- async def startup_event():
519
- await create_cache_system(
528
+ @app.post("/api/consumer/init")
529
+ async def initialize_consumer():
530
+ user_id: int = 0
531
+ result = await create_cache_system(
520
532
  redis_url="redis://localhost:6379/0",
521
- cohere_api_key="YOUR_COHERE_API_KEY",
533
+ cohere_api_key="KEY_HERE",
522
534
  chroma_db_dir="./chroma_db",
523
535
  db_path="./cache.db",
524
- user_id=0,
536
+ user_id=user_id,
525
537
  )
538
+ return {"status": "success", "details": result}
526
539
 
527
540
 
528
541
  # 2. TENANT ENDPOINT (Zero boilerplate for subsequent users)
@@ -552,12 +565,13 @@ async def ask_question(
552
565
  )
553
566
 
554
567
  return {"source": "ai", "response": llm_response}
568
+
555
569
  ```
556
570
  The core cache operations are asynchronous Python APIs and are not inherently tied to FastAPI.
557
571
  The included integration example uses FastAPI because it provides a convenient demonstration of multi-user request handling.
558
572
 
559
573
  V1 is primarily demonstrated in a web-service architecture, while future versions aim to make standalone application integration equally straightforward.
560
- ***NOTE: When you import files they'll send request to hugging face to get embedding model weights but only once! untill you reload server***
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.***
561
575
 
562
576
  ---
563
577
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "TriCacheLLM_MMA"
7
- version = "0.1.4"
7
+ version = "0.1.5"
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"
File without changes