abstractcore 2.3.9__tar.gz → 2.4.1__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.
- {abstractcore-2.3.9 → abstractcore-2.4.1}/PKG-INFO +20 -16
- {abstractcore-2.3.9 → abstractcore-2.4.1}/README.md +16 -12
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/__init__.py +2 -2
- abstractcore-2.4.1/abstractcore/apps/__init__.py +1 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/apps/__main__.py +6 -6
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/apps/extractor.py +16 -16
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/apps/judge.py +18 -18
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/apps/summarizer.py +11 -11
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/core/__init__.py +2 -2
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/core/enums.py +1 -1
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/core/factory.py +8 -8
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/core/interface.py +3 -3
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/core/retry.py +1 -1
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/core/session.py +6 -6
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/core/types.py +1 -1
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/embeddings/__init__.py +1 -1
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/embeddings/manager.py +5 -5
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/events/__init__.py +1 -1
- abstractcore-2.4.1/abstractcore/exceptions/__init__.py +125 -0
- abstractcore-2.4.1/abstractcore/media/__init__.py +151 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/processing/basic_extractor.py +5 -5
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/processing/basic_judge.py +5 -5
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/processing/basic_summarizer.py +7 -7
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/providers/base.py +4 -4
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/providers/huggingface_provider.py +1 -1
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/providers/streaming.py +8 -3
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/structured/__init__.py +1 -1
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/tools/__init__.py +2 -2
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/tools/common_tools.py +4 -4
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/utils/__init__.py +1 -1
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/utils/cli.py +13 -13
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/utils/structured_logging.py +3 -3
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/utils/token_utils.py +1 -1
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/utils/version.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/abstractcore.egg-info/PKG-INFO +20 -16
- {abstractcore-2.3.9 → abstractcore-2.4.1}/abstractcore.egg-info/SOURCES.txt +58 -56
- abstractcore-2.4.1/abstractcore.egg-info/entry_points.txt +7 -0
- {abstractcore-2.3.9 → abstractcore-2.4.1}/abstractcore.egg-info/requires.txt +1 -1
- abstractcore-2.4.1/abstractcore.egg-info/top_level.txt +1 -0
- {abstractcore-2.3.9 → abstractcore-2.4.1}/pyproject.toml +14 -14
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_agentic_cli_compatibility.py +4 -4
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_all_specified_providers.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_basic_session.py +3 -3
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_basic_summarizer.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_complete_integration.py +5 -5
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_comprehensive_events.py +5 -5
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_core_components.py +6 -6
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_critical_streaming_tool_fix.py +9 -9
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_embeddings.py +17 -17
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_embeddings_integration.py +3 -3
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_embeddings_llm_integration.py +5 -5
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_embeddings_matrix_operations.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_embeddings_no_mock.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_embeddings_real.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_embeddings_semantic_validation.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_embeddings_simple.py +3 -3
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_environment_variable_tool_call_tags.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_factory.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_final_comprehensive.py +7 -7
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_final_graceful_errors.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_graceful_fallback.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_integrated_functionality.py +6 -6
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_ollama_tool_role_fix.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_openai_conversion_manual.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_openai_format_bug.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_openai_format_conversion.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_progressive_complexity.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_provider_basic_session.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_provider_connectivity.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_provider_simple_generation.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_provider_streaming.py +3 -3
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_provider_token_translation.py +7 -7
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_provider_tool_detection.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_providers.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_providers_comprehensive.py +4 -4
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_providers_simple.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_real_models_comprehensive.py +6 -6
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_retry_observability.py +3 -3
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_retry_strategy.py +11 -11
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_server_embeddings_real.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_stream_tool_calling.py +2 -2
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_streaming_enhancements.py +4 -4
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_streaming_tag_rewriting.py +8 -8
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_structured_integration.py +5 -5
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_structured_output.py +5 -5
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_syntax_rewriter.py +12 -12
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_tool_calling.py +4 -4
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_tool_execution_separation.py +11 -11
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_unified_streaming.py +11 -11
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_unload_memory.py +1 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_user_scenario_validation.py +4 -4
- {abstractcore-2.3.9 → abstractcore-2.4.1}/tests/test_wrong_model_fallback.py +2 -2
- abstractcore-2.3.9/abstractcore.egg-info/entry_points.txt +0 -7
- abstractcore-2.3.9/abstractcore.egg-info/top_level.txt +0 -1
- abstractcore-2.3.9/abstractllm/apps/__init__.py +0 -1
- {abstractcore-2.3.9 → abstractcore-2.4.1}/LICENSE +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/architectures/__init__.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/architectures/detection.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/architectures/enums.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/assets/architecture_formats.json +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/assets/model_capabilities.json +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/assets/session_schema.json +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/embeddings/models.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/processing/__init__.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/providers/__init__.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/providers/anthropic_provider.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/providers/lmstudio_provider.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/providers/mlx_provider.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/providers/mock_provider.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/providers/ollama_provider.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/providers/openai_provider.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/server/__init__.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/server/app.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/structured/handler.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/structured/retry.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/tools/core.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/tools/handler.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/tools/parser.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/tools/registry.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/tools/syntax_rewriter.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/tools/tag_rewriter.py +0 -0
- {abstractcore-2.3.9/abstractllm → abstractcore-2.4.1/abstractcore}/utils/self_fixes.py +0 -0
- {abstractcore-2.3.9 → abstractcore-2.4.1}/abstractcore.egg-info/dependency_links.txt +0 -0
- {abstractcore-2.3.9 → abstractcore-2.4.1}/setup.cfg +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: abstractcore
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.1
|
|
4
4
|
Summary: Unified interface to all LLM providers with essential infrastructure for tool calling, streaming, and model management
|
|
5
|
-
Author: Laurent-Philippe Albou
|
|
6
|
-
Maintainer: Laurent-Philippe Albou
|
|
5
|
+
Author-email: Laurent-Philippe Albou <contact@abstractcore.ai>
|
|
6
|
+
Maintainer-email: Laurent-Philippe Albou <contact@abstractcore.ai>
|
|
7
7
|
License: MIT
|
|
8
8
|
Project-URL: Homepage, https://lpalbou.github.io/AbstractCore
|
|
9
9
|
Project-URL: Documentation, https://github.com/lpalbou/AbstractCore#readme
|
|
@@ -84,7 +84,7 @@ Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
|
84
84
|
Requires-Dist: mkdocstrings[python]>=0.22.0; extra == "docs"
|
|
85
85
|
Requires-Dist: mkdocs-autorefs>=0.4.0; extra == "docs"
|
|
86
86
|
Provides-Extra: full-dev
|
|
87
|
-
Requires-Dist:
|
|
87
|
+
Requires-Dist: abstractcore[all-providers,dev,docs,test]; extra == "full-dev"
|
|
88
88
|
Dynamic: license-file
|
|
89
89
|
|
|
90
90
|
# AbstractCore
|
|
@@ -104,7 +104,7 @@ pip install abstractcore[all]
|
|
|
104
104
|
### Basic Usage
|
|
105
105
|
|
|
106
106
|
```python
|
|
107
|
-
from
|
|
107
|
+
from abstractcore import create_llm
|
|
108
108
|
|
|
109
109
|
# Works with any provider - just change the provider name
|
|
110
110
|
llm = create_llm("anthropic", model="claude-3-5-haiku-latest")
|
|
@@ -115,7 +115,7 @@ print(response.content)
|
|
|
115
115
|
### Tool Calling
|
|
116
116
|
|
|
117
117
|
```python
|
|
118
|
-
from
|
|
118
|
+
from abstractcore import create_llm, tool
|
|
119
119
|
|
|
120
120
|
@tool
|
|
121
121
|
def get_current_weather(city: str):
|
|
@@ -133,7 +133,7 @@ print(response.content)
|
|
|
133
133
|
### Session Management
|
|
134
134
|
|
|
135
135
|
```python
|
|
136
|
-
from
|
|
136
|
+
from abstractcore import BasicSession, create_llm
|
|
137
137
|
|
|
138
138
|
# Create a persistent conversation session
|
|
139
139
|
llm = create_llm("openai", model="gpt-4o-mini")
|
|
@@ -183,7 +183,7 @@ AbstractCore is **primarily a Python library**. The server is an **optional comp
|
|
|
183
183
|
pip install abstractcore[server]
|
|
184
184
|
|
|
185
185
|
# Start the server
|
|
186
|
-
uvicorn
|
|
186
|
+
uvicorn abstractcore.server.app:app --host 0.0.0.0 --port 8000
|
|
187
187
|
```
|
|
188
188
|
|
|
189
189
|
Use with any OpenAI-compatible client:
|
|
@@ -218,13 +218,13 @@ AbstractCore includes a **built-in CLI** for interactive testing, development, a
|
|
|
218
218
|
|
|
219
219
|
```bash
|
|
220
220
|
# Start interactive CLI
|
|
221
|
-
python -m
|
|
221
|
+
python -m abstractcore.utils.cli --provider ollama --model qwen3-coder:30b
|
|
222
222
|
|
|
223
223
|
# With streaming enabled
|
|
224
|
-
python -m
|
|
224
|
+
python -m abstractcore.utils.cli --provider openai --model gpt-4o-mini --stream
|
|
225
225
|
|
|
226
226
|
# Single prompt execution
|
|
227
|
-
python -m
|
|
227
|
+
python -m abstractcore.utils.cli --provider anthropic --model claude-3-5-haiku-latest --prompt "What is Python?"
|
|
228
228
|
```
|
|
229
229
|
|
|
230
230
|
**Key Features:**
|
|
@@ -308,9 +308,9 @@ extractor report.pdf
|
|
|
308
308
|
judge essay.md
|
|
309
309
|
|
|
310
310
|
# Method 2: Via Python module
|
|
311
|
-
python -m
|
|
312
|
-
python -m
|
|
313
|
-
python -m
|
|
311
|
+
python -m abstractcore.apps summarizer document.txt
|
|
312
|
+
python -m abstractcore.apps extractor report.pdf
|
|
313
|
+
python -m abstractcore.apps judge essay.md
|
|
314
314
|
```
|
|
315
315
|
|
|
316
316
|
### Key Parameters
|
|
@@ -414,7 +414,7 @@ llm_prod = create_llm("openai", model="gpt-4o-mini")
|
|
|
414
414
|
### 3. Embeddings & RAG
|
|
415
415
|
|
|
416
416
|
```python
|
|
417
|
-
from
|
|
417
|
+
from abstractcore.embeddings import EmbeddingManager
|
|
418
418
|
|
|
419
419
|
# Create embeddings for semantic search
|
|
420
420
|
embedder = EmbeddingManager()
|
|
@@ -453,7 +453,7 @@ print(f"{review.title}: {review.rating}/5")
|
|
|
453
453
|
|
|
454
454
|
```bash
|
|
455
455
|
# Start server once
|
|
456
|
-
uvicorn
|
|
456
|
+
uvicorn abstractcore.server.app:app --port 8000
|
|
457
457
|
|
|
458
458
|
# Use with any OpenAI client
|
|
459
459
|
curl -X POST http://localhost:8000/v1/chat/completions \
|
|
@@ -530,3 +530,7 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
530
530
|
---
|
|
531
531
|
|
|
532
532
|
**AbstractCore** - One interface, all LLM providers. Focus on building, not managing API differences.
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
> **Migration Note**: This project was previously known as "AbstractLLM" and has been completely rebranded to "AbstractCore" as of version 2.4.0. See [CHANGELOG.md](CHANGELOG.md) for migration details.
|
|
@@ -15,7 +15,7 @@ pip install abstractcore[all]
|
|
|
15
15
|
### Basic Usage
|
|
16
16
|
|
|
17
17
|
```python
|
|
18
|
-
from
|
|
18
|
+
from abstractcore import create_llm
|
|
19
19
|
|
|
20
20
|
# Works with any provider - just change the provider name
|
|
21
21
|
llm = create_llm("anthropic", model="claude-3-5-haiku-latest")
|
|
@@ -26,7 +26,7 @@ print(response.content)
|
|
|
26
26
|
### Tool Calling
|
|
27
27
|
|
|
28
28
|
```python
|
|
29
|
-
from
|
|
29
|
+
from abstractcore import create_llm, tool
|
|
30
30
|
|
|
31
31
|
@tool
|
|
32
32
|
def get_current_weather(city: str):
|
|
@@ -44,7 +44,7 @@ print(response.content)
|
|
|
44
44
|
### Session Management
|
|
45
45
|
|
|
46
46
|
```python
|
|
47
|
-
from
|
|
47
|
+
from abstractcore import BasicSession, create_llm
|
|
48
48
|
|
|
49
49
|
# Create a persistent conversation session
|
|
50
50
|
llm = create_llm("openai", model="gpt-4o-mini")
|
|
@@ -94,7 +94,7 @@ AbstractCore is **primarily a Python library**. The server is an **optional comp
|
|
|
94
94
|
pip install abstractcore[server]
|
|
95
95
|
|
|
96
96
|
# Start the server
|
|
97
|
-
uvicorn
|
|
97
|
+
uvicorn abstractcore.server.app:app --host 0.0.0.0 --port 8000
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
Use with any OpenAI-compatible client:
|
|
@@ -129,13 +129,13 @@ AbstractCore includes a **built-in CLI** for interactive testing, development, a
|
|
|
129
129
|
|
|
130
130
|
```bash
|
|
131
131
|
# Start interactive CLI
|
|
132
|
-
python -m
|
|
132
|
+
python -m abstractcore.utils.cli --provider ollama --model qwen3-coder:30b
|
|
133
133
|
|
|
134
134
|
# With streaming enabled
|
|
135
|
-
python -m
|
|
135
|
+
python -m abstractcore.utils.cli --provider openai --model gpt-4o-mini --stream
|
|
136
136
|
|
|
137
137
|
# Single prompt execution
|
|
138
|
-
python -m
|
|
138
|
+
python -m abstractcore.utils.cli --provider anthropic --model claude-3-5-haiku-latest --prompt "What is Python?"
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
**Key Features:**
|
|
@@ -219,9 +219,9 @@ extractor report.pdf
|
|
|
219
219
|
judge essay.md
|
|
220
220
|
|
|
221
221
|
# Method 2: Via Python module
|
|
222
|
-
python -m
|
|
223
|
-
python -m
|
|
224
|
-
python -m
|
|
222
|
+
python -m abstractcore.apps summarizer document.txt
|
|
223
|
+
python -m abstractcore.apps extractor report.pdf
|
|
224
|
+
python -m abstractcore.apps judge essay.md
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
### Key Parameters
|
|
@@ -325,7 +325,7 @@ llm_prod = create_llm("openai", model="gpt-4o-mini")
|
|
|
325
325
|
### 3. Embeddings & RAG
|
|
326
326
|
|
|
327
327
|
```python
|
|
328
|
-
from
|
|
328
|
+
from abstractcore.embeddings import EmbeddingManager
|
|
329
329
|
|
|
330
330
|
# Create embeddings for semantic search
|
|
331
331
|
embedder = EmbeddingManager()
|
|
@@ -364,7 +364,7 @@ print(f"{review.title}: {review.rating}/5")
|
|
|
364
364
|
|
|
365
365
|
```bash
|
|
366
366
|
# Start server once
|
|
367
|
-
uvicorn
|
|
367
|
+
uvicorn abstractcore.server.app:app --port 8000
|
|
368
368
|
|
|
369
369
|
# Use with any OpenAI client
|
|
370
370
|
curl -X POST http://localhost:8000/v1/chat/completions \
|
|
@@ -441,3 +441,7 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
441
441
|
---
|
|
442
442
|
|
|
443
443
|
**AbstractCore** - One interface, all LLM providers. Focus on building, not managing API differences.
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
> **Migration Note**: This project was previously known as "AbstractLLM" and has been completely rebranded to "AbstractCore" as of version 2.4.0. See [CHANGELOG.md](CHANGELOG.md) for migration details.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
"""
|
|
3
|
-
|
|
3
|
+
AbstractCore - Unified interface to all LLM providers with essential infrastructure.
|
|
4
4
|
|
|
5
5
|
Key Features:
|
|
6
6
|
• Multi-provider support (OpenAI, Anthropic, Ollama, HuggingFace, MLX, LMStudio)
|
|
@@ -11,7 +11,7 @@ Key Features:
|
|
|
11
11
|
• Event system for observability
|
|
12
12
|
|
|
13
13
|
Quick Start:
|
|
14
|
-
from
|
|
14
|
+
from abstractcore import create_llm
|
|
15
15
|
|
|
16
16
|
# Unified token management across all providers
|
|
17
17
|
llm = create_llm(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# AbstractCore CLI Applications
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
|
|
3
|
+
AbstractCore Apps - Command-line interface launcher
|
|
4
4
|
|
|
5
5
|
Usage:
|
|
6
|
-
python -m
|
|
6
|
+
python -m abstractcore.apps <app_name> [options]
|
|
7
7
|
|
|
8
8
|
Available apps:
|
|
9
9
|
summarizer - Document summarization tool
|
|
@@ -11,10 +11,10 @@ Available apps:
|
|
|
11
11
|
judge - Text evaluation and scoring tool
|
|
12
12
|
|
|
13
13
|
Examples:
|
|
14
|
-
python -m
|
|
15
|
-
python -m
|
|
16
|
-
python -m
|
|
17
|
-
python -m
|
|
14
|
+
python -m abstractcore.apps summarizer document.txt
|
|
15
|
+
python -m abstractcore.apps extractor report.txt --format json-ld
|
|
16
|
+
python -m abstractcore.apps judge essay.txt --criteria clarity,accuracy
|
|
17
|
+
python -m abstractcore.apps <app> --help
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
20
|
import sys
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
|
|
3
|
+
AbstractCore Entity Extractor CLI Application
|
|
4
4
|
|
|
5
5
|
Usage:
|
|
6
|
-
python -m
|
|
6
|
+
python -m abstractcore.apps.extractor <file_path> [options]
|
|
7
7
|
|
|
8
8
|
Options:
|
|
9
9
|
--focus <focus> Specific focus area for extraction (e.g., "technology", "business", "medical")
|
|
@@ -27,12 +27,12 @@ Options:
|
|
|
27
27
|
--help Show this help message
|
|
28
28
|
|
|
29
29
|
Examples:
|
|
30
|
-
python -m
|
|
31
|
-
python -m
|
|
32
|
-
python -m
|
|
33
|
-
python -m
|
|
34
|
-
python -m
|
|
35
|
-
python -m
|
|
30
|
+
python -m abstractcore.apps.extractor document.pdf
|
|
31
|
+
python -m abstractcore.apps.extractor report.txt --focus technology --style structured --verbose
|
|
32
|
+
python -m abstractcore.apps.extractor data.md --entity-types person,organization --output kg.jsonld
|
|
33
|
+
python -m abstractcore.apps.extractor large.txt --fast --minified --verbose # Fast, compact output
|
|
34
|
+
python -m abstractcore.apps.extractor report.txt --length detailed --provider openai --model gpt-4o-mini
|
|
35
|
+
python -m abstractcore.apps.extractor doc.txt --iterate 3 --verbose # 3 refinement passes for higher quality
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
38
|
import argparse
|
|
@@ -155,17 +155,17 @@ def parse_extraction_length(length_str: Optional[str]) -> str:
|
|
|
155
155
|
def main():
|
|
156
156
|
"""Main CLI function"""
|
|
157
157
|
parser = argparse.ArgumentParser(
|
|
158
|
-
description="
|
|
158
|
+
description="AbstractCore Entity & Relationship Extractor - Default: qwen3:4b-instruct-2507-q4_K_M (requires Ollama)",
|
|
159
159
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
160
160
|
epilog="""
|
|
161
161
|
Examples:
|
|
162
|
-
python -m
|
|
163
|
-
python -m
|
|
164
|
-
python -m
|
|
165
|
-
python -m
|
|
166
|
-
python -m
|
|
167
|
-
python -m
|
|
168
|
-
python -m
|
|
162
|
+
python -m abstractcore.apps.extractor document.pdf
|
|
163
|
+
python -m abstractcore.apps.extractor report.txt --focus=technology --style=structured --verbose
|
|
164
|
+
python -m abstractcore.apps.extractor data.md --entity-types=person,organization --output=kg.jsonld
|
|
165
|
+
python -m abstractcore.apps.extractor large.txt --length=detailed --fast --minified --verbose
|
|
166
|
+
python -m abstractcore.apps.extractor doc.txt --iterate=3 --verbose # Iterative refinement for quality
|
|
167
|
+
python -m abstractcore.apps.extractor doc.txt --format=triples --verbose # RDF triples output
|
|
168
|
+
python -m abstractcore.apps.extractor doc.txt --format=triples --output=triples.txt # Simple triples
|
|
169
169
|
|
|
170
170
|
Supported file types: .txt, .md, .py, .js, .html, .json, .csv, and most text-based files
|
|
171
171
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
|
|
3
|
+
AbstractCore Basic Judge CLI Application
|
|
4
4
|
|
|
5
5
|
Usage:
|
|
6
|
-
python -m
|
|
6
|
+
python -m abstractcore.apps.judge <file_path_or_text> [file2] [file3] ... [options]
|
|
7
7
|
|
|
8
8
|
Options:
|
|
9
9
|
--context <context> Evaluation context description (e.g., "code review", "documentation assessment")
|
|
@@ -25,18 +25,18 @@ Options:
|
|
|
25
25
|
|
|
26
26
|
Examples:
|
|
27
27
|
# Single file or text
|
|
28
|
-
python -m
|
|
29
|
-
python -m
|
|
28
|
+
python -m abstractcore.apps.judge "This code is well-structured and solves the problem efficiently."
|
|
29
|
+
python -m abstractcore.apps.judge document.py --context "code review" --criteria clarity,soundness,effectiveness
|
|
30
30
|
|
|
31
31
|
# Multiple files (evaluated sequentially to avoid context overflow)
|
|
32
|
-
python -m
|
|
33
|
-
python -m
|
|
34
|
-
python -m
|
|
32
|
+
python -m abstractcore.apps.judge file1.py file2.py file3.py --context "code review" --output assessments.json
|
|
33
|
+
python -m abstractcore.apps.judge *.py --context "Python code review" --format plain
|
|
34
|
+
python -m abstractcore.apps.judge docs/*.md --context "documentation review" --criteria clarity,completeness
|
|
35
35
|
|
|
36
36
|
# Other options
|
|
37
|
-
python -m
|
|
38
|
-
python -m
|
|
39
|
-
python -m
|
|
37
|
+
python -m abstractcore.apps.judge proposal.md --focus "technical accuracy,completeness,examples" --output assessment.json
|
|
38
|
+
python -m abstractcore.apps.judge content.txt --reference ideal_solution.txt --format plain --verbose
|
|
39
|
+
python -m abstractcore.apps.judge text.md --provider openai --model gpt-4o-mini --temperature 0.05
|
|
40
40
|
"""
|
|
41
41
|
|
|
42
42
|
import argparse
|
|
@@ -250,22 +250,22 @@ def format_assessment_plain(assessment: dict) -> str:
|
|
|
250
250
|
def main():
|
|
251
251
|
"""Main CLI function"""
|
|
252
252
|
parser = argparse.ArgumentParser(
|
|
253
|
-
description="
|
|
253
|
+
description="AbstractCore Basic Judge - LLM-as-a-judge for objective evaluation (Default: qwen3:4b-instruct-2507-q4_K_M)",
|
|
254
254
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
255
255
|
epilog="""
|
|
256
256
|
Examples:
|
|
257
257
|
# Single file or text
|
|
258
|
-
python -m
|
|
259
|
-
python -m
|
|
260
|
-
python -m
|
|
258
|
+
python -m abstractcore.apps.judge "This code is well-structured."
|
|
259
|
+
python -m abstractcore.apps.judge document.py --context "code review" --criteria clarity,soundness
|
|
260
|
+
python -m abstractcore.apps.judge proposal.md --focus "technical accuracy,examples" --output assessment.json
|
|
261
261
|
|
|
262
262
|
# Multiple files (evaluated sequentially)
|
|
263
|
-
python -m
|
|
264
|
-
python -m
|
|
263
|
+
python -m abstractcore.apps.judge file1.py file2.py file3.py --context "code review" --format json
|
|
264
|
+
python -m abstractcore.apps.judge docs/*.md --context "documentation review" --format plain
|
|
265
265
|
|
|
266
266
|
# Other options
|
|
267
|
-
python -m
|
|
268
|
-
python -m
|
|
267
|
+
python -m abstractcore.apps.judge content.txt --reference ideal.txt --format plain --verbose
|
|
268
|
+
python -m abstractcore.apps.judge text.md --provider openai --model gpt-4o-mini
|
|
269
269
|
|
|
270
270
|
Available criteria:
|
|
271
271
|
clarity, simplicity, actionability, soundness, innovation, effectiveness,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
|
|
3
|
+
AbstractCore Summarizer CLI Application
|
|
4
4
|
|
|
5
5
|
Usage:
|
|
6
|
-
python -m
|
|
6
|
+
python -m abstractcore.apps.summarizer <file_path> [options]
|
|
7
7
|
|
|
8
8
|
Options:
|
|
9
9
|
--style <style> Summary style (structured, narrative, objective, analytical, executive, conversational)
|
|
@@ -19,10 +19,10 @@ Options:
|
|
|
19
19
|
--help Show this help message
|
|
20
20
|
|
|
21
21
|
Examples:
|
|
22
|
-
python -m
|
|
23
|
-
python -m
|
|
24
|
-
python -m
|
|
25
|
-
python -m
|
|
22
|
+
python -m abstractcore.apps.summarizer document.pdf
|
|
23
|
+
python -m abstractcore.apps.summarizer report.txt --style executive --length brief --verbose
|
|
24
|
+
python -m abstractcore.apps.summarizer data.md --focus "technical details" --output summary.txt
|
|
25
|
+
python -m abstractcore.apps.summarizer large.txt --chunk-size 15000 --provider openai --model gpt-4o-mini
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
import argparse
|
|
@@ -156,14 +156,14 @@ def format_summary_output(result) -> str:
|
|
|
156
156
|
def main():
|
|
157
157
|
"""Main CLI function"""
|
|
158
158
|
parser = argparse.ArgumentParser(
|
|
159
|
-
description="
|
|
159
|
+
description="AbstractCore Document Summarizer - Default: gemma3:1b-it-qat (requires Ollama)",
|
|
160
160
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
161
161
|
epilog="""
|
|
162
162
|
Examples:
|
|
163
|
-
python -m
|
|
164
|
-
python -m
|
|
165
|
-
python -m
|
|
166
|
-
python -m
|
|
163
|
+
python -m abstractcore.apps.summarizer document.pdf
|
|
164
|
+
python -m abstractcore.apps.summarizer report.txt --style executive --length brief --verbose
|
|
165
|
+
python -m abstractcore.apps.summarizer data.md --focus "technical details" --output summary.txt
|
|
166
|
+
python -m abstractcore.apps.summarizer large.txt --chunk-size 15000 --provider openai --model gpt-4o-mini
|
|
167
167
|
|
|
168
168
|
Supported file types: .txt, .md, .py, .js, .html, .json, .csv, and most text-based files
|
|
169
169
|
|
|
@@ -12,7 +12,7 @@ from .factory import create_llm
|
|
|
12
12
|
from .session import BasicSession
|
|
13
13
|
from .types import GenerateResponse, Message
|
|
14
14
|
from .enums import ModelParameter, ModelCapability, MessageRole
|
|
15
|
-
from .interface import
|
|
15
|
+
from .interface import AbstractCoreInterface
|
|
16
16
|
|
|
17
17
|
__all__ = [
|
|
18
18
|
'create_llm',
|
|
@@ -22,5 +22,5 @@ __all__ = [
|
|
|
22
22
|
'ModelParameter',
|
|
23
23
|
'ModelCapability',
|
|
24
24
|
'MessageRole',
|
|
25
|
-
'
|
|
25
|
+
'AbstractCoreInterface'
|
|
26
26
|
]
|
|
@@ -3,11 +3,11 @@ Factory for creating LLM providers.
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from typing import Optional
|
|
6
|
-
from .interface import
|
|
6
|
+
from .interface import AbstractCoreInterface
|
|
7
7
|
from ..exceptions import ModelNotFoundError, AuthenticationError, ProviderAPIError
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def create_llm(provider: str, model: Optional[str] = None, **kwargs) ->
|
|
10
|
+
def create_llm(provider: str, model: Optional[str] = None, **kwargs) -> AbstractCoreInterface:
|
|
11
11
|
"""
|
|
12
12
|
Create an LLM provider instance with unified token parameter support.
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ def create_llm(provider: str, model: Optional[str] = None, **kwargs) -> Abstract
|
|
|
16
16
|
model: Model name (optional, will use provider default)
|
|
17
17
|
**kwargs: Additional configuration including token parameters
|
|
18
18
|
|
|
19
|
-
Token Parameters (
|
|
19
|
+
Token Parameters (AbstractCore Unified Standard):
|
|
20
20
|
max_tokens: Total context window budget (input + output combined)
|
|
21
21
|
max_output_tokens: Maximum tokens reserved for generation (default: 2048)
|
|
22
22
|
max_input_tokens: Maximum tokens for input (auto-calculated if not specified)
|
|
@@ -75,7 +75,7 @@ def create_llm(provider: str, model: Optional[str] = None, **kwargs) -> Abstract
|
|
|
75
75
|
from ..providers.openai_provider import OpenAIProvider
|
|
76
76
|
return OpenAIProvider(model=model or "gpt-5-nano-2025-08-07", **kwargs)
|
|
77
77
|
except ImportError:
|
|
78
|
-
raise ImportError("OpenAI dependencies not installed. Install with: pip install
|
|
78
|
+
raise ImportError("OpenAI dependencies not installed. Install with: pip install abstractcore[openai]")
|
|
79
79
|
except (ModelNotFoundError, AuthenticationError, ProviderAPIError) as e:
|
|
80
80
|
# Re-raise provider exceptions cleanly
|
|
81
81
|
raise e
|
|
@@ -85,7 +85,7 @@ def create_llm(provider: str, model: Optional[str] = None, **kwargs) -> Abstract
|
|
|
85
85
|
from ..providers.anthropic_provider import AnthropicProvider
|
|
86
86
|
return AnthropicProvider(model=model or "claude-3-5-haiku-latest", **kwargs)
|
|
87
87
|
except ImportError:
|
|
88
|
-
raise ImportError("Anthropic dependencies not installed. Install with: pip install
|
|
88
|
+
raise ImportError("Anthropic dependencies not installed. Install with: pip install abstractcore[anthropic]")
|
|
89
89
|
except (ModelNotFoundError, AuthenticationError, ProviderAPIError) as e:
|
|
90
90
|
# Re-raise provider exceptions cleanly
|
|
91
91
|
raise e
|
|
@@ -95,21 +95,21 @@ def create_llm(provider: str, model: Optional[str] = None, **kwargs) -> Abstract
|
|
|
95
95
|
from ..providers.ollama_provider import OllamaProvider
|
|
96
96
|
return OllamaProvider(model=model or "qwen3-coder:30b", **kwargs)
|
|
97
97
|
except ImportError:
|
|
98
|
-
raise ImportError("Ollama dependencies not installed. Install with: pip install
|
|
98
|
+
raise ImportError("Ollama dependencies not installed. Install with: pip install abstractcore[ollama]")
|
|
99
99
|
|
|
100
100
|
elif provider.lower() == "huggingface":
|
|
101
101
|
try:
|
|
102
102
|
from ..providers.huggingface_provider import HuggingFaceProvider
|
|
103
103
|
return HuggingFaceProvider(model=model or "Qwen/Qwen3-4B/", **kwargs)
|
|
104
104
|
except ImportError:
|
|
105
|
-
raise ImportError("HuggingFace dependencies not installed. Install with: pip install
|
|
105
|
+
raise ImportError("HuggingFace dependencies not installed. Install with: pip install abstractcore[huggingface]")
|
|
106
106
|
|
|
107
107
|
elif provider.lower() == "mlx":
|
|
108
108
|
try:
|
|
109
109
|
from ..providers.mlx_provider import MLXProvider
|
|
110
110
|
return MLXProvider(model=model or "mlx-community/Qwen3-4B", **kwargs)
|
|
111
111
|
except ImportError:
|
|
112
|
-
raise ImportError("MLX dependencies not installed. Install with: pip install
|
|
112
|
+
raise ImportError("MLX dependencies not installed. Install with: pip install abstractcore[mlx]")
|
|
113
113
|
|
|
114
114
|
elif provider.lower() == "lmstudio":
|
|
115
115
|
try:
|
|
@@ -7,11 +7,11 @@ from typing import List, Dict, Any, Optional, Union, Iterator
|
|
|
7
7
|
from .types import GenerateResponse, Message
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class AbstractCoreInterface(ABC):
|
|
11
11
|
"""
|
|
12
12
|
Abstract base class for all LLM providers.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
AbstractCore Token Parameter Vocabulary (Unified Standard):
|
|
15
15
|
=========================================================
|
|
16
16
|
|
|
17
17
|
• max_tokens: Total context window budget (input + output combined) - YOUR BUDGET
|
|
@@ -57,7 +57,7 @@ class AbstractLLMInterface(ABC):
|
|
|
57
57
|
|
|
58
58
|
Provider Abstraction:
|
|
59
59
|
===================
|
|
60
|
-
|
|
60
|
+
AbstractCore handles provider-specific parameter mapping internally:
|
|
61
61
|
• OpenAI: max_tokens → max_completion_tokens (o1 models) or max_tokens (others)
|
|
62
62
|
• Anthropic: max_output_tokens → max_tokens (output-focused API)
|
|
63
63
|
• Google: max_output_tokens → max_output_tokens (direct mapping)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Production-ready retry strategies for
|
|
2
|
+
Production-ready retry strategies for AbstractCore.
|
|
3
3
|
|
|
4
4
|
Implements SOTA exponential backoff with jitter and circuit breaker patterns
|
|
5
5
|
based on 2025 best practices from AWS Architecture Blog, Tenacity principles,
|
|
@@ -10,7 +10,7 @@ import json
|
|
|
10
10
|
import uuid
|
|
11
11
|
from collections.abc import Generator
|
|
12
12
|
|
|
13
|
-
from .interface import
|
|
13
|
+
from .interface import AbstractCoreInterface
|
|
14
14
|
from .types import GenerateResponse, Message
|
|
15
15
|
from .enums import MessageRole
|
|
16
16
|
|
|
@@ -25,7 +25,7 @@ class BasicSession:
|
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
def __init__(self,
|
|
28
|
-
provider: Optional[
|
|
28
|
+
provider: Optional[AbstractCoreInterface] = None,
|
|
29
29
|
system_prompt: Optional[str] = None,
|
|
30
30
|
tools: Optional[List[Callable]] = None,
|
|
31
31
|
timeout: Optional[float] = None,
|
|
@@ -255,7 +255,7 @@ class BasicSession:
|
|
|
255
255
|
json.dump(data, f, indent=2)
|
|
256
256
|
|
|
257
257
|
@classmethod
|
|
258
|
-
def load(cls, filepath: Union[str, Path], provider: Optional[
|
|
258
|
+
def load(cls, filepath: Union[str, Path], provider: Optional[AbstractCoreInterface] = None,
|
|
259
259
|
tools: Optional[List[Callable]] = None) -> 'BasicSession':
|
|
260
260
|
"""
|
|
261
261
|
Load session from file with complete metadata restoration.
|
|
@@ -325,7 +325,7 @@ class BasicSession:
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
@classmethod
|
|
328
|
-
def from_dict(cls, data: Dict[str, Any], provider: Optional[
|
|
328
|
+
def from_dict(cls, data: Dict[str, Any], provider: Optional[AbstractCoreInterface] = None,
|
|
329
329
|
tools: Optional[List[Callable]] = None) -> 'BasicSession':
|
|
330
330
|
"""
|
|
331
331
|
Create session from dictionary data (supports both new archive format and legacy format).
|
|
@@ -429,7 +429,7 @@ class BasicSession:
|
|
|
429
429
|
def compact(self,
|
|
430
430
|
preserve_recent: int = 6,
|
|
431
431
|
focus: Optional[str] = None,
|
|
432
|
-
compact_provider: Optional[
|
|
432
|
+
compact_provider: Optional[AbstractCoreInterface] = None,
|
|
433
433
|
reason: str = "manual") -> 'BasicSession':
|
|
434
434
|
"""
|
|
435
435
|
Compact chat history using SOTA 2025 best practices for conversation summarization.
|
|
@@ -675,7 +675,7 @@ class BasicSession:
|
|
|
675
675
|
print(f"✅ Session compacted: {len(compacted.messages)} messages, ~{compacted.get_token_estimate()} tokens")
|
|
676
676
|
|
|
677
677
|
def generate_summary(self, preserve_recent: int = 6, focus: Optional[str] = None,
|
|
678
|
-
compact_provider: Optional[
|
|
678
|
+
compact_provider: Optional[AbstractCoreInterface] = None) -> Dict[str, Any]:
|
|
679
679
|
"""
|
|
680
680
|
Generate a summary of the entire conversation and store it in session.summary.
|
|
681
681
|
|