Executing LLM-generated code
from bespokelabs import curator
from datasets import Dataset
class HelloExecutor(curator.CodeExecutor):
def code(self, row):
return """location = input();print(f"Hello {location}")"""
def code_input(self, row):
return row['location']
def code_output(self, row, execution_output):
row['output'] = execution_output.stdout
return row
locations = Dataset.from_list([{'location': 'New York'},{'location': 'Tokyo'}])
hello_executor = HelloExecutor()
print(hello_executor(locations).to_pandas())Features:

Backends
Backend Setup and configuration options
Multiprocessing Backend:
Docker
Ray
E2B
Conclusion
Last updated