tokenshrink 0.2.2__tar.gz → 0.2.4__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.2 → tokenshrink-0.2.4}/PKG-INFO +1 -1
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/pyproject.toml +1 -1
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/src/tokenshrink/__init__.py +1 -1
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/src/tokenshrink/cli.py +13 -11
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/src/tokenshrink/pipeline.py +1 -1
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/.github/ISSUE_TEMPLATE/feedback.md +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/.gitignore +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/Dockerfile +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/LICENSE +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/README.md +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/docker-compose.test.yml +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/docs/ASSETS.md +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/docs/index.html +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/docs/marketing/origin-story-post.md +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/docs/marketing/reddit-log.md +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/docs/marketing/reddit-posts.md +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/docs/marketing/reddit-routine.md +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/docs/monitoring-log.md +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/site/index.html +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/src/tokenshrink/__main__.py +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/tests/conftest.py +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/tests/test_cli.py +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/tests/test_integration.py +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/tests/test_pipeline.py +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/tests/test_stress.py +0 -0
- {tokenshrink-0.2.2 → tokenshrink-0.2.4}/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.4
|
|
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.4"
|
|
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"
|
|
@@ -11,8 +11,21 @@ Usage:
|
|
|
11
11
|
import argparse
|
|
12
12
|
import sys
|
|
13
13
|
import json
|
|
14
|
+
import os
|
|
14
15
|
from pathlib import Path
|
|
15
16
|
|
|
17
|
+
# Early suppression: check for --quiet or --json BEFORE heavy imports
|
|
18
|
+
if "--quiet" in sys.argv or "--json" in sys.argv:
|
|
19
|
+
os.environ["TRANSFORMERS_VERBOSITY"] = "error"
|
|
20
|
+
os.environ["HF_HUB_DISABLE_PROGRESS_BARS"] = "1"
|
|
21
|
+
os.environ["HF_HUB_DISABLE_TELEMETRY"] = "1"
|
|
22
|
+
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
|
23
|
+
os.environ["TQDM_DISABLE"] = "1"
|
|
24
|
+
import warnings
|
|
25
|
+
warnings.filterwarnings("ignore")
|
|
26
|
+
import logging
|
|
27
|
+
logging.disable(logging.WARNING)
|
|
28
|
+
|
|
16
29
|
from tokenshrink import __version__
|
|
17
30
|
|
|
18
31
|
|
|
@@ -123,17 +136,6 @@ def main():
|
|
|
123
136
|
parser.print_help()
|
|
124
137
|
sys.exit(0)
|
|
125
138
|
|
|
126
|
-
# Suppress noisy output when --quiet or --json
|
|
127
|
-
if args.quiet or args.json:
|
|
128
|
-
import os, logging, warnings
|
|
129
|
-
os.environ["TRANSFORMERS_VERBOSITY"] = "error"
|
|
130
|
-
os.environ["HF_HUB_DISABLE_PROGRESS_BARS"] = "1"
|
|
131
|
-
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
|
132
|
-
logging.getLogger("sentence_transformers").setLevel(logging.ERROR)
|
|
133
|
-
logging.getLogger("transformers").setLevel(logging.ERROR)
|
|
134
|
-
logging.getLogger("huggingface_hub").setLevel(logging.ERROR)
|
|
135
|
-
warnings.filterwarnings("ignore", message=".*unauthenticated.*")
|
|
136
|
-
|
|
137
139
|
# Lazy import to avoid loading ML models for --help/--version
|
|
138
140
|
from tokenshrink import TokenShrink
|
|
139
141
|
|
|
@@ -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
|