Right, hopefully no one is sprinkling eval(prompt) into their codebase.
What if you could write something like:
@implement_this
def prime_sieve(n: int) -> list[int]:
pass
And the decorator reads the function name and optional docstring, runs it through an LLM and replaces the function with one implementing the desired behavior (hopefully correctly). I remember there was something like this for StackOverflow.https://github.com/Matsemann/Declaraoids
Maybe I should make a LLM version of this.
[0] https://docs.spring.io/spring-data/jpa/reference/jpa/query-m...
https://github.com/PrefectHQ/marvin?tab=readme-ov-file#-buil...
from magentic import prompt
from pydantic import BaseModel
class Superhero(BaseModel):
name: str
age: int
power: str
enemies: list[str]
@prompt("Create a Superhero named {name}.")
def create_superhero(name: str) -> Superhero: ...
I do have plans to also solve the case you're talking about of generating code once and executing that each time.Of course AI data pipelines are a totally different conversation than code solutions.