tokenshrink 0.2.1__tar.gz → 0.2.3__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.
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/PKG-INFO +1 -1
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/pyproject.toml +1 -1
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/src/tokenshrink/__init__.py +8 -2
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/src/tokenshrink/cli.py +7 -2
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/src/tokenshrink/pipeline.py +1 -1
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/.github/ISSUE_TEMPLATE/feedback.md +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/.gitignore +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/Dockerfile +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/LICENSE +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/README.md +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/docker-compose.test.yml +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/docs/ASSETS.md +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/docs/index.html +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/docs/marketing/origin-story-post.md +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/docs/marketing/reddit-log.md +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/docs/marketing/reddit-posts.md +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/docs/marketing/reddit-routine.md +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/docs/monitoring-log.md +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/site/index.html +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/src/tokenshrink/__main__.py +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/tests/conftest.py +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/tests/test_cli.py +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/tests/test_integration.py +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/tests/test_pipeline.py +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/tests/test_stress.py +0 -0
- {tokenshrink-0.2.1 → tokenshrink-0.2.3}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tokenshrink
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Cut your AI costs 50-80%. FAISS retrieval + LLMLingua compression + REFRAG-inspired adaptive optimization.
|
|
5
5
|
Project-URL: Homepage, https://tokenshrink.dev
|
|
6
6
|
Project-URL: Repository, https://github.com/MusashiMiyamoto1-cloud/tokenshrink
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tokenshrink"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.3"
|
|
8
8
|
description = "Cut your AI costs 50-80%. FAISS retrieval + LLMLingua compression + REFRAG-inspired adaptive optimization."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -23,7 +23,13 @@ CLI:
|
|
|
23
23
|
tokenshrink stats
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
__version__ = "0.2.3"
|
|
27
|
+
|
|
28
|
+
def __getattr__(name):
|
|
29
|
+
if name in ("TokenShrink", "ShrinkResult", "ChunkScore"):
|
|
30
|
+
from tokenshrink.pipeline import TokenShrink, ShrinkResult, ChunkScore
|
|
31
|
+
globals().update({"TokenShrink": TokenShrink, "ShrinkResult": ShrinkResult, "ChunkScore": ChunkScore})
|
|
32
|
+
return globals()[name]
|
|
33
|
+
raise AttributeError(f"module 'tokenshrink' has no attribute {name!r}")
|
|
27
34
|
|
|
28
|
-
__version__ = "0.2.1"
|
|
29
35
|
__all__ = ["TokenShrink", "ShrinkResult", "ChunkScore"]
|
|
@@ -13,7 +13,7 @@ import sys
|
|
|
13
13
|
import json
|
|
14
14
|
from pathlib import Path
|
|
15
15
|
|
|
16
|
-
from tokenshrink import
|
|
16
|
+
from tokenshrink import __version__
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def main():
|
|
@@ -128,11 +128,16 @@ def main():
|
|
|
128
128
|
import os, logging, warnings
|
|
129
129
|
os.environ["TRANSFORMERS_VERBOSITY"] = "error"
|
|
130
130
|
os.environ["HF_HUB_DISABLE_PROGRESS_BARS"] = "1"
|
|
131
|
+
os.environ["HF_HUB_DISABLE_TELEMETRY"] = "1"
|
|
131
132
|
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
|
133
|
+
os.environ["TQDM_DISABLE"] = "1"
|
|
132
134
|
logging.getLogger("sentence_transformers").setLevel(logging.ERROR)
|
|
133
135
|
logging.getLogger("transformers").setLevel(logging.ERROR)
|
|
134
136
|
logging.getLogger("huggingface_hub").setLevel(logging.ERROR)
|
|
135
|
-
warnings.filterwarnings("ignore"
|
|
137
|
+
warnings.filterwarnings("ignore") # suppress all warnings in quiet mode
|
|
138
|
+
|
|
139
|
+
# Lazy import to avoid loading ML models for --help/--version
|
|
140
|
+
from tokenshrink import TokenShrink
|
|
136
141
|
|
|
137
142
|
# Determine compression setting
|
|
138
143
|
compression = True
|
|
@@ -613,7 +613,7 @@ class TokenShrink:
|
|
|
613
613
|
"ratio": total_compressed / total_original if total_original else 1.0,
|
|
614
614
|
}
|
|
615
615
|
|
|
616
|
-
def search(self, question: str, k: int = 5, min_score: float = 0.
|
|
616
|
+
def search(self, question: str, k: int = 5, min_score: float = 0.05) -> list[dict]:
|
|
617
617
|
"""Search without compression. Returns raw chunks with scores."""
|
|
618
618
|
if self._index.ntotal == 0:
|
|
619
619
|
return []
|
|
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
|
|
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
|