ai-microcore 5.0.0.dev4__tar.gz → 5.0.0.dev6__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.
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/LICENSE +19 -19
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/PKG-INFO +29 -25
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/README.md +306 -304
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/__init__.py +234 -233
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/_env.py +228 -240
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/_llm_functions.py +408 -299
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/_prepare_llm_args.py +47 -47
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/ai_func/__init__.py +277 -277
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/ai_func/ai-func.json.j2 +10 -10
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/ai_func/ai-func.pythonic.j2 +9 -9
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/ai_func/ai-func.tag.j2 +34 -34
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/ai_modules.py +18 -18
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/configuration.py +611 -493
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/embedding_db/__init__.py +183 -183
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/embedding_db/chromadb.py +187 -187
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/embedding_db/qdrant.py +262 -262
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/file_cache.py +103 -103
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/file_storage.py +375 -375
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/images.py +5 -5
- ai_microcore-5.0.0.dev6/microcore/interactive_setup.py +174 -0
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/json_parsing.py +244 -244
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/llm/__init__.py +1 -1
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/llm/anthropic.py +139 -139
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/llm/google_genai.py +279 -205
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/llm/local_llm.py +100 -100
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/llm/local_transformers.py +267 -267
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/llm/openai.py +350 -344
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/llm/shared.py +40 -40
- ai_microcore-5.0.0.dev6/microcore/llm_backends.py +301 -0
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/lm_client.py +0 -0
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/logging.py +186 -186
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/mcp.py +421 -421
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/message_types.py +124 -99
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/metrics.py +42 -42
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/presets.py +18 -17
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/python.py +68 -68
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/templating/__init__.py +0 -0
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/templating/jinja2.py +28 -28
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/text2speech/elevenlabs.py +73 -73
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/tokenizing.py +79 -79
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/types.py +79 -58
- ai_microcore-5.0.0.dev6/microcore/ui.py +219 -0
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/utils.py +656 -651
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/wrappers/__init__.py +0 -0
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/wrappers/llm_response_wrapper.py +177 -205
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/microcore/wrappers/prompt_wrapper.py +26 -26
- {ai_microcore-5.0.0.dev4 → ai_microcore-5.0.0.dev6}/pyproject.toml +62 -60
- ai_microcore-5.0.0.dev4/microcore/interactive_setup.py +0 -82
- ai_microcore-5.0.0.dev4/microcore/llm/google_vertex_ai.py +0 -145
- ai_microcore-5.0.0.dev4/microcore/ui.py +0 -98
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023—
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
-
subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023—2026 Vitalii Stepanenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
20
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ai-microcore
|
|
3
|
-
Version: 5.0.0.
|
|
3
|
+
Version: 5.0.0.dev6
|
|
4
4
|
Summary: # Minimalistic Foundation for AI Applications
|
|
5
5
|
Keywords: llm,large language models,ai,similarity search,ai search,gpt,openai,framework,adapter
|
|
6
6
|
Author-email: Vitalii Stepanenko <mail@vitaliy.in>
|
|
@@ -15,6 +15,8 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Intended Audience :: Developers
|
|
17
17
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
18
20
|
License-File: LICENSE
|
|
19
21
|
Requires-Dist: openai>=0.28.1,<2
|
|
20
22
|
Requires-Dist: python-dotenv~=1.1.0
|
|
@@ -29,17 +31,18 @@ Requires-Dist: docstring_parser~=0.16.0
|
|
|
29
31
|
Requires-Dist: httpx~=0.28.1
|
|
30
32
|
Project-URL: Source Code, https://github.com/Nayjest/ai-microcore
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
<a href="https://github.com/Nayjest/ai-microcore/releases" target="_blank"><img src="https://img.shields.io/github/v/release/Nayjest/ai-microcore.svg" alt="Release Notes"></a>
|
|
34
|
-
<a href="https://app.codacy.com/gh/Nayjest/ai-microcore/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade" target="_blank"><img src="https://app.codacy.com/project/badge/Grade/441d03416bc048828c649129530dcbc3" alt="Code Quality"></a>
|
|
35
|
-
<a href="https://github.com/Nayjest/ai-microcore/actions/workflows/pylint.yml" target="_blank"><img src="https://github.com/Nayjest/ai-microcore/actions/workflows/pylint.yml/badge.svg" alt="Pylint"></a>
|
|
36
|
-
<img src="https://raw.githubusercontent.com/Nayjest/ai-microcore/main/coverage.svg" alt="Code Coverage">
|
|
37
|
-
<a href="https://github.com/Nayjest/ai-microcore/actions/workflows/tests.yml" target="_blank"><img src="https://github.com/Nayjest/ai-microcore/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
|
|
38
|
-
<a href="https://github.com/Nayjest/ai-microcore/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/static/v1?label=license&message=MIT&color=d08aff" alt="License"></a>
|
|
39
|
-
</p>
|
|
34
|
+
# AI MicroCore: A Minimalistic Foundation for AI Applications
|
|
40
35
|
|
|
36
|
+
<p align="center">
|
|
37
|
+
<a href="https://pypi.org/project/ai-microcore/" target="_blank"><img src="https://img.shields.io/github/v/release/Nayjest/ai-microcore.svg" alt="Release Notes"></a>
|
|
38
|
+
<a href="https://app.codacy.com/gh/Nayjest/ai-microcore/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade" target="_blank"><img src="https://app.codacy.com/project/badge/Grade/441d03416bc048828c649129530dcbc3" alt="Code Quality"></a>
|
|
39
|
+
<a href="https://github.com/Nayjest/ai-microcore/actions/workflows/pylint.yml" target="_blank"><img src="https://github.com/Nayjest/ai-microcore/actions/workflows/pylint.yml/badge.svg" alt="Pylint"></a>
|
|
40
|
+
<a href="https://github.com/Nayjest/ai-microcore/actions/workflows/tests.yml" target="_blank"><img src="https://github.com/Nayjest/ai-microcore/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
|
|
41
|
+
<img src="https://raw.githubusercontent.com/Nayjest/ai-microcore/main/coverage.svg" alt="Code Coverage">
|
|
42
|
+
<a href="https://github.com/vshymanskyy/StandWithUkraine/blob/main/README.md" target="_blank"><img src="https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/refs/heads/main/badges/StandWithUkraine.svg" alt="Stand With Ukraine"></a>
|
|
43
|
+
<a href="https://github.com/Nayjest/ai-microcore/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/static/v1?label=license&message=MIT&color=d08aff" alt="License"></a>
|
|
44
|
+
</p>
|
|
41
45
|
|
|
42
|
-
# AI MicroCore: A Minimalistic Foundation for AI Applications
|
|
43
46
|
|
|
44
47
|
**MicroCore** is a collection of python adapters for Large Language Models
|
|
45
48
|
and Vector Databases / Semantic Search APIs allowing to
|
|
@@ -50,7 +53,7 @@ It defines interfaces for features typically used in AI applications,
|
|
|
50
53
|
which allows you to keep your application as simple as possible and try various models & services
|
|
51
54
|
without need to change your application code.
|
|
52
55
|
|
|
53
|
-
You even
|
|
56
|
+
You can even switch between text completion and chat completion models only using configuration.
|
|
54
57
|
|
|
55
58
|
Thanks to LLM-agnostic MCP integration,
|
|
56
59
|
**MicroCore** connects MCP tools to any language models easily,
|
|
@@ -102,7 +105,7 @@ Similarity search features will work out of the box if you have the `chromadb` p
|
|
|
102
105
|
There are a few options available for configuring microcore:
|
|
103
106
|
|
|
104
107
|
- Use `microcore.configure(**params)`
|
|
105
|
-
<br>💡 <small>All configuration options
|
|
108
|
+
<br>💡 <small>All configuration options appear in IDE autocompletion tooltips</small>
|
|
106
109
|
- Create a `.env` file in your project root; examples: [basic.env](https://github.com/Nayjest/ai-microcore/blob/main/.env.example), [Mistral Large.env](https://github.com/Nayjest/ai-microcore/blob/main/.env.mistral.example), [Anthropic Claude 3 Opus.env](https://github.com/Nayjest/ai-microcore/blob/main/.env.anthropic.example), [Gemini on Vertex AI.env](https://github.com/Nayjest/ai-microcore/blob/main/.env.google-vertex-gemini.example), [Gemini on AI Studio.env](https://github.com/Nayjest/ai-microcore/blob/main/.env.gemini.example)
|
|
107
110
|
- Use a custom configuration file: `mc.configure(DOT_ENV_FILE='dev-config.ini')`
|
|
108
111
|
- Define OS environment variables
|
|
@@ -110,7 +113,7 @@ There are a few options available for configuring microcore:
|
|
|
110
113
|
For the full list of available configuration options, you may also check [`microcore/config.py`](https://github.com/Nayjest/ai-microcore/blob/main/microcore/configuration.py#L175).
|
|
111
114
|
|
|
112
115
|
### Installing vendor-specific packages
|
|
113
|
-
For
|
|
116
|
+
For models working not via OpenAI API, you may need to install additional packages:
|
|
114
117
|
#### Anthropic Claude 3
|
|
115
118
|
```bash
|
|
116
119
|
pip install anthropic
|
|
@@ -123,13 +126,14 @@ pip install google-generativeai
|
|
|
123
126
|
```bash
|
|
124
127
|
pip install vertexai
|
|
125
128
|
```
|
|
126
|
-
📌
|
|
129
|
+
📌Additionally for working through [Vertex AI](https://cloud.google.com/vertex-ai) you need to
|
|
127
130
|
[install the Google Cloud CLI](https://cloud.google.com/sdk/docs/install)
|
|
128
131
|
and [configure the authorization](https://cloud.google.com/sdk/docs/authorizing).
|
|
129
132
|
|
|
130
133
|
#### Local language models via Hugging Face Transformers
|
|
131
134
|
|
|
132
|
-
You will need to install transformers and deep learning library of your choice
|
|
135
|
+
You will need to install transformers and a deep learning library of your choice
|
|
136
|
+
(PyTorch, TensorFlow, Flax, etc).
|
|
133
137
|
|
|
134
138
|
See [transformers installation](https://huggingface.co/docs/transformers/installation).
|
|
135
139
|
|
|
@@ -145,13 +149,13 @@ See [transformers installation](https://huggingface.co/docs/transformers/install
|
|
|
145
149
|
Vector database functions are available via `microcore.texts`.
|
|
146
150
|
|
|
147
151
|
#### ChromaDB
|
|
148
|
-
|
|
152
|
+
The default vector database is [Chroma](https://www.trychroma.com/).
|
|
149
153
|
In order to use vector database functions with ChromaDB, you need to install the `chromadb` package:
|
|
150
154
|
```bash
|
|
151
155
|
pip install chromadb
|
|
152
156
|
```
|
|
153
|
-
By default, MicroCore will use ChromaDB PersistentClient (if corresponding package is installed).
|
|
154
|
-
Alternatively, you can run Chroma as separate service and configure MicroCore to use HttpClient:
|
|
157
|
+
By default, MicroCore will use ChromaDB PersistentClient (if the corresponding package is installed).
|
|
158
|
+
Alternatively, you can run Chroma as a separate service and configure MicroCore to use HttpClient:
|
|
155
159
|
|
|
156
160
|
```python
|
|
157
161
|
from microcore import configure
|
|
@@ -174,7 +178,7 @@ configure(
|
|
|
174
178
|
EMBEDDING_DB_TYPE=EmbeddingDbType.QDRANT,
|
|
175
179
|
EMBEDDING_DB_HOST="localhost",
|
|
176
180
|
EMBEDDING_DB_PORT="6333",
|
|
177
|
-
EMBEDDING_DB_SIZE=384, #
|
|
181
|
+
EMBEDDING_DB_SIZE=384, # number of dimensions in the SentenceTransformer model
|
|
178
182
|
EMBEDDING_DB_FUNCTION=SentenceTransformer("paraphrase-multilingual-MiniLM-L12-v2"),
|
|
179
183
|
)
|
|
180
184
|
```
|
|
@@ -197,7 +201,7 @@ use_logging()
|
|
|
197
201
|
# Basic usage
|
|
198
202
|
ai_response = llm('What is your model name?')
|
|
199
203
|
|
|
200
|
-
# You also
|
|
204
|
+
# You may also pass a list of strings as prompt
|
|
201
205
|
# - For chat completion models elements are treated as separate messages
|
|
202
206
|
# - For completion LLMs elements are treated as text lines
|
|
203
207
|
llm(['1+2', '='])
|
|
@@ -290,12 +294,12 @@ LLM Microcore supports all models & API providers having OpenAI API.
|
|
|
290
294
|
## 🖼️ Examples
|
|
291
295
|
|
|
292
296
|
#### [Code review tool](https://github.com/llm-microcore/microcore/blob/main/examples/code-review-tool)
|
|
293
|
-
Performs code review by LLM for changes in git .patch files in any programming languages.
|
|
297
|
+
Performs a code review by LLM for changes in git .patch files in any programming languages.
|
|
294
298
|
|
|
295
299
|
#### [Image analysis](https://colab.research.google.com/drive/1qTJ51wxCv3VlyqLt3M8OZ7183YXPFpic) (Google Colab)
|
|
296
300
|
Determine the number of petals and the color of the flower from a photo (gpt-4-turbo)
|
|
297
301
|
|
|
298
|
-
#### [
|
|
302
|
+
#### [Benchmark LLMs on math problems](https://www.kaggle.com/code/nayjest/gigabenchmark-llm-accuracy-math-problems) (Kaggle Notebook)
|
|
299
303
|
Benchmark accuracy of 20+ state of the art models on solving olympiad math problems. Inferencing local language models via HuggingFace Transformers, parallel inference.
|
|
300
304
|
|
|
301
305
|
#### [Generate meme image](https://github.com/Nayjest/ai-microcore/blob/main/examples/generate_meme_image.py)
|
|
@@ -303,7 +307,7 @@ Simple example demonstrating image generation using [OpenAI GPT Image](https://p
|
|
|
303
307
|
|
|
304
308
|
|
|
305
309
|
#### [Local inference with PyTorch / Transformers](https://github.com/Nayjest/ai-microcore/blob/main/examples/pytorch_transformers.py)
|
|
306
|
-
Text generation using HF/Transformers model locally (example
|
|
310
|
+
Text generation using HF/Transformers model locally (example with Qwen 3 0.6B).
|
|
307
311
|
|
|
308
312
|
#### [Other examples](https://github.com/llm-microcore/microcore/tree/main/examples)
|
|
309
313
|
|
|
@@ -312,7 +316,7 @@ Text generation using HF/Transformers model locally (example withQwen 3 0.6B).
|
|
|
312
316
|
@TODO
|
|
313
317
|
|
|
314
318
|
## 🤖 AI Modules
|
|
315
|
-
**This is experimental feature.**
|
|
319
|
+
**This is an experimental feature.**
|
|
316
320
|
|
|
317
321
|
Tweaks the Python import system to provide automatic setup of MicroCore environment
|
|
318
322
|
based on metadata in module docstrings.
|
|
@@ -332,5 +336,5 @@ Please see [CONTRIBUTING](https://github.com/Nayjest/ai-microcore/blob/main/CONT
|
|
|
332
336
|
## 📝 License
|
|
333
337
|
|
|
334
338
|
Licensed under the [MIT License](https://github.com/Nayjest/ai-microcore/blob/main/LICENSE)
|
|
335
|
-
© 2023 [Vitalii Stepanenko](mailto:mail@vitaliy.in)
|
|
339
|
+
© 2023–2026 [Vitalii Stepanenko](mailto:mail@vitaliy.in)
|
|
336
340
|
|