Start Jevaro, evaluate three customer messages, and read the Arrow results from Python and JavaScript.
You need Python 3.11+, Node.js 22+ for the JavaScript example, and a TypeSafe API key. Use a Unix shell. The checkout contains the Python example. Install the packages from PyPI and npm. If you already have a checkout, start at its root and skip the clone commands.
git clone https://github.com/columnar-tech/jevaro.git
cd jevaro
python3 -m venv .venv
.venv/bin/python -m pip install jevaro-server jevaro
export TYPESAFE_API_KEY="your-api-key"
.venv/bin/jevaro-serverLeave this terminal running. The server listens on http://127.0.0.1:8000.
It supplies the API key for requests that do not send their own.
Open a second terminal at the repository root:
export TYPESAFE_BASE_URL="http://127.0.0.1:8000"
.venv/bin/python jevaro-python/example.py --output jevaro-results.arrowsThe example sends a refund request, a missing parcel report, and a duplicate charge report. All three use these questions:
| Question | Type | Result |
|---|---|---|
department |
Choice | Which team should handle the message |
urgency |
Score | How soon the customer wants a resolution |
refund |
Noul | Probability that the customer requests a refund |
The script prints three JSON lines and saves the full answers in
jevaro-results.arrows. --output replaces that file if it exists. Results
stay in the same order as the states.
.venv/bin/python - <<'PY'
import json
import pyarrow as pa
with pa.ipc.open_stream("jevaro-results.arrows") as reader:
for field in reader.schema:
print(field.name, field.type)
print(json.loads(field.metadata[b"ARROW:extension:metadata"]))
print("Rows:", sum(batch.num_rows for batch in reader))
PYYou should see three columns and Rows: 3. The Choice labels and Score
legend appear once in the schema. The first record batch is empty; it lets
the schema arrive before any Jev answers.
To print full answer objects, including named probabilities:
.venv/bin/python scripts/read_results.py jevaro-results.arrowsThis reads only the file. It needs PyArrow, with no API key or original question definitions. See the Arrow schema for the format.
With the server still running:
mkdir -p local/javascript-example
npm install --prefix local/javascript-example jevaro
node local/javascript-example/node_modules/jevaro/example.mjsThe JavaScript example uses the same three states and questions. These commands run the copy installed from npm. It streams the results and resolves Choice labels from the schema. This makes three new evaluations; running both examples makes six evaluations in total and incurs TypeSafe's normal API charges.
Edit STATES and QUESTIONS in the Python example, or copy the JavaScript
example into your app and edit its states and questions. Use state for
one evaluation and states for many.
Stop the server with Ctrl-C when finished.
If a stream fails, see errors. A response with status 200 can still fail while the body is being read.