Create a decision
Decision decisions().create(DecisionCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/decisions
Use this endpoint to ask classification or scoring questions about the same input. You’ll get the answers back in the order you asked the questions.
For text, you can pass a string. You can also send user messages containing input_text and input_image parts, with up to 128 images per request. Images can be base64 data URLs or publicly accessible HTTP(S) URLs. File IDs aren’t accepted. Other message roles, function calls, files, audio, and item references aren’t supported.
Sometimes a question returns a refusal instead of an answer. The result has type refusal and includes the question’s name, or null if you didn’t give it one.
Create a decision
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.decisions.Decision;
import com.openai.models.decisions.DecisionCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
DecisionCreateParams params = DecisionCreateParams.builder()
.input("string")
.model("model")
.addPredicateQuestion("instructions")
.build();
Decision decision = client.decisions().create(params);
}
}{
"model": "gpt-6-luna",
"answers": [
{"type": "predicate", "name": "damaged", "probability": 0.95}
],
"usage": {
"input_tokens": 42,
"input_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0},
"output_tokens": 0,
"output_tokens_details": {"reasoning_tokens": 0},
"total_tokens": 42
}
}
Returns Examples
{
"model": "gpt-6-luna",
"answers": [
{"type": "predicate", "name": "damaged", "probability": 0.95}
],
"usage": {
"input_tokens": 42,
"input_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0},
"output_tokens": 0,
"output_tokens_details": {"reasoning_tokens": 0},
"total_tokens": 42
}
}