Class OpenAiOfficialDecisionModel
java.lang.Object
dev.langchain4j.model.openaiofficial.OpenAiOfficialDecisionModel
- All Implemented Interfaces:
DecisionModel
A
DecisionModel backed by the OpenAI
Decisions API, using the official OpenAI Java SDK. It answers yes/no, choice and scale questions about a text
or image input with probabilities.
DecisionModel model = OpenAiOfficialDecisionModel.builder()
.apiKey(System.getenv("OPENAI_API_KEY"))
.modelName("gpt-6-luna")
.build();
The input can be text, a Map (sent as JSON text), or a list of
TextContents and ImageContents. Images
must be inline (base64 data or data URLs): images referenced by URL are not supported by the API. The image detail
levels LOW, HIGH and AUTO are supported.
The API can refuse to answer a single question, for example because it goes against the usage policies of
OpenAI: the answer to that question is then a RefusalAnswer.
- Since:
- 1.22.0
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()The model's default per-call parameters, applied to every request and overridden by any parameters set on the request itself.doDecide(DecisionRequest request) The provider hook behindDecisionModel.decide(DecisionRequest).doDecideAsync(DecisionRequest request) The provider hook behindDecisionModel.decideAsync(DecisionRequest).The listeners notified of every request, response and error of this model.provider()The provider of this model.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DecisionModel
decide, decideAsync, modelName
-
Constructor Details
-
OpenAiOfficialDecisionModel
-
-
Method Details
-
doDecide
Description copied from interface:DecisionModelThe provider hook behindDecisionModel.decide(DecisionRequest).- Specified by:
doDecidein interfaceDecisionModel- Parameters:
request- the request, with the default parameters already applied.- Returns:
- one answer per question, keyed by question name.
-
doDecideAsync
Description copied from interface:DecisionModelThe provider hook behindDecisionModel.decideAsync(DecisionRequest). The default returns a failed future: a model that is not genuinely asynchronous does not pretend to be.- Specified by:
doDecideAsyncin interfaceDecisionModel- Parameters:
request- the request, with the default parameters already applied.- Returns:
- a
CompletableFutureof the answers, keyed by question name.
-
defaultRequestParameters
Description copied from interface:DecisionModelThe model's default per-call parameters, applied to every request and overridden by any parameters set on the request itself. The default isDecisionRequestParameters.EMPTY.- Specified by:
defaultRequestParametersin interfaceDecisionModel
-
listeners
Description copied from interface:DecisionModelThe listeners notified of every request, response and error of this model.- Specified by:
listenersin interfaceDecisionModel
-
provider
Description copied from interface:DecisionModelThe provider of this model.- Specified by:
providerin interfaceDecisionModel
-
builder
-