How to use external libraries in a controller? #107
-
I would like to know how to use external libraries within a controller. Currently, I am working on constrained code generation using AICI. I am trying to generate code in Python using the PyCtrl library. At the point where Is there any way to use libraries like Z3 that are not implemented in Python internally? I also tried running Z3 as a server and sending queries via HTTPS from the controller's I also attempted to write the controller in Rust to use the aici_abi library directly, but I failed. After adding Z3 to Cargo.toml, some errors arose when compiling to Wasm. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @mindol, Right now, the python controller only accepts a single python file as its input. So, the only option to add new packages is to recompile a new python controller image with the packages you need---as you found--in the pyctrl/lib folder. That's inconvenient, but should be do-able. You might need to modify some packages if they depend on functionality that is not supported inside the Wasm sandbox. It would be a nice addition to extend the python controller to accept a set of python files, including new modules, instead of only running the 1 input file. |
Beta Was this translation helpful? Give feedback.
Hi @mindol,
Right now, the python controller only accepts a single python file as its input. So, the only option to add new packages is to recompile a new python controller image with the packages you need---as you found--in the pyctrl/lib folder. That's inconvenient, but should be do-able. You might need to modify some packages if they depend on functionality that is not supported inside the Wasm sandbox.
It would be a nice addition to extend the python controller to accept a set of python files, including new modules, instead of only running the 1 input file.