Mattie/cataclysm
Cataclysm - Code generation library for the end game
What it solves
Cataclysm allows developers to call functions that haven't been written yet. Instead of manually implementing logic, the library uses an LLM to generate and execute the code on the fly based on the function name, arguments, and surrounding context.
How it works
The project integrates with OpenAI's GPT-4 (or GPT-3.5) to generate Python code dynamically. It analyzes function signatures, call stacks, keyword arguments, docstrings, and comments to determine what the code should do. To avoid constant API calls, it caches generated code locally in YAML files. If the first execution of generated code fails, the system attempts to regenerate it once more before giving up.
Who it’s for
Experimental developers and those looking to prototype rapidly by letting an AI handle the implementation of specific functions.
Highlights
- Global Mode: Uses
consume(globals())to make any unrecognized function in the environment be generated by AI. - Explicit Mode: Uses the
doommodule for controlled, explicit invocation of AI-generated functions. - Preview Mode: The
doom.impendingfeature allows users to see the generated code string before actually executing it. - Frozen Mode:
doom.chosenensures that released code uses a specific, previously generated version of the code to maintain stability.
Related
- Project
- Project
- Project
- Project
- Project