Readme
This is a simple demonstration project. More like this is possible at this point. Use at your own risk. This code is ultimately non-deterministic and nobody knows what might happen.
Importing this code will give a simple python script rudimentary way of fixing itself. This scripts registers itself as a global exception hook, retrieves the source code that failed, executes llm to fix the code, substitutes it back in and continues execution as if nothing happened.
Simple, eh?
Components
Configuration
Configuration area for the module. This is simply a python module that is loaded and referenced. Easy and flexible. Security is not a consideration since:
A) This project is meant to be a library / agent that is included within another project, having complete and total control of that project. B) We are running AI within our code and allowing it to make decisions on the fly. C) There is no end-user facing configuration planned at this point.
AI
System of selecting and listing available models. To be expanded later. Key functionality:
- Assume that capability may change over time. There has to be a method of re-examining capabilities and adding to them.
- Allow for models to be deleted, even if they were found before.
- Allow to handle models (at least try to), even if they are new.
- Optionally allow to download models?
Prompts
System of having and selecting one of multiple prompts. Key Functionality:
- Some prompts work with some models, and not others.
- Some prompts may require different information. Thankfully we can try different prompts and get an error if information is not available.
- Each prompt should have some way of deciding if a model can be used to evaluate it.
Decorators
Currently only one decorator. Others are in the planning stages. Please have a look at issues inside github if you are interested.
Decorator is capable of catching and monitoring a single feature, while recording information about that section of code.
Necromancer
Last ditch effort to respond to an unhandled exception. At this stage the program is effectively dead and the stack has unravelled. More testing is needed whether necromancer can restore a complex program, but should work for simple scripts.
While this mode of running is simple and impressive, it is primairly included here as a demonstration. At the stage of life when necromancer is activated, the program is effectively dead. All the stack has been traversed up and the only remaining thing is to output the stack trace to screen or log. This code will attempt to ressurect and re-start the code execution, which is a very interesting concept.
At this stage this will only work for simple scripts. If at any point in the stack we catch and then re-raise an exception, necromancer would likely be get very confused.
Installation
Ollama
Need ollama installed together with pip install ollama.
Need to download an appropriate model and set it inside caretaker/config.py. While you are at it, feel free to improve on the prompt.
Issues and future work
There are several issues with this code. Some (most probably) are fixable.
-
This package may not install properly at this time. I am trying to resolve naming issues.
-
It only modifies the code in memory, does not write it back out to the filesystem.
-
This code is currently working with ollama only, although it allows for capture of other models and methods of execution (not fully implemented yet). Need to create a process of selecting a best model.
-
Catching it at global exception hook means the program is already dead. Restarting execution (if the failure happened in a loop, etc), is tricky. Necromancer is a pure demonstration of what might be possible. Decorators are the future.
-
Several different decorators are in the design / partial implemntation stages. No guarantee any of them work.
Metadata
Release files for AICaretaker 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aicaretaker-0.1.1.tar.gz | 20.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| AICaretaker-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.6 kB
Release files / aicaretaker-0.1.1.tar.gz
| Download URL | aicaretaker-0.1.1.tar.gz |
|---|---|
| Size | 20.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee30805d233bd0414cd095af0085f4a90775f5223b6bee5fefd8b04334cd32d9
|
|
BLAKE2b-256 checksum How to use checksums |
737fa5fa92d468e2a0827672465916b46bad6065a84d4596987004b27eee6745
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / AICaretaker-0.1.1-py3-none-any.whl
| Download URL | AICaretaker-0.1.1-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce8e13f3704ed4e62fd619c7249dc8581b31736dfaf352401715856032a6067d
|
|
BLAKE2b-256 checksum How to use checksums |
2916d7ec1d8418cafc3f381b6f490094828a777b609c38dc7b0c55284f6144db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for AICaretaker 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.