4 ms·
An iterative Python call to a recursive LLM prompt? ;) Why not make the Python part recursive too? Or better yet, wait until an LLM comes out with the capabili
by UltimateEdge 4y ago
An iterative Python call to a recursive LLM prompt? ;)
Why not make the Python part recursive too? Or better yet, wait until an LLM comes out with the capability to execute arbitrary code!
- andyk 4y agoDone! Well, the first suggestion you made anyway :-) https://github.com/andyk/recursive_llm/blob/main/run_recursive_gpt.py https://github.com/andyk/recursive_llm/blob/main/run_recursi... def recursively_prompt_llm(prompt, n=1): if prompt.startswith("You are a recursive function"): prompt = openai.Completion.create( model="text-davinci-003", prompt=prompt, temperature=0, max_tokens=2048, )["choices"][0]["text"].strip() print(f"response #{n}: {prompt}\n") recursively_prompt_llm(prompt, n + 1) recursively_prompt_llm(sys.stdin.readline())