damingerdai/typesafe-jev-app

★ 0Forks 0PythonGitHub ↗Compare

README

TypeSafe Jev App

A small Python support-ticket classification example based on the TypeSafe quickstart. It sends a ticket to TypeSafe's System One API and prints three typed judgments: the responsible department, customer frustration, and urgency.

What It Does

src/main.py evaluates a hardcoded ticket about a failing Stripe integration in a single request:

Question Primitive Result
department Choice Selects billing, technical, or sales.
frustration Score Scores frustration against three ordered levels, from calm to very angry.
is_urgent Noul Returns the probability that the message conveys urgency.

The script loads local configuration with python-dotenv before initializing TypeSafeClient. As described in the official quickstart, the client reads TYPESAFE_API_KEY from the environment and uses jev-latest by default.

Requirements

  • Python 3.14 or newer, as required by this repository's pyproject.toml.
  • uv for dependency management.
  • A TypeSafe API key from the TypeSafe dashboard.
  • Network access to call the TypeSafe API.

Quick Start

Run the following commands from the repository root.

1. Install dependencies

uv sync --locked

This installs the dependencies recorded in uv.lock, including typesafe-sdk and python-dotenv.

2. Configure your API key

If you do not already have a .env file, copy the template:

cp .env.example .env

Replace the placeholder line in .env with your key assignment:

TYPESAFE_API_KEY=your-api-key

Keep your key private. .env is ignored by Git; do not put credentials in source files or documentation.

3. Run the example

uv run python src/main.py

The script prints the department, frustration score, and urgency probability on separate lines. Illustrative output from the official quickstart:

technical
1.0
1.0

Actual results can vary. With the current criteria, the frustration levels are indexed from 0 to 2; urgency ranges from 0 to 1 and is a probability, not a Boolean.

Customize the Example

Edit src/main.py to try different inputs:

  • Change ticket to another synthetic support message.
  • Update the department criteria to match your support teams.
  • Adjust the ordered frustration descriptions to reflect your evaluation scale.
  • Change the urgency instructions to express the condition you want to evaluate.

The current example reads its input from the source file; it does not accept command-line arguments or interactive input.

Project Structure

src/main.py       # Ticket evaluation and printed results
pyproject.toml   # Project metadata and dependencies
uv.lock          # Locked dependency versions
.python-version # Local Python version selection
.env.example     # Environment variable template
AGENTS.md        # Contributor guidelines

Development

Check Python syntax without sending an API request:

uv run python -m compileall src

No automated test suite, formatter, or linter is configured yet. Running the example performs a live API request.

Use the direct script command above: packaging is currently disabled, and the console entry point declared in pyproject.toml references a module that is not present.

See AGENTS.md for contributor guidelines and the TypeSafe Python SDK documentation for further API usage.

Contributors

damingerdai

Issues