Skip to content

Configure DSPy and your data

Use the supplied classifier with your own supported dataset, or write a separate Python program with the installed base SDK. This configuration reference previews the Limited image.

Provider settings

The private file is /home/ubuntu/dspy-workspace/provider.json. Run the interactive helper as ubuntu. It accepts exactly model, api_base and api_key; the model starts with openai/. The endpoint must be remote HTTPS, without embedded URL credentials, query parameters or fragments. The customer CLI does not accept a loopback HTTP inference service. You may operate your own remote HTTPS endpoint.

Keep the file owned by ubuntu with mode 0600. To change it, retain a secure copy if needed, move the existing file within your workspace, then rerun the helper. It refuses existing files. Never place a key in arguments, history, source code, shared logs or screenshots.

Your own classifier dataset

Copy the included example before editing:

cp /opt/dspy/data.json /home/ubuntu/dspy-workspace/my-tickets.json

Run this as ubuntu. Each of train, validation and heldout is an array of 3–24 rows. Each split covers billing, account and technical. Each row has exactly id, text and label; IDs are nonempty strings up to 64 characters, and text is nonempty and at most 2,000 characters. IDs and normalized ticket text are unique across all splits. Decide splits before tuning and reserve heldout examples for final evaluation.

Use a new output directory for every task:

sushi-dspy --data /home/ubuntu/dspy-workspace/my-tickets.json \
  --output /home/ubuntu/dspy-results/my-classifier-run

Independently reread the result:

/usr/bin/python3 -I -B /opt/dspy/readback.py \
  /home/ubuntu/dspy-results/my-classifier-run --require-provider

The request count is 3 × validation rows + 2 × heldout rows. selected_k records the requested demonstration cap; the saved demonstration count can be smaller when training has fewer rows. A low score remains a valid result.

Your own Python program

Keep programs and data in your Ubuntu-owned workspace. Run them with the managed SDK interpreter at /opt/dspy/venv/bin/python. The classifier CLI's three-label and dataset-size rules do not constrain a separately authored SDK program. No local model, deployment server or all-optional-extras installation is implied by the base SDK.

To reuse the saved classifier JSON, construct the same signature as /opt/dspy/runtime.py, load program.json with predictor.load(...) and configure your endpoint separately. Load only program files you trust. This workflow saves JSON state and does not load executable pickle bundles. Keep the root-owned runtime intact; use a separately managed environment for dependency changes.

Last updated November 16, 2026 · Suggest an improvement