Save a program to a folder, with everything it depends on.
The folder holds the code the program reaches, each AI function's
settings, instruction and demos, data files read with functai.file,
and pinned requirements. It is written whole or not at all. Keys and
connections are never saved.
Problems to accept on purpose, like ["hidden-state"] to save a global's current value.
()
record
list of dict
Inputs to run the program on now, for real (this calls the model). The replies are recorded, and verify replays them to prove the saved program gives the same results, without calling a model.
()
examples
list of dict
Inputs to fingerprint the rendered requests of, besides the demos.
()
overwrite
bool
Replace an existing folder.
False
weights
str
Baked weights: "copy" them into the folder (default) or "reference" them.
importtempfile,os@aidefcapital(country:str)->str:"""The country's capital city."""...folder=os.path.join(tempfile.mkdtemp(),"capital")save(capital,folder,record=[{"country":"Kenya"}])sorted(os.listdir(folder))
functai: no model chosen, so using gpt-4.1-mini (environment ($OPENAI_API_KEY)). Choose one with functai.configure(lm=...).['code', 'functai.json', 'recordings.json', 'requirements.lock', 'requirements.txt']