TriCacheLLM-MMA 0.1.7__tar.gz → 0.1.8__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.
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/PKG-INFO +22 -3
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/README.md +21 -2
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA/portable_cache_main.py +1 -1
- tricachellm_mma-0.1.8/TriCacheLLM_MMA/portable_cache_utils/portable_cache_embedding_model.py +63 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA.egg-info/PKG-INFO +22 -3
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/pyproject.toml +1 -1
- tricachellm_mma-0.1.7/TriCacheLLM_MMA/portable_cache_utils/portable_cache_embedding_model.py +0 -31
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/LICENSE +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA/__init__.py +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA/portable_cache_Ai/portable_cache_rerankAi.py +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA/portable_cache_bgWorkers/portable_cache_celery_conf.py +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA/portable_cache_bgWorkers/portable_cache_workers.py +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA/portable_cache_dbSchema.py +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA/portable_cache_redis.py +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA/portable_cache_schemas/portable_cache_dbBase.py +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA/portable_cache_schemas/portable_cache_dbConf.py +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA/portable_cache_schemas/portable_cache_schemas.py +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA/portable_cache_utils/protable_cache_DynamicEnv_maker.py +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA.egg-info/SOURCES.txt +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA.egg-info/dependency_links.txt +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA.egg-info/requires.txt +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA.egg-info/top_level.txt +0 -0
- {tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: TriCacheLLM_MMA
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
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
|
|
@@ -424,7 +424,7 @@ Or install the development version directly from the repository:
|
|
|
424
424
|
pip install .
|
|
425
425
|
```
|
|
426
426
|
|
|
427
|
-
PyPI link: [https://pypi.org/project/TriCacheLLM-MMA/0.1.
|
|
427
|
+
PyPI link: [https://pypi.org/project/TriCacheLLM-MMA/0.1.8/](https://pypi.org/project/TriCacheLLM-MMA/0.1.8/)
|
|
428
428
|
|
|
429
429
|
---
|
|
430
430
|
|
|
@@ -478,6 +478,25 @@ Keep the Celery worker running while using the cache.
|
|
|
478
478
|
|
|
479
479
|
---
|
|
480
480
|
|
|
481
|
+
### 📂 Model Caching Locations
|
|
482
|
+
|
|
483
|
+
To ensure heavy Hugging Face embedding models don't re-download or clutter your project directory, `TriCacheLLM_MMA` automatically stores them in a stable, user-level system cache directory depending on your operating system:
|
|
484
|
+
|
|
485
|
+
* **Windows:**
|
|
486
|
+
`%LOCALAPPDATA%\TriCacheLLM_MMA\embedding_model\`
|
|
487
|
+
|
|
488
|
+
*(Falls back to `C:\Users\<Username>\AppData\Local\TriCacheLLM_MMA\embedding_model\`)*
|
|
489
|
+
|
|
490
|
+
* **macOS:**
|
|
491
|
+
`~/Library/Caches/TriCacheLLM_MMA/embedding_model/`
|
|
492
|
+
|
|
493
|
+
* **Linux / Unix:**
|
|
494
|
+
`$XDG_CACHE_HOME/TriCacheLLM_MMA/embedding_model/`
|
|
495
|
+
|
|
496
|
+
*(Falls back to `~/.cache/TriCacheLLM_MMA/embedding_model/`)*
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
481
500
|
# Cohere
|
|
482
501
|
|
|
483
502
|
The persistent cache tier uses Cohere reranking.
|
|
@@ -521,7 +540,7 @@ app = FastAPI(
|
|
|
521
540
|
)
|
|
522
541
|
|
|
523
542
|
|
|
524
|
-
# NOTE:
|
|
543
|
+
# NOTE: Run celery first it will download the embedding model for you then initialize create_cache_system(user_id=0)
|
|
525
544
|
# In upcoming versions, this process will be automated, so you won't need to manually run the Celery command.
|
|
526
545
|
|
|
527
546
|
|
|
@@ -382,7 +382,7 @@ Or install the development version directly from the repository:
|
|
|
382
382
|
pip install .
|
|
383
383
|
```
|
|
384
384
|
|
|
385
|
-
PyPI link: [https://pypi.org/project/TriCacheLLM-MMA/0.1.
|
|
385
|
+
PyPI link: [https://pypi.org/project/TriCacheLLM-MMA/0.1.8/](https://pypi.org/project/TriCacheLLM-MMA/0.1.8/)
|
|
386
386
|
|
|
387
387
|
---
|
|
388
388
|
|
|
@@ -436,6 +436,25 @@ Keep the Celery worker running while using the cache.
|
|
|
436
436
|
|
|
437
437
|
---
|
|
438
438
|
|
|
439
|
+
### 📂 Model Caching Locations
|
|
440
|
+
|
|
441
|
+
To ensure heavy Hugging Face embedding models don't re-download or clutter your project directory, `TriCacheLLM_MMA` automatically stores them in a stable, user-level system cache directory depending on your operating system:
|
|
442
|
+
|
|
443
|
+
* **Windows:**
|
|
444
|
+
`%LOCALAPPDATA%\TriCacheLLM_MMA\embedding_model\`
|
|
445
|
+
|
|
446
|
+
*(Falls back to `C:\Users\<Username>\AppData\Local\TriCacheLLM_MMA\embedding_model\`)*
|
|
447
|
+
|
|
448
|
+
* **macOS:**
|
|
449
|
+
`~/Library/Caches/TriCacheLLM_MMA/embedding_model/`
|
|
450
|
+
|
|
451
|
+
* **Linux / Unix:**
|
|
452
|
+
`$XDG_CACHE_HOME/TriCacheLLM_MMA/embedding_model/`
|
|
453
|
+
|
|
454
|
+
*(Falls back to `~/.cache/TriCacheLLM_MMA/embedding_model/`)*
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
439
458
|
# Cohere
|
|
440
459
|
|
|
441
460
|
The persistent cache tier uses Cohere reranking.
|
|
@@ -479,7 +498,7 @@ app = FastAPI(
|
|
|
479
498
|
)
|
|
480
499
|
|
|
481
500
|
|
|
482
|
-
# NOTE:
|
|
501
|
+
# NOTE: Run celery first it will download the embedding model for you then initialize create_cache_system(user_id=0)
|
|
483
502
|
# In upcoming versions, this process will be automated, so you won't need to manually run the Celery command.
|
|
484
503
|
|
|
485
504
|
|
|
@@ -444,7 +444,7 @@ async def create_cache_system(
|
|
|
444
444
|
raise ValueError("Failed to initialize system keys. Verify if the keys are correct.")
|
|
445
445
|
|
|
446
446
|
|
|
447
|
-
# This bit is for 0.1.
|
|
447
|
+
# This bit is for 0.1.9 (at import time embedding model will be loaded anyways so run this anytime u want)
|
|
448
448
|
"""
|
|
449
449
|
is_in_venv = sys.prefix != sys.base_prefix
|
|
450
450
|
celery_name = "celery.exe" if os.name == "nt" else "celery"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# File: portable_cache_utils/portable_cache_embedding_model.py
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from langchain_huggingface import HuggingFaceEmbeddings
|
|
7
|
+
from ..portable_cache_utils.protable_cache_DynamicEnv_maker import get_settings
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_embedding_cache_dir() -> Path:
|
|
11
|
+
"""
|
|
12
|
+
Return a stable per-user cache directory for the Hugging Face
|
|
13
|
+
embedding model, independent of the consumer application's location,
|
|
14
|
+
respecting OS conventions and XDG standards.
|
|
15
|
+
"""
|
|
16
|
+
if os.name == "nt":
|
|
17
|
+
local_app_data = os.environ.get("LOCALAPPDATA")
|
|
18
|
+
if local_app_data:
|
|
19
|
+
return Path(local_app_data) / "TriCacheLLM_MMA" / "embedding_model"
|
|
20
|
+
return Path.home() / "AppData" / "Local" / "TriCacheLLM_MMA" / "embedding_model"
|
|
21
|
+
|
|
22
|
+
if sys.platform == "darwin":
|
|
23
|
+
return Path.home() / "Library" / "Caches" / "TriCacheLLM_MMA" / "embedding_model"
|
|
24
|
+
|
|
25
|
+
# Linux / Unix: Respect XDG_CACHE_HOME if explicitly configured
|
|
26
|
+
xdg_cache = os.environ.get("XDG_CACHE_HOME")
|
|
27
|
+
if xdg_cache:
|
|
28
|
+
return Path(xdg_cache) / "TriCacheLLM_MMA" / "embedding_model"
|
|
29
|
+
|
|
30
|
+
return Path.home() / ".cache" / "TriCacheLLM_MMA" / "embedding_model"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Ensure the stable cache path exists prior to initialization
|
|
34
|
+
embedding_cache_dir = get_embedding_cache_dir()
|
|
35
|
+
embedding_cache_dir.mkdir(parents=True, exist_ok=True)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
#on each --reload this reads weights
|
|
39
|
+
embedding_model = HuggingFaceEmbeddings(
|
|
40
|
+
model_name=get_settings().portable_cache_cache_proj_embedding_model,
|
|
41
|
+
cache_folder=str(embedding_cache_dir),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
#lazy load, on --reload it will read weights but not at the start but when needed (un-comment me if u need lazyload)
|
|
47
|
+
"""
|
|
48
|
+
from langchain_huggingface import HuggingFaceEmbeddings
|
|
49
|
+
from ..portable_cache_utils.protable_cache_DynamicEnv_maker import get_settings
|
|
50
|
+
|
|
51
|
+
class EmbeddingModel:
|
|
52
|
+
def __init__(self):
|
|
53
|
+
self.model = None
|
|
54
|
+
|
|
55
|
+
def get_model(self):
|
|
56
|
+
if self.model is None:
|
|
57
|
+
self.model = HuggingFaceEmbeddings(
|
|
58
|
+
model_name=get_settings().portable_cache_cache_proj_embedding_model,
|
|
59
|
+
cache_folder=get_settings().portable_cache_chroma_db_dir,
|
|
60
|
+
)
|
|
61
|
+
return self.model
|
|
62
|
+
embedding_manager = EmbeddingModel()
|
|
63
|
+
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: TriCacheLLM_MMA
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
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
|
|
@@ -424,7 +424,7 @@ Or install the development version directly from the repository:
|
|
|
424
424
|
pip install .
|
|
425
425
|
```
|
|
426
426
|
|
|
427
|
-
PyPI link: [https://pypi.org/project/TriCacheLLM-MMA/0.1.
|
|
427
|
+
PyPI link: [https://pypi.org/project/TriCacheLLM-MMA/0.1.8/](https://pypi.org/project/TriCacheLLM-MMA/0.1.8/)
|
|
428
428
|
|
|
429
429
|
---
|
|
430
430
|
|
|
@@ -478,6 +478,25 @@ Keep the Celery worker running while using the cache.
|
|
|
478
478
|
|
|
479
479
|
---
|
|
480
480
|
|
|
481
|
+
### 📂 Model Caching Locations
|
|
482
|
+
|
|
483
|
+
To ensure heavy Hugging Face embedding models don't re-download or clutter your project directory, `TriCacheLLM_MMA` automatically stores them in a stable, user-level system cache directory depending on your operating system:
|
|
484
|
+
|
|
485
|
+
* **Windows:**
|
|
486
|
+
`%LOCALAPPDATA%\TriCacheLLM_MMA\embedding_model\`
|
|
487
|
+
|
|
488
|
+
*(Falls back to `C:\Users\<Username>\AppData\Local\TriCacheLLM_MMA\embedding_model\`)*
|
|
489
|
+
|
|
490
|
+
* **macOS:**
|
|
491
|
+
`~/Library/Caches/TriCacheLLM_MMA/embedding_model/`
|
|
492
|
+
|
|
493
|
+
* **Linux / Unix:**
|
|
494
|
+
`$XDG_CACHE_HOME/TriCacheLLM_MMA/embedding_model/`
|
|
495
|
+
|
|
496
|
+
*(Falls back to `~/.cache/TriCacheLLM_MMA/embedding_model/`)*
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
481
500
|
# Cohere
|
|
482
501
|
|
|
483
502
|
The persistent cache tier uses Cohere reranking.
|
|
@@ -521,7 +540,7 @@ app = FastAPI(
|
|
|
521
540
|
)
|
|
522
541
|
|
|
523
542
|
|
|
524
|
-
# NOTE:
|
|
543
|
+
# NOTE: Run celery first it will download the embedding model for you then initialize create_cache_system(user_id=0)
|
|
525
544
|
# In upcoming versions, this process will be automated, so you won't need to manually run the Celery command.
|
|
526
545
|
|
|
527
546
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "TriCacheLLM_MMA"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.8"
|
|
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"
|
tricachellm_mma-0.1.7/TriCacheLLM_MMA/portable_cache_utils/portable_cache_embedding_model.py
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tricachellm_mma-0.1.7 → tricachellm_mma-0.1.8}/TriCacheLLM_MMA.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|