Convert any X to any Y automatically using AI-powered code generation
Project description
Transformative
Use AI to write code to convert a type into another type.
Installation
pip install transformative
Then you can use it like this:
from transformative import init, create
init(generated_code_dir="my/path/for/generated/code/")
circle_to_square = create(Circle, Square)
square = circle_to_square(Circle(radius=1))
When the create function is called the first time, the project will use an LLM to generate a converter. First, it will
write tests, then it will attempt to write code to pass those tests. If the code passes the tests, it will be saved to
the generated_code_dir. Subsequent calls to the create function will use the generated code to convert the types.
Dependencies
This package requires aider-chat to be installed and available on the command line:
pip install aider-chat
# or
python -m pip install aider-install
Aider
The tool uses aider to write the code, calling out to an LLM server based on what API keys are found in your local
environment. More information about configuring aider can be found here: https://aider.chat/docs/config/dotenv.html
Quick Start
See src/examples/generate_new_code.py for an example of how to use the tool.
See notes/master_plan.md for plans about future development.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file transformative-0.0.3.tar.gz.
File metadata
- Download URL: transformative-0.0.3.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4c5fef3909a11da22aa476ddc8fbcaefcfe94a02c4e86fd292ba9533637d8ac
|
|
| MD5 |
dbfd4547e10f09e67dd3c8df02254037
|
|
| BLAKE2b-256 |
5f1ffb2c068ecdafbc4ad0857ca353a0581248d23399c9d3bc1c10a388757c69
|
File details
Details for the file transformative-0.0.3-py3-none-any.whl.
File metadata
- Download URL: transformative-0.0.3-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1bd380c6655432fd96fc52c4ab413aad2c0b389ddd0ddcb1c68799ae1339eff
|
|
| MD5 |
d90bf2859fccf1ec378b8f4af426835f
|
|
| BLAKE2b-256 |
cce32552e8e38aa29d9561f6d8cf35a6342649dd7ad7a6bf82073e7afb7b1a32
|