verify¶
verify(path, *, trust=False, fresh=True, python=None, timeout=900)
Prove a saved program runs somewhere else, without calling a model.
Builds a new environment with uv from the folder's lock file alone,
loads the program there from an empty directory (so nothing from your
project can leak in), then checks that every AI function renders
byte-identical requests, and that each recording (save(record=...))
replays to the same result.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| path | str or path | The saved folder. | required |
| trust | bool | Must be True: verifying runs the saved code. | False |
| fresh | bool | Build a new environment (default). False checks in this one: quicker, and blind to packages installed here but not declared. |
True |
| python | str | The Python version or interpreter for the new environment. | None |
| timeout | float | Seconds before giving up. | 900 |
Returns¶
| Name | Type | Description |
|---|---|---|
| Verification | Displays what was checked; .ok is True when everything matched. |
See Also¶
Examples¶
import functai
from functai import *
import tempfile, os
@ai
def capital(country: str) -> str:
"""The country's capital city."""
...
folder = os.path.join(tempfile.mkdtemp(), "capital")
save(capital, folder, record=[{"country": "Kenya"}])
verify(folder, trust=True, fresh=False)
functai: no model chosen, so using gpt-4.1-mini (environment ($OPENAI_API_KEY)). Choose one with functai.configure(lm=...).
verified in this environment