Jev TypeSafe AI is a small tutorial project demonstrating how to use the TypeSafe AI SDK to classify a user's response and choose an appropriate reply. The interactive lost-and-found example asks whether the user lost something, evaluates the answer, and routes the response based on the lost_something score:
- Above
0.8: directs the user to the lost-and-found counter. - Below
0.2: asks what else the user needs help with. - From
0.2through0.8, inclusive: asks the user to clarify.
- Python 3.13 or newer
- uv for managing the project and its dependencies
- TypeSafe API configuration for the interactive example
The project dependencies are declared in pyproject.toml and installed by uv:
typesafe-sdkfor the TypeSafe client and decision modelpython-dotenv(imported asdotenv) to load configuration from a.envfile
From the project root, install the dependencies:
uv syncCreate a .env file in the project root with your TypeSafe configuration:
TYPESAFE_API_KEY=your_api_key
TYPESAFE_DEFAULT_MODEL=your_model
TYPESAFE_BASE_URL=your_base_urlUse the model name and base URL for your TypeSafe service. Keep the API key private and do not commit the .env file.
Run the interactive lost-and-found example:
uv run python src/jev_typesafe_ai/lost_found.pyEnter a response when prompted. Type exit to quit; press Ctrl+C to exit as well.
The top-level main.py is a separate starter stub that prints a greeting; it does not launch the interactive example. Run it with:
uv run python main.py