abstractcore 2.3.5__py3-none-any.whl → 2.3.7__py3-none-any.whl
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.
- {abstractcore-2.3.5.dist-info → abstractcore-2.3.7.dist-info}/METADATA +112 -1
- {abstractcore-2.3.5.dist-info → abstractcore-2.3.7.dist-info}/RECORD +27 -25
- abstractllm/__init__.py +4 -3
- abstractllm/apps/__main__.py +8 -1
- abstractllm/apps/extractor.py +49 -29
- abstractllm/apps/judge.py +66 -35
- abstractllm/apps/summarizer.py +52 -22
- abstractllm/core/interface.py +8 -25
- abstractllm/core/session.py +37 -6
- abstractllm/embeddings/manager.py +6 -9
- abstractllm/processing/basic_extractor.py +339 -48
- abstractllm/processing/basic_judge.py +72 -35
- abstractllm/processing/basic_summarizer.py +72 -10
- abstractllm/providers/mlx_provider.py +15 -5
- abstractllm/providers/mock_provider.py +15 -1
- abstractllm/providers/ollama_provider.py +3 -2
- abstractllm/server/app.py +9 -5
- abstractllm/structured/handler.py +39 -2
- abstractllm/tools/common_tools.py +1 -1
- abstractllm/utils/__init__.py +17 -1
- abstractllm/utils/cli.py +28 -9
- abstractllm/utils/token_utils.py +595 -0
- abstractllm/utils/version.py +44 -0
- {abstractcore-2.3.5.dist-info → abstractcore-2.3.7.dist-info}/WHEEL +0 -0
- {abstractcore-2.3.5.dist-info → abstractcore-2.3.7.dist-info}/entry_points.txt +0 -0
- {abstractcore-2.3.5.dist-info → abstractcore-2.3.7.dist-info}/licenses/LICENSE +0 -0
- {abstractcore-2.3.5.dist-info → abstractcore-2.3.7.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: abstractcore
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.7
|
|
4
4
|
Summary: Unified interface to all LLM providers with essential infrastructure for tool calling, streaming, and model management
|
|
5
5
|
Author: Laurent-Philippe Albou
|
|
6
6
|
Maintainer: Laurent-Philippe Albou
|
|
@@ -254,6 +254,117 @@ python -m abstractllm.utils.cli --provider anthropic --model claude-3-5-haiku-la
|
|
|
254
254
|
- Quick prototyping with different models
|
|
255
255
|
- Learning AbstractCore capabilities
|
|
256
256
|
|
|
257
|
+
## Built-in Applications (Ready-to-Use CLI Tools)
|
|
258
|
+
|
|
259
|
+
AbstractCore includes **three specialized command-line applications** for common LLM tasks. These are production-ready tools that can be used directly from the terminal without any Python programming.
|
|
260
|
+
|
|
261
|
+
### Available Applications
|
|
262
|
+
|
|
263
|
+
| Application | Purpose | Direct Command |
|
|
264
|
+
|-------------|---------|----------------|
|
|
265
|
+
| **Summarizer** | Document summarization | `summarizer` |
|
|
266
|
+
| **Extractor** | Entity and relationship extraction | `extractor` |
|
|
267
|
+
| **Judge** | Text evaluation and scoring | `judge` |
|
|
268
|
+
|
|
269
|
+
### Quick Usage Examples
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# Document summarization with different styles and lengths
|
|
273
|
+
summarizer document.pdf --style executive --length brief
|
|
274
|
+
summarizer report.txt --focus "technical details" --output summary.txt
|
|
275
|
+
summarizer large_doc.txt --chunk-size 15000 --provider openai --model gpt-4o-mini
|
|
276
|
+
|
|
277
|
+
# Entity extraction with various formats and options
|
|
278
|
+
extractor research_paper.pdf --format json-ld --focus technology
|
|
279
|
+
extractor article.txt --entity-types person,organization,location --output entities.jsonld
|
|
280
|
+
extractor doc.txt --iterate 3 --mode thorough --verbose
|
|
281
|
+
|
|
282
|
+
# Text evaluation with custom criteria and contexts
|
|
283
|
+
judge essay.txt --criteria clarity,accuracy,coherence --context "academic writing"
|
|
284
|
+
judge code.py --context "code review" --format plain --verbose
|
|
285
|
+
judge proposal.md --custom-criteria has_examples,covers_risks --output assessment.json
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Installation & Setup
|
|
289
|
+
|
|
290
|
+
Apps are automatically available after installing AbstractCore:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Install with all features
|
|
294
|
+
pip install abstractcore[all]
|
|
295
|
+
|
|
296
|
+
# Apps are immediately available
|
|
297
|
+
summarizer --help
|
|
298
|
+
extractor --help
|
|
299
|
+
judge --help
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Alternative Usage Methods
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
# Method 1: Direct commands (recommended)
|
|
306
|
+
summarizer document.txt
|
|
307
|
+
extractor report.pdf
|
|
308
|
+
judge essay.md
|
|
309
|
+
|
|
310
|
+
# Method 2: Via Python module
|
|
311
|
+
python -m abstractllm.apps summarizer document.txt
|
|
312
|
+
python -m abstractllm.apps extractor report.pdf
|
|
313
|
+
python -m abstractllm.apps judge essay.md
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Key Parameters
|
|
317
|
+
|
|
318
|
+
**Common Parameters (all apps):**
|
|
319
|
+
- `--provider` + `--model` - Use different LLM providers (OpenAI, Anthropic, Ollama, etc.)
|
|
320
|
+
- `--output` - Save results to file instead of console
|
|
321
|
+
- `--verbose` - Show detailed progress information
|
|
322
|
+
- `--timeout` - HTTP timeout for LLM requests (default: 300s)
|
|
323
|
+
|
|
324
|
+
**Summarizer Parameters:**
|
|
325
|
+
- `--style` - Summary style: `structured`, `narrative`, `objective`, `analytical`, `executive`, `conversational`
|
|
326
|
+
- `--length` - Summary length: `brief`, `standard`, `detailed`, `comprehensive`
|
|
327
|
+
- `--focus` - Specific focus area for summarization
|
|
328
|
+
- `--chunk-size` - Chunk size for large documents (1000-32000, default: 8000)
|
|
329
|
+
|
|
330
|
+
**Extractor Parameters:**
|
|
331
|
+
- `--format` - Output format: `json-ld`, `triples`, `json`, `yaml`
|
|
332
|
+
- `--entity-types` - Focus on specific entities: `person,organization,location,technology,etc.`
|
|
333
|
+
- `--mode` - Extraction mode: `fast`, `balanced`, `thorough`
|
|
334
|
+
- `--iterate` - Number of refinement iterations (1-10, default: 1)
|
|
335
|
+
- `--minified` - Output compact JSON without indentation
|
|
336
|
+
|
|
337
|
+
**Judge Parameters:**
|
|
338
|
+
- `--context` - Evaluation context (e.g., "code review", "academic writing")
|
|
339
|
+
- `--criteria` - Standard criteria: `clarity,soundness,effectiveness,etc.`
|
|
340
|
+
- `--custom-criteria` - Custom evaluation criteria
|
|
341
|
+
- `--format` - Output format: `json`, `plain`, `yaml`
|
|
342
|
+
- `--include-criteria` - Include detailed criteria explanations
|
|
343
|
+
|
|
344
|
+
### Key Features
|
|
345
|
+
|
|
346
|
+
- **Provider Agnostic**: Works with any configured LLM provider (OpenAI, Anthropic, Ollama, etc.)
|
|
347
|
+
- **Multiple Formats**: Support for PDF, TXT, MD, DOCX, and more
|
|
348
|
+
- **Flexible Output**: JSON, JSON-LD, YAML, plain text formats
|
|
349
|
+
- **Batch Processing**: Process multiple files at once
|
|
350
|
+
- **Configurable**: Custom prompts, criteria, and evaluation rubrics
|
|
351
|
+
- **Production Ready**: Robust error handling and logging
|
|
352
|
+
|
|
353
|
+
### Full Documentation
|
|
354
|
+
|
|
355
|
+
Each application has comprehensive documentation with examples and advanced usage:
|
|
356
|
+
|
|
357
|
+
- **[Summarizer Guide](docs/apps/basic-summarizer.md)** - Document summarization with multiple strategies
|
|
358
|
+
- **[Extractor Guide](docs/apps/basic-extractor.md)** - Entity and relationship extraction
|
|
359
|
+
- **[Judge Guide](docs/apps/basic-judge.md)** - Text evaluation and scoring systems
|
|
360
|
+
|
|
361
|
+
**When to use the apps:**
|
|
362
|
+
- Processing documents without writing code
|
|
363
|
+
- Batch text analysis workflows
|
|
364
|
+
- Quick prototyping of text processing pipelines
|
|
365
|
+
- Integration with shell scripts and automation
|
|
366
|
+
- Standardized text processing tasks
|
|
367
|
+
|
|
257
368
|
## Documentation
|
|
258
369
|
|
|
259
370
|
**📚 Complete Documentation:** [docs/](docs/) - Full documentation index and navigation guide
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
abstractcore-2.3.
|
|
2
|
-
abstractllm/__init__.py,sha256=
|
|
1
|
+
abstractcore-2.3.7.dist-info/licenses/LICENSE,sha256=PI2v_4HMvd6050uDD_4AY_8PzBnu2asa3RKbdDjowTA,1078
|
|
2
|
+
abstractllm/__init__.py,sha256=UWHXV-OyMpDeBsCFfLTTgVqkFTrj-uQWVqgFtkfjtxU,1859
|
|
3
3
|
abstractllm/apps/__init__.py,sha256=H6fOR28gyBW8bDCEAft2RUZhNmRYA_7fF91szKBjhpA,30
|
|
4
|
-
abstractllm/apps/__main__.py,sha256=
|
|
5
|
-
abstractllm/apps/extractor.py,sha256=
|
|
6
|
-
abstractllm/apps/judge.py,sha256=
|
|
7
|
-
abstractllm/apps/summarizer.py,sha256=
|
|
4
|
+
abstractllm/apps/__main__.py,sha256=YyAHo-0O4yAJ5JeinsioIM6Ytam2i4eq6UQt2oWB2s0,1579
|
|
5
|
+
abstractllm/apps/extractor.py,sha256=T_9-GTMkTbswa2m3E294IO1eGiedNAWi0dK1xgdm0WE,23491
|
|
6
|
+
abstractllm/apps/judge.py,sha256=gQBpwXLVLIyQxTwHblIPbNWRk6IGsRqkWq2dgj2vO1s,23278
|
|
7
|
+
abstractllm/apps/summarizer.py,sha256=zf3MCJu5mwkOLhTxo41lHuc-462YkUYcFDB5pQu8Uv4,13786
|
|
8
8
|
abstractllm/architectures/__init__.py,sha256=-4JucAM7JkMWShWKkePoclxrUHRKgaG36UTguJihE0U,1046
|
|
9
9
|
abstractllm/architectures/detection.py,sha256=PYYzJ73tXI5ssJOpEL6-mHBmTreYXIq5f4nsfqtrpmw,9465
|
|
10
10
|
abstractllm/architectures/enums.py,sha256=9vIv2vDBEKhxwzwH9iaSAyf-iVj3p8y9loMeN_mYTJ8,3821
|
|
@@ -14,47 +14,49 @@ abstractllm/assets/session_schema.json,sha256=b6HTAWxRVlVhAzA7FqaKpunK1yO6jilBOs
|
|
|
14
14
|
abstractllm/core/__init__.py,sha256=cdAYflvOMUFfiQDV7l972TN95zVXVkr5SixsZ6bNNEw,682
|
|
15
15
|
abstractllm/core/enums.py,sha256=zXDTnMvPPhN3DSqUqg09f-HxTqDbVYn9FGOT-n5LwzA,694
|
|
16
16
|
abstractllm/core/factory.py,sha256=1MSBTqm_sq0PaRqQC4L-U2OzPBkqaKEfg1rjO2uXukc,5234
|
|
17
|
-
abstractllm/core/interface.py,sha256=
|
|
17
|
+
abstractllm/core/interface.py,sha256=1YuCu7Q1MYVvQ_1wM1A5cQvhoB82fZku0p5ZapX9DYM,13690
|
|
18
18
|
abstractllm/core/retry.py,sha256=2vTeUQa2_IaMksyHjXWdLvVXXrgPZjXsv2LvANKHd94,14542
|
|
19
|
-
abstractllm/core/session.py,sha256=
|
|
19
|
+
abstractllm/core/session.py,sha256=B7gbzLhISOlrO0A_V9m1W3PojqNE6kupii8Es7T-1HE,35194
|
|
20
20
|
abstractllm/core/types.py,sha256=d8Nph272ZdSxg2RqeUgAdefaE5ruRNdGOs0DgM4i1rc,3641
|
|
21
21
|
abstractllm/embeddings/__init__.py,sha256=EES0BQht_zBgxCp5fnBYVLWN2i-YxZQcD2Dyit1varo,641
|
|
22
|
-
abstractllm/embeddings/manager.py,sha256=
|
|
22
|
+
abstractllm/embeddings/manager.py,sha256=YCW1r7ldd_mZshRjWNiNLIyhZktFl1SIiwgDDf41ve4,50043
|
|
23
23
|
abstractllm/embeddings/models.py,sha256=bsPAzL6gv57AVii8O15PT0kxfwRkOml3f3njJN4UDi4,4874
|
|
24
24
|
abstractllm/events/__init__.py,sha256=Z7WIDjerS3G6zjcjiRH3tHIbKdFNzlWnibHMNxkWWzo,11064
|
|
25
25
|
abstractllm/processing/__init__.py,sha256=t6hiakQjcZROT4pw9ZFt2q6fF3vf5VpdMKG2EWlsFd8,540
|
|
26
|
-
abstractllm/processing/basic_extractor.py,sha256=
|
|
27
|
-
abstractllm/processing/basic_judge.py,sha256=
|
|
28
|
-
abstractllm/processing/basic_summarizer.py,sha256=
|
|
26
|
+
abstractllm/processing/basic_extractor.py,sha256=geB9_bqH9Z3hcKq7SheHtsqv0sgitolyMo-SPGgR2Cc,49673
|
|
27
|
+
abstractllm/processing/basic_judge.py,sha256=pHfTSYRjNZq4N3BdpST-hpHgUu6PJFgkeuRo9bK-fiw,31879
|
|
28
|
+
abstractllm/processing/basic_summarizer.py,sha256=P-tkTm0qMDLudQrctAAf1MYqZIa-hvDRZRg8isaVg1U,25334
|
|
29
29
|
abstractllm/providers/__init__.py,sha256=UTpR2Bf_ICFG7M--1kxUmNXs4gl026Tp-KI9zJlvMKU,574
|
|
30
30
|
abstractllm/providers/anthropic_provider.py,sha256=BM8Vu89c974yicvFwlsJ5C3N0wR9Kkt1pOszViWCwAQ,19694
|
|
31
31
|
abstractllm/providers/base.py,sha256=rDxd5XglfZuZNj94iwjWc3ItPSddMQ92Y2G624mb60M,42780
|
|
32
32
|
abstractllm/providers/huggingface_provider.py,sha256=4u3-Z4txonlKXE3DazvgUbxtzVfmdk-ZHsKPSaIfwD4,40785
|
|
33
33
|
abstractllm/providers/lmstudio_provider.py,sha256=HcMltGyiXrLb2acA_XE4wDi1d-X2VZiT3eV1IjMF150,15701
|
|
34
|
-
abstractllm/providers/mlx_provider.py,sha256=
|
|
35
|
-
abstractllm/providers/mock_provider.py,sha256=
|
|
36
|
-
abstractllm/providers/ollama_provider.py,sha256=
|
|
34
|
+
abstractllm/providers/mlx_provider.py,sha256=qusbTNvwWB8ydKVwv0adCLpMLFVT2RvX4LYHW-jUxlQ,14166
|
|
35
|
+
abstractllm/providers/mock_provider.py,sha256=qORJxy_Yk0X970GiQG4JfU-T2IUx6C_PNASKM-M7ya8,4597
|
|
36
|
+
abstractllm/providers/ollama_provider.py,sha256=SkXD5gjuzeu9Thqnt4pRPSi-cjWxwuZGV2x5YMm26jo,19340
|
|
37
37
|
abstractllm/providers/openai_provider.py,sha256=xGFrSkbCrsBnWnho1U2aMCBdzfCqf121wU1EFGmU3YQ,21678
|
|
38
38
|
abstractllm/providers/streaming.py,sha256=KQUH1DB-7UvuZP0_Wrcajj1P-9jdqnQfpIEeSYkxVFU,31153
|
|
39
39
|
abstractllm/server/__init__.py,sha256=1DSAz_YhQtnKv7sNi5TMQV8GFujctDOabgvAdilQE0o,249
|
|
40
|
-
abstractllm/server/app.py,sha256=
|
|
40
|
+
abstractllm/server/app.py,sha256=lz6ys1rd2AmsQarwkcOxpLsYQ5xKsp0iskTiYKIC92s,44495
|
|
41
41
|
abstractllm/structured/__init__.py,sha256=hvlV-59u7h7wjavi50C4Fn_Z4UbEsvuF_NG-DruWUxA,338
|
|
42
|
-
abstractllm/structured/handler.py,sha256=
|
|
42
|
+
abstractllm/structured/handler.py,sha256=Vb15smiR81JGDXX2RLkY2Exuj67J7a6C-xwVrZoXp0I,17134
|
|
43
43
|
abstractllm/structured/retry.py,sha256=BN_PvrWybyU1clMy2cult1-TVxFSMaVqiCPmmXvA5aI,3805
|
|
44
44
|
abstractllm/tools/__init__.py,sha256=ZTC8V5tSR5ZXbaQdDh4JzTf-jokknazWOYFjrp1NpGw,2257
|
|
45
|
-
abstractllm/tools/common_tools.py,sha256=
|
|
45
|
+
abstractllm/tools/common_tools.py,sha256=DfscdezYFdRiCVrFBwrcJxEaNJWA8aT-KEcuDq6W10I,64111
|
|
46
46
|
abstractllm/tools/core.py,sha256=lUUGihyceiRYlKUFvEMig9jWFF563d574mSDbYYD3fM,4777
|
|
47
47
|
abstractllm/tools/handler.py,sha256=GmDenXAJkhceWSGlhvuF90aMb2301tRTh6WxGwBQifc,12022
|
|
48
48
|
abstractllm/tools/parser.py,sha256=1r5nmEEp1Rid3JU6ct-s3lP-eCln67fvXG5HCjqiRew,27740
|
|
49
49
|
abstractllm/tools/registry.py,sha256=cN3nbPEK6L2vAd9740MIFf2fitW_4WHpQfK4KvQjnT0,9059
|
|
50
50
|
abstractllm/tools/syntax_rewriter.py,sha256=c3NSTvUF3S3ho5Cwjp7GJJdibeYAI6k3iaBwhKcpTfo,17318
|
|
51
51
|
abstractllm/tools/tag_rewriter.py,sha256=UGFMBj2QKwm12j8JQ6oc2C_N3ZeNqz9Enz4VkEIrS0c,20338
|
|
52
|
-
abstractllm/utils/__init__.py,sha256=
|
|
53
|
-
abstractllm/utils/cli.py,sha256=
|
|
52
|
+
abstractllm/utils/__init__.py,sha256=M1wyIf6XuqjdPySkODU5M35b8UiIiFbfnZiq5pKAqEc,538
|
|
53
|
+
abstractllm/utils/cli.py,sha256=PcA5AKvAr3bADT9x9OytfE4MDUVh48q8DcbIu9CLkj8,56875
|
|
54
54
|
abstractllm/utils/self_fixes.py,sha256=QEDwNTW80iQM4ftfEY3Ghz69F018oKwLM9yeRCYZOvw,5886
|
|
55
55
|
abstractllm/utils/structured_logging.py,sha256=2_bbMRjOvf0gHsRejncel_-PrhYUsOUySX_eaPcQopc,15827
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
abstractcore-2.3.
|
|
59
|
-
abstractcore-2.3.
|
|
60
|
-
abstractcore-2.3.
|
|
56
|
+
abstractllm/utils/token_utils.py,sha256=wAZpqiPh4eL8ppl1lNjqTzxCmlvdJ1Xu62UJyaDq09Y,21096
|
|
57
|
+
abstractllm/utils/version.py,sha256=QyoMwQlCZK5rKvZLjbmcREXZU6Z8CC4a29TpUO4do04,1386
|
|
58
|
+
abstractcore-2.3.7.dist-info/METADATA,sha256=lcnxke_jx-tKffNdv6UM5r45KRHN-YWt9Uos3Zu1gpc,19399
|
|
59
|
+
abstractcore-2.3.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
60
|
+
abstractcore-2.3.7.dist-info/entry_points.txt,sha256=plz04HNXbCbQkmEQj_8xKWW8x7zBxus68HD_04-IARM,306
|
|
61
|
+
abstractcore-2.3.7.dist-info/top_level.txt,sha256=Md-8odCjB7hTNnE5hucnifAoLrL9HvRPffZmCq2jpoI,12
|
|
62
|
+
abstractcore-2.3.7.dist-info/RECORD,,
|
abstractllm/__init__.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
1
2
|
"""
|
|
2
3
|
AbstractLLM - Unified interface to all LLM providers with essential infrastructure.
|
|
3
4
|
|
|
@@ -24,7 +25,7 @@ Quick Start:
|
|
|
24
25
|
print(response.content)
|
|
25
26
|
"""
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
from .utils.version import __version__
|
|
28
29
|
|
|
29
30
|
from .core.factory import create_llm
|
|
30
31
|
from .core.session import BasicSession
|
|
@@ -39,7 +40,7 @@ try:
|
|
|
39
40
|
except ImportError:
|
|
40
41
|
_has_embeddings = False
|
|
41
42
|
|
|
42
|
-
# Processing module (core functionality
|
|
43
|
+
# Processing module (core functionality)
|
|
43
44
|
from .processing import BasicSummarizer, SummaryStyle, SummaryLength, BasicExtractor
|
|
44
45
|
_has_processing = True
|
|
45
46
|
|
|
@@ -59,5 +60,5 @@ __all__ = [
|
|
|
59
60
|
if _has_embeddings:
|
|
60
61
|
__all__.append('EmbeddingManager')
|
|
61
62
|
|
|
62
|
-
# Processing is
|
|
63
|
+
# Processing is core functionality
|
|
63
64
|
__all__.extend(['BasicSummarizer', 'SummaryStyle', 'SummaryLength', 'BasicExtractor'])
|
abstractllm/apps/__main__.py
CHANGED
|
@@ -8,10 +8,12 @@ Usage:
|
|
|
8
8
|
Available apps:
|
|
9
9
|
summarizer - Document summarization tool
|
|
10
10
|
extractor - Entity and relationship extraction tool
|
|
11
|
+
judge - Text evaluation and scoring tool
|
|
11
12
|
|
|
12
13
|
Examples:
|
|
13
14
|
python -m abstractllm.apps summarizer document.txt
|
|
14
15
|
python -m abstractllm.apps extractor report.txt --format json-ld
|
|
16
|
+
python -m abstractllm.apps judge essay.txt --criteria clarity,accuracy
|
|
15
17
|
python -m abstractllm.apps <app> --help
|
|
16
18
|
"""
|
|
17
19
|
|
|
@@ -36,9 +38,14 @@ def main():
|
|
|
36
38
|
sys.argv = [sys.argv[0]] + sys.argv[2:]
|
|
37
39
|
from .extractor import main as extractor_main
|
|
38
40
|
extractor_main()
|
|
41
|
+
elif app_name == "judge":
|
|
42
|
+
# Remove the app name from sys.argv and run judge
|
|
43
|
+
sys.argv = [sys.argv[0]] + sys.argv[2:]
|
|
44
|
+
from .judge import main as judge_main
|
|
45
|
+
judge_main()
|
|
39
46
|
else:
|
|
40
47
|
print(f"Unknown app: {app_name}")
|
|
41
|
-
print("\nAvailable apps: summarizer, extractor")
|
|
48
|
+
print("\nAvailable apps: summarizer, extractor, judge")
|
|
42
49
|
sys.exit(1)
|
|
43
50
|
|
|
44
51
|
if __name__ == "__main__":
|
abstractllm/apps/extractor.py
CHANGED
|
@@ -6,31 +6,33 @@ Usage:
|
|
|
6
6
|
python -m abstractllm.apps.extractor <file_path> [options]
|
|
7
7
|
|
|
8
8
|
Options:
|
|
9
|
-
--focus
|
|
10
|
-
--style
|
|
11
|
-
--length
|
|
12
|
-
--entity-types
|
|
13
|
-
--similarity-threshold
|
|
14
|
-
--format
|
|
15
|
-
--output
|
|
16
|
-
--chunk-size
|
|
17
|
-
--provider
|
|
18
|
-
--model
|
|
19
|
-
--no-embeddings
|
|
20
|
-
--fast
|
|
21
|
-
--iterate
|
|
22
|
-
--minified
|
|
23
|
-
--verbose
|
|
24
|
-
--timeout
|
|
25
|
-
--
|
|
9
|
+
--focus <focus> Specific focus area for extraction (e.g., "technology", "business", "medical")
|
|
10
|
+
--style <style> Extraction style (structured, focused, minimal, comprehensive, default: structured)
|
|
11
|
+
--length <length> Extraction depth (brief, standard, detailed, comprehensive, default: standard)
|
|
12
|
+
--entity-types <types> Comma-separated entity types to focus on (person,organization,location,etc.)
|
|
13
|
+
--similarity-threshold <t> Similarity threshold for entity deduplication (0.0-1.0, default: 0.85)
|
|
14
|
+
--format <format> Output format (json-ld, json, yaml, triples, default: json-ld)
|
|
15
|
+
--output <output> Output file path (optional, prints to console if not provided)
|
|
16
|
+
--chunk-size <size> Chunk size in characters (default: 6000, max: 32000)
|
|
17
|
+
--provider <provider> LLM provider (requires --model)
|
|
18
|
+
--model <model> LLM model (requires --provider)
|
|
19
|
+
--no-embeddings Disable semantic entity deduplication
|
|
20
|
+
--fast Use fast extraction (skip verification, larger chunks, no embeddings)
|
|
21
|
+
--iterate <number> Number of refinement iterations (default: 1, finds missing entities and verifies relationships)
|
|
22
|
+
--minified Output minified JSON-LD (compact, no indentation)
|
|
23
|
+
--verbose Show detailed progress information
|
|
24
|
+
--timeout <seconds> HTTP timeout for LLM providers (default: 300, increase for large models)
|
|
25
|
+
--max-tokens <tokens> Maximum total tokens for LLM context (default: 32000)
|
|
26
|
+
--max-output-tokens <tokens> Maximum tokens for LLM output generation (default: 8000)
|
|
27
|
+
--help Show this help message
|
|
26
28
|
|
|
27
29
|
Examples:
|
|
28
30
|
python -m abstractllm.apps.extractor document.pdf
|
|
29
|
-
python -m abstractllm.apps.extractor report.txt --focus
|
|
30
|
-
python -m abstractllm.apps.extractor data.md --entity-types
|
|
31
|
+
python -m abstractllm.apps.extractor report.txt --focus technology --style structured --verbose
|
|
32
|
+
python -m abstractllm.apps.extractor data.md --entity-types person,organization --output kg.jsonld
|
|
31
33
|
python -m abstractllm.apps.extractor large.txt --fast --minified --verbose # Fast, compact output
|
|
32
|
-
python -m abstractllm.apps.extractor report.txt --length
|
|
33
|
-
python -m abstractllm.apps.extractor doc.txt --iterate
|
|
34
|
+
python -m abstractllm.apps.extractor report.txt --length detailed --provider openai --model gpt-4o-mini
|
|
35
|
+
python -m abstractllm.apps.extractor doc.txt --iterate 3 --verbose # 3 refinement passes for higher quality
|
|
34
36
|
"""
|
|
35
37
|
|
|
36
38
|
import argparse
|
|
@@ -239,8 +241,8 @@ Default model setup:
|
|
|
239
241
|
parser.add_argument(
|
|
240
242
|
'--chunk-size',
|
|
241
243
|
type=int,
|
|
242
|
-
default=
|
|
243
|
-
help='Chunk size in characters (default:
|
|
244
|
+
default=8000,
|
|
245
|
+
help='Chunk size in characters (default: 8000, max: 32000)'
|
|
244
246
|
)
|
|
245
247
|
|
|
246
248
|
parser.add_argument(
|
|
@@ -294,10 +296,24 @@ Default model setup:
|
|
|
294
296
|
parser.add_argument(
|
|
295
297
|
'--timeout',
|
|
296
298
|
type=float,
|
|
297
|
-
default=
|
|
299
|
+
default=600.0,
|
|
298
300
|
help='HTTP request timeout in seconds for LLM providers (default: 300, i.e., 5 minutes). Increase for large models like 36B+ parameters'
|
|
299
301
|
)
|
|
300
302
|
|
|
303
|
+
parser.add_argument(
|
|
304
|
+
'--max-tokens',
|
|
305
|
+
type=int,
|
|
306
|
+
default=32000,
|
|
307
|
+
help='Maximum total tokens for LLM context (default: 32000)'
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
parser.add_argument(
|
|
311
|
+
'--max-output-tokens',
|
|
312
|
+
type=int,
|
|
313
|
+
default=8000,
|
|
314
|
+
help='Maximum tokens for LLM output generation (default: 8000)'
|
|
315
|
+
)
|
|
316
|
+
|
|
301
317
|
# Parse arguments
|
|
302
318
|
args = parser.parse_args()
|
|
303
319
|
|
|
@@ -397,24 +413,28 @@ Default model setup:
|
|
|
397
413
|
max_output_tokens = 8000
|
|
398
414
|
|
|
399
415
|
if args.verbose:
|
|
400
|
-
print(f"Initializing BasicExtractor (mode: {extraction_mode}, {args.provider}, {args.model}, {max_tokens} token context, {max_output_tokens} output tokens)...")
|
|
416
|
+
print(f"Initializing BasicExtractor (mode: {extraction_mode}, {args.provider}, {args.model}, {args.max_tokens} token context, {args.max_output_tokens} output tokens)...")
|
|
401
417
|
if adjusted_chunk_size != args.chunk_size:
|
|
402
418
|
print(f"Adjusted chunk size from {args.chunk_size} to {adjusted_chunk_size} characters for {args.provider} compatibility")
|
|
403
419
|
|
|
404
|
-
llm = create_llm(args.provider, model=args.model, max_tokens=max_tokens, max_output_tokens=max_output_tokens, timeout=args.timeout)
|
|
420
|
+
llm = create_llm(args.provider, model=args.model, max_tokens=args.max_tokens, max_output_tokens=args.max_output_tokens, timeout=args.timeout)
|
|
405
421
|
|
|
406
422
|
extractor = BasicExtractor(
|
|
407
423
|
llm=llm,
|
|
408
|
-
max_chunk_size=adjusted_chunk_size
|
|
424
|
+
max_chunk_size=adjusted_chunk_size,
|
|
425
|
+
max_tokens=args.max_tokens,
|
|
426
|
+
max_output_tokens=args.max_output_tokens
|
|
409
427
|
)
|
|
410
428
|
else:
|
|
411
429
|
# Default configuration
|
|
412
430
|
if args.verbose:
|
|
413
|
-
print(f"Initializing BasicExtractor (mode: {extraction_mode}, ollama, qwen3:4b-instruct-2507-q4_K_M,
|
|
431
|
+
print(f"Initializing BasicExtractor (mode: {extraction_mode}, ollama, qwen3:4b-instruct-2507-q4_K_M, {args.max_tokens} token context, {args.max_output_tokens} output tokens)...")
|
|
414
432
|
|
|
415
433
|
try:
|
|
416
434
|
extractor = BasicExtractor(
|
|
417
|
-
max_chunk_size=args.chunk_size
|
|
435
|
+
max_chunk_size=args.chunk_size,
|
|
436
|
+
max_tokens=args.max_tokens,
|
|
437
|
+
max_output_tokens=args.max_output_tokens
|
|
418
438
|
)
|
|
419
439
|
except RuntimeError as e:
|
|
420
440
|
# Handle default model not available
|
abstractllm/apps/judge.py
CHANGED
|
@@ -6,34 +6,37 @@ Usage:
|
|
|
6
6
|
python -m abstractllm.apps.judge <file_path_or_text> [file2] [file3] ... [options]
|
|
7
7
|
|
|
8
8
|
Options:
|
|
9
|
-
--context
|
|
10
|
-
--criteria
|
|
11
|
-
--
|
|
12
|
-
--reference
|
|
13
|
-
--format
|
|
14
|
-
--output
|
|
15
|
-
--provider
|
|
16
|
-
--model
|
|
17
|
-
--temperature
|
|
18
|
-
--
|
|
19
|
-
--
|
|
20
|
-
--
|
|
21
|
-
--
|
|
9
|
+
--context <context> Evaluation context description (e.g., "code review", "documentation assessment")
|
|
10
|
+
--criteria <criteria> Comma-separated criteria to evaluate (clarity,simplicity,actionability,soundness,innovation,effectiveness,relevance,completeness,coherence)
|
|
11
|
+
--focus <focus> Specific focus areas for evaluation (e.g., "technical accuracy,performance,security")
|
|
12
|
+
--reference <file_or_text> Reference content for comparison-based evaluation
|
|
13
|
+
--format <format> Output format (json, yaml, plain, default: json)
|
|
14
|
+
--output <output> Output file path (optional, prints to console if not provided)
|
|
15
|
+
--provider <provider> LLM provider (requires --model)
|
|
16
|
+
--model <model> LLM model (requires --provider)
|
|
17
|
+
--temperature <temp> Temperature for evaluation (default: 0.1 for consistency)
|
|
18
|
+
--max-tokens <tokens> Maximum total tokens for LLM context (default: 32000)
|
|
19
|
+
--max-output-tokens <tokens> Maximum tokens for LLM output generation (default: 8000)
|
|
20
|
+
--verbose Show detailed progress information
|
|
21
|
+
--debug Show raw LLM responses and detailed debugging information
|
|
22
|
+
--include-criteria Include detailed explanation of evaluation criteria in assessment
|
|
23
|
+
--timeout <seconds> HTTP timeout for LLM providers (default: 300)
|
|
24
|
+
--help Show this help message
|
|
22
25
|
|
|
23
26
|
Examples:
|
|
24
27
|
# Single file or text
|
|
25
28
|
python -m abstractllm.apps.judge "This code is well-structured and solves the problem efficiently."
|
|
26
|
-
python -m abstractllm.apps.judge document.py --context
|
|
29
|
+
python -m abstractllm.apps.judge document.py --context "code review" --criteria clarity,soundness,effectiveness
|
|
27
30
|
|
|
28
31
|
# Multiple files (evaluated sequentially to avoid context overflow)
|
|
29
|
-
python -m abstractllm.apps.judge file1.py file2.py file3.py --context
|
|
30
|
-
python -m abstractllm.apps.judge *.py --context
|
|
31
|
-
python -m abstractllm.apps.judge docs/*.md --context
|
|
32
|
+
python -m abstractllm.apps.judge file1.py file2.py file3.py --context "code review" --output assessments.json
|
|
33
|
+
python -m abstractllm.apps.judge *.py --context "Python code review" --format plain
|
|
34
|
+
python -m abstractllm.apps.judge docs/*.md --context "documentation review" --criteria clarity,completeness
|
|
32
35
|
|
|
33
36
|
# Other options
|
|
34
|
-
python -m abstractllm.apps.judge proposal.md --
|
|
35
|
-
python -m abstractllm.apps.judge content.txt --reference
|
|
36
|
-
python -m abstractllm.apps.judge text.md --provider
|
|
37
|
+
python -m abstractllm.apps.judge proposal.md --focus "technical accuracy,completeness,examples" --output assessment.json
|
|
38
|
+
python -m abstractllm.apps.judge content.txt --reference ideal_solution.txt --format plain --verbose
|
|
39
|
+
python -m abstractllm.apps.judge text.md --provider openai --model gpt-4o-mini --temperature 0.05
|
|
37
40
|
"""
|
|
38
41
|
|
|
39
42
|
import argparse
|
|
@@ -253,16 +256,16 @@ def main():
|
|
|
253
256
|
Examples:
|
|
254
257
|
# Single file or text
|
|
255
258
|
python -m abstractllm.apps.judge "This code is well-structured."
|
|
256
|
-
python -m abstractllm.apps.judge document.py --context
|
|
257
|
-
python -m abstractllm.apps.judge proposal.md --
|
|
259
|
+
python -m abstractllm.apps.judge document.py --context "code review" --criteria clarity,soundness
|
|
260
|
+
python -m abstractllm.apps.judge proposal.md --focus "technical accuracy,examples" --output assessment.json
|
|
258
261
|
|
|
259
262
|
# Multiple files (evaluated sequentially)
|
|
260
|
-
python -m abstractllm.apps.judge file1.py file2.py file3.py --context
|
|
261
|
-
python -m abstractllm.apps.judge docs/*.md --context
|
|
263
|
+
python -m abstractllm.apps.judge file1.py file2.py file3.py --context "code review" --format json
|
|
264
|
+
python -m abstractllm.apps.judge docs/*.md --context "documentation review" --format plain
|
|
262
265
|
|
|
263
266
|
# Other options
|
|
264
|
-
python -m abstractllm.apps.judge content.txt --reference
|
|
265
|
-
python -m abstractllm.apps.judge text.md --provider
|
|
267
|
+
python -m abstractllm.apps.judge content.txt --reference ideal.txt --format plain --verbose
|
|
268
|
+
python -m abstractllm.apps.judge text.md --provider openai --model gpt-4o-mini
|
|
266
269
|
|
|
267
270
|
Available criteria:
|
|
268
271
|
clarity, simplicity, actionability, soundness, innovation, effectiveness,
|
|
@@ -297,8 +300,8 @@ Default model setup:
|
|
|
297
300
|
)
|
|
298
301
|
|
|
299
302
|
parser.add_argument(
|
|
300
|
-
'--
|
|
301
|
-
help='
|
|
303
|
+
'--focus',
|
|
304
|
+
help='Specific focus areas for evaluation (e.g., "technical accuracy,performance,security")'
|
|
302
305
|
)
|
|
303
306
|
|
|
304
307
|
parser.add_argument(
|
|
@@ -340,12 +343,32 @@ Default model setup:
|
|
|
340
343
|
help='Temperature for evaluation (default: 0.1 for consistency)'
|
|
341
344
|
)
|
|
342
345
|
|
|
346
|
+
parser.add_argument(
|
|
347
|
+
'--max-tokens',
|
|
348
|
+
type=int,
|
|
349
|
+
default=32000,
|
|
350
|
+
help='Maximum total tokens for LLM context (default: 32000)'
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
parser.add_argument(
|
|
354
|
+
'--max-output-tokens',
|
|
355
|
+
type=int,
|
|
356
|
+
default=8000,
|
|
357
|
+
help='Maximum tokens for LLM output generation (default: 8000)'
|
|
358
|
+
)
|
|
359
|
+
|
|
343
360
|
parser.add_argument(
|
|
344
361
|
'--verbose',
|
|
345
362
|
action='store_true',
|
|
346
363
|
help='Show detailed progress information'
|
|
347
364
|
)
|
|
348
365
|
|
|
366
|
+
parser.add_argument(
|
|
367
|
+
'--debug',
|
|
368
|
+
action='store_true',
|
|
369
|
+
help='Show raw LLM responses and detailed debugging information'
|
|
370
|
+
)
|
|
371
|
+
|
|
349
372
|
parser.add_argument(
|
|
350
373
|
'--include-criteria',
|
|
351
374
|
action='store_true',
|
|
@@ -421,26 +444,34 @@ Default model setup:
|
|
|
421
444
|
|
|
422
445
|
# Parse criteria
|
|
423
446
|
criteria_list = parse_criteria_list(args.criteria)
|
|
424
|
-
|
|
447
|
+
focus = args.focus
|
|
425
448
|
judgment_criteria = build_judgment_criteria(criteria_list)
|
|
426
449
|
|
|
427
450
|
# Initialize judge
|
|
428
451
|
if args.provider and args.model:
|
|
429
452
|
if args.verbose:
|
|
430
|
-
print(f"Initializing BasicJudge ({args.provider}, {args.model}, temperature={args.temperature})...")
|
|
453
|
+
print(f"Initializing BasicJudge ({args.provider}, {args.model}, temperature={args.temperature}, {args.max_tokens} token context, {args.max_output_tokens} output tokens)...")
|
|
431
454
|
|
|
432
455
|
judge = create_judge(
|
|
433
456
|
provider=args.provider,
|
|
434
457
|
model=args.model,
|
|
435
458
|
temperature=args.temperature,
|
|
459
|
+
max_tokens=args.max_tokens,
|
|
460
|
+
max_output_tokens=args.max_output_tokens,
|
|
461
|
+
debug=args.debug,
|
|
436
462
|
timeout=args.timeout
|
|
437
463
|
)
|
|
438
464
|
else:
|
|
439
465
|
if args.verbose:
|
|
440
|
-
print(f"Initializing BasicJudge (ollama, qwen3:4b-instruct-2507-q4_K_M, temperature={args.temperature})...")
|
|
466
|
+
print(f"Initializing BasicJudge (ollama, qwen3:4b-instruct-2507-q4_K_M, temperature={args.temperature}, {args.max_tokens} token context, {args.max_output_tokens} output tokens)...")
|
|
441
467
|
|
|
442
468
|
try:
|
|
443
|
-
judge = BasicJudge(
|
|
469
|
+
judge = BasicJudge(
|
|
470
|
+
temperature=args.temperature,
|
|
471
|
+
max_tokens=args.max_tokens,
|
|
472
|
+
max_output_tokens=args.max_output_tokens,
|
|
473
|
+
debug=args.debug
|
|
474
|
+
)
|
|
444
475
|
except RuntimeError as e:
|
|
445
476
|
print(f"\n{e}")
|
|
446
477
|
print("\n🚀 Quick alternatives to get started:")
|
|
@@ -467,7 +498,7 @@ Default model setup:
|
|
|
467
498
|
file_paths=single_input,
|
|
468
499
|
context=args.context,
|
|
469
500
|
criteria=judgment_criteria,
|
|
470
|
-
|
|
501
|
+
focus=focus,
|
|
471
502
|
reference=reference,
|
|
472
503
|
include_criteria=args.include_criteria,
|
|
473
504
|
exclude_global=args.exclude_global
|
|
@@ -478,7 +509,7 @@ Default model setup:
|
|
|
478
509
|
content=single_input,
|
|
479
510
|
context=args.context,
|
|
480
511
|
criteria=judgment_criteria,
|
|
481
|
-
|
|
512
|
+
focus=focus,
|
|
482
513
|
reference=reference,
|
|
483
514
|
include_criteria=args.include_criteria
|
|
484
515
|
)
|
|
@@ -488,7 +519,7 @@ Default model setup:
|
|
|
488
519
|
file_paths=file_or_text,
|
|
489
520
|
context=args.context,
|
|
490
521
|
criteria=judgment_criteria,
|
|
491
|
-
|
|
522
|
+
focus=focus,
|
|
492
523
|
reference=reference,
|
|
493
524
|
include_criteria=args.include_criteria,
|
|
494
525
|
exclude_global=args.exclude_global
|