4 ms·
Right, hopefully no one is sprinkling eval(prompt) into their codebase.
by fassssst 2y ago
Right, hopefully no one is sprinkling eval(prompt) into their codebase.
- 1f60c 2y agoI had an idea about that the other day! 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.
- deleted 2y ago[deleted]
- adhamsalama 2y agohttps://github.com/retrage/gpt-macro https://github.com/retrage/gpt-macro
- matsemann 2y agoI made that as a joke in javascript 8 years ago. Not using LLM, but using javascript proxies so that if a function doesn't exist it tries to implement it runtime based on the name of the function using a sql like grammar. I really hope to not see something like that in real use, heh. https://github.com/Matsemann/Declaraoids https://github.com/Matsemann/Declaraoids Maybe I should make a LLM version of this.
- LegionMammal978 2y agoThe funny part is, Spring Data JPA has a quite serious take on this, in the form of query methods [0]. You create a repository interface with certain method names, and it dynamically creates an implementation that queries the columns of the underlying table, according to the name of the method. [0] https://docs.spring.io/spring-data/jpa/reference/jpa/query-methods.html https://docs.spring.io/spring-data/jpa/reference/jpa/query-m...
- Nodejsmith 2y agoI've never tried it myself, but Prefect does have something like this with their Marvin AI library for Python. https://github.com/PrefectHQ/marvin?tab=readme-ov-file#-build-ai-powered-functions https://github.com/PrefectHQ/marvin?tab=readme-ov-file#-buil...
- jackmpcollins 2y agoI'm building magentic https://github.com/jackmpcollins/magentic https://github.com/jackmpcollins/magentic which has basically this syntax, though it queries the LLM to generate the answer rather than writing + running code. 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.
- _akhe 2y agoNot gonna lie... llama.cpp... LlamaIndex... Ollama... kinda is eval(prompt) a lot of the time! Of course AI data pipelines are a totally different conversation than code solutions.