Re:I'm puzzled how anyone trusts ChatGPT for code
by matsemann on Wednesday May 08, 2024 @05:58PM
(#40303125)
I 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
Maybe I should make a LLM version of this.
Re:I'm puzzled how anyone trusts ChatGPT for code
by LegionMammal978 on Wednesday May 08, 2024 @06:15PM
(#40303274)
The 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-m...
Re:I'm puzzled how anyone trusts ChatGPT for code
by adhamsalama on Wednesday May 08, 2024 @05:53PM
(#40303068)
Re:I'm puzzled how anyone trusts ChatGPT for code
by Nodejsmith on Wednesday May 08, 2024 @09:41PM
(#40304465)
I'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#-buil...
Re:I'm puzzled how anyone trusts ChatGPT for code
by jackmpcollins on Thursday May 09, 2024 @03:08AM
(#40305979)
I'm building 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.
What if you could write something like:
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.