1
Get your API key
First, sign up for a Semilattice account and create an API key from the dashboard.
2
Install
Install the Semilattice Python SDK:
3
Initialise the client
4
Choose a population model
Call the Alternatively, you can navigate to the populations page on your dashboard and select a population model to use. Copy the ID from the population’s metadata or from the address bar.
list
method on populations
to get a list of population models available for simulation.
Click to copy the population model's ID
5
Predict an answer
The
predictions.create
method simulates how this population would answer a question. Below, we are simulating how this population would respond to the question “Tech debt or unclear error messages, what’s worse?”.6
Handle the response
The API will return immediately, but the simulation runs asynchronously. The initial response will have a
status
field set to “Queued”:7
Poll for results
The simulation will progress through these statuses:
Queued
→ Running
→ Predicted
(or potentially Failed
). Predictions typically take less than 20 seconds.Poll for the result using the prediction ID:8
View the results
Once the simulation completes, the The
predicted_answer_percentages
field will contain the prediction results:predicted_answer_percentages
dictionary shows the predicted percentage of the population that would choose each answer option. In this example, 54.88% would choose “Tech debt” and 45.12% would choose “Unclear error messages”.