unitxt icon indicating copy to clipboard operation
unitxt copied to clipboard

Add safe and well maintained operator for running external code from web sources

Open elronbandel opened this issue 1 year ago • 1 comments

prototype:

class WebModuleOperator(FieldOperator):
    source_urls: List[str] # all downloaded to tempdir
    function: str # imported from tempdir when set
    hash: str # used to make sure the files hasnt changed

    def prepare(self):
        # here come your logic to set things up

    def process(self, value):
        return self._loaded_func(value)

elronbandel avatar Jun 26 '24 10:06 elronbandel

I think it should be called ApplyRemoteCode - and have as similar API to Apply.

ApplyRemoteCode("a", function="koko", to_field="b", source_urls = ['https:... '], source_urls_content_hash="XXXXX")

yoavkatz avatar Jun 26 '24 16:06 yoavkatz