This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.2.0 instead.
Reason given by maintainers: untrusted dependency from public pypi
cooksafe
Two helpers the TypeSafe cookbooks share.
pip install cooksafe --extra-index-url https://pypi.typesafe.ai/
The extra index is where TypeSafe serves this package and typesafe_client.
JsonCache
File-backed memoization for the model calls in a notebook, so a re-run replays what the first run recorded instead of paying for it again.
from pathlib import Path
from cooksafe import JsonCache
cache = JsonCache(Path("json_cache.json"))
@cache
def ask(model: str, question: str) -> dict:
... # a real API call happens once per distinct argument set
Results must be JSON-serializable. Keys are the function name plus its arguments; long ones (a whole document, say) are stored as a digest so the file stays readable. Delete the file to re-sample everything live.
make_playground_link
Turns a document and a set of questions into a link that opens them in the TypeSafe playground, for readers who want to try a cookbook's questions against their own text.
import typesafe_client.api.models as tsm
from cooksafe import make_playground_link
questions = {
"is_greeting": tsm.NoulQuestion(
instructions="Is this a greeting?",
criteria=tsm.NoulCriteria(true="it greets the reader", false="it does not"),
)
}
print(make_playground_link({"doc": "hello there"}, questions, models=["speed_latest"]))
The link carries the document and questions in its fragment, so it is generated offline and nothing is uploaded to build it.
Release files for cooksafe 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cooksafe-0.1.0.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cooksafe-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / cooksafe-0.1.0.tar.gz
| Download URL | cooksafe-0.1.0.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb5fc3fec330f4202f2e27cbee6c5102d9321bd508ac33b33c1b8b1133807a8c
|
|
BLAKE2b-256 checksum How to use checksums |
b83cda48e80a00d4448b4e25bc5b089926e632368a0beda6af9042772e40730f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cooksafe-0.1.0-py3-none-any.whl
| Download URL | cooksafe-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c991340b53554b44f6b943e0275b47750e66098fddfa79e5415087c94af045d0
|
|
BLAKE2b-256 checksum How to use checksums |
6c6694c6f571110e2f4cf2019e9cc45a7ae3df8be7b7d7a375eaefa1f7b3dac8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|