DecisionModels
Java SDK reference for decision models: methods create, decide, delete, get, list, update.
Methods on this page are called as client.decisionModels.<method>(...) on a Goodmem instance.
Class — ai.pairsys.goodmem.client.api.DecisionModelsAPI (extends internal DecisionModelsAPIBase).
import ai.pairsys.goodmem.client.Goodmem;
try (Goodmem client = Goodmem.builder()
.baseUrl("http://localhost:8080")
.apiKey("gm_...")
.build()) {
// client.decisionModels.<method>(...)
}Async variants
Every method listed below also exists on ai.pairsys.goodmem.client.api.AsyncDecisionModelsAPI (accessed via asyncClient.decisionModels on an AsyncGoodmem) with the same parameter list, wrapped in CompletableFuture<T>. Paginated list methods return CompletableFuture<AsyncPage<T>>. See the async client guide for composition patterns.
import ai.pairsys.goodmem.client.AsyncGoodmem;
try (AsyncGoodmem asyncClient = AsyncGoodmem.builder()
.baseUrl("http://localhost:8080")
.apiKey("gm_...")
.build()) {
asyncClient.decisionModels.<method>(...) // returns CompletableFuture<T>
}Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
DecisionModelResponse | create(CreateDecisionModelRequest) | Create a decision model |
DecisionResponse | decide(String, DecisionRequest) | Request decisions from a model |
void | delete(String) | Delete a decision model |
DecisionModelResponse | get(String, DecisionModelGetOptions) | Get a decision model |
ListDecisionModelsResponse | list(DecisionModelListOptions) | List decision models |
DecisionModelResponse | update(String, UpdateDecisionModelRequest) | Update a decision model |
Method Detail
create(CreateDecisionModelRequest)
DecisionModelResponse create(CreateDecisionModelRequest request)Saves the connection settings for a decision model. Requires CREATE_DECISION_MODEL for the new model and its owner. You can register the same provider connection more than once, but each registration must have a unique UUID. Credentials are omitted from the response.
HTTP: POST /v1/decision-models
Parameters:
request(CreateDecisionModelRequest) — full request payload. The linked Javadoc lists every field and itsBuildersetter.
Returns: DecisionModelResponse
Throws:
GoodmemException— base type for every SDK error. A concrete HTTP-status subclass (ApiException,NotFoundException,BadRequestException, …) is thrown per response code. All unchecked (RuntimeException). See Errors.
See Also:
DecisionModelsAPIBase.create(CreateDecisionModelRequest)on javadoc.io
Example
DecisionModelResponse decisionModelResponse = client.decisionModels.create(CreateDecisionModelRequest.builder()
// …set required fields…
.build());REST equivalent
curl -X POST 'http://localhost:8080/v1/decision-models' \
-H "x-api-key: gm_..." \
-H "Content-Type: application/json" \
-d '{
"displayName": "Doc decision model",
"providerType": "LAYA",
"endpointUrl": "http://localhost:8000",
"modelIdentifier": "laya",
"monitoringEndpoint": "http://localhost:8000/health"
}'decide(String, DecisionRequest)
DecisionResponse decide(String id, DecisionRequest request)Sends the supplied questions and content to the registered provider. Requires READ_DECISION_MODEL and EXECUTE_DECISION_MODEL. Each request calls the provider once and may incur charges, so do not retry automatically. GoodMem does not store the input or answers. Unsupported questions or media return 400. Problems with the stored provider credentials or settings return 412.
HTTP: POST /v1/decision-models/{id}/decide
Parameters:
id(String) — UUID of the decision modelrequest(DecisionRequest) — full request payload. The linked Javadoc lists every field and itsBuildersetter.
Returns: DecisionResponse
Throws:
GoodmemException— base type for every SDK error. A concrete HTTP-status subclass (ApiException,NotFoundException,BadRequestException, …) is thrown per response code. All unchecked (RuntimeException). See Errors.
See Also:
DecisionModelsAPIBase.decide(String, DecisionRequest)on javadoc.io
Example
DecisionResponse decisionResponse = client.decisionModels.decide("...", DecisionRequest.builder()
// …set required fields…
.build());REST equivalent
curl -X POST 'http://localhost:8080/v1/decision-models/{id}/decide' \
-H "x-api-key: gm_..." \
-H "Content-Type: application/json" \
-d '{
"state": {
"text": "The account has been verified."
},
"questions": {
"verified": {
"instructions": {
"text": "Is the account verified?"
},
"noul": {}
}
}
}'delete(String)
void delete(String id)Removes the decision model from GoodMem. Requires DELETE_DECISION_MODEL. This does not contact or delete the model at the provider. Returns 404 if the registration has already been deleted.
HTTP: DELETE /v1/decision-models/{id}
Parameters:
id(String) — UUID of the decision model
Returns: None (HTTP 204).
Throws:
GoodmemException— base type for every SDK error. A concrete HTTP-status subclass (ApiException,NotFoundException,BadRequestException, …) is thrown per response code. All unchecked (RuntimeException). See Errors.
See Also:
DecisionModelsAPIBase.delete(String)on javadoc.io
Example
client.decisionModels.delete("...");REST equivalent
curl -X DELETE 'http://localhost:8080/v1/decision-models/{id}' \
-H "x-api-key: gm_..."get(String, DecisionModelGetOptions)
DecisionModelResponse get(String id, DecisionModelGetOptions options)Returns the connection settings and supported features of a decision model. Requires READ_DECISION_MODEL. Set includeCredentials=true to include stored credentials; this also requires READ_DECISION_MODEL_CREDENTIALS. Returns 404 if the model does not exist, or 403 if it exists but you lack permission.
HTTP: GET /v1/decision-models/{id}
Parameters:
id(String) — UUID of the decision modeloptions(DecisionModelGetOptions, optional) — typed query parameters; passnullfor an empty filter set. The linked Javadoc lists every field.
Returns: DecisionModelResponse
Throws:
GoodmemException— base type for every SDK error. A concrete HTTP-status subclass (ApiException,NotFoundException,BadRequestException, …) is thrown per response code. All unchecked (RuntimeException). See Errors.
See Also:
Example
DecisionModelResponse decisionModelResponse = client.decisionModels.get("...", DecisionModelGetOptions.builder().build());REST equivalent
curl -X GET 'http://localhost:8080/v1/decision-models/{id}' \
-H "x-api-key: gm_..."list(DecisionModelListOptions)
ListDecisionModelsResponse list(DecisionModelListOptions options)Lists decision models that you have permission to read. Requires LIST_DECISION_MODEL for the instance and READ_DECISION_MODEL for each returned model. Results are ordered by creation time, newest first, with UUID descending to break ties. Credentials are omitted.
LABEL FILTERS: Label filters accept either label.<key>=<value> or label[key]=value (for example, label.environment=production or label[environment]=production).
HTTP: GET /v1/decision-models
Parameters:
options(DecisionModelListOptions, optional) — typed query parameters; passnullfor an empty filter set. The linked Javadoc lists every field.
Returns: ListDecisionModelsResponse
Throws:
GoodmemException— base type for every SDK error. A concrete HTTP-status subclass (ApiException,NotFoundException,BadRequestException, …) is thrown per response code. All unchecked (RuntimeException). See Errors.
See Also:
DecisionModelsAPIBase.list(DecisionModelListOptions)on javadoc.io
Example
ListDecisionModelsResponse listDecisionModelsResponse = client.decisionModels.list(DecisionModelListOptions.builder().build());REST equivalent
curl -X GET 'http://localhost:8080/v1/decision-models' \
-H "x-api-key: gm_..."update(String, UpdateDecisionModelRequest)
DecisionModelResponse update(String id, UpdateDecisionModelRequest request)Changes only the fields supplied in the request. Requires UPDATE_DECISION_MODEL. Send an empty string to clear description, version, or monitoringEndpoint. A supplied configuration replaces all existing settings; use {} to reset them to defaults. The provider and owner cannot be changed. Credentials are omitted from the response.
HTTP: PUT /v1/decision-models/{id}
Parameters:
id(String) — UUID of the decision modelrequest(UpdateDecisionModelRequest) — full request payload. The linked Javadoc lists every field and itsBuildersetter.
Returns: DecisionModelResponse
Throws:
GoodmemException— base type for every SDK error. A concrete HTTP-status subclass (ApiException,NotFoundException,BadRequestException, …) is thrown per response code. All unchecked (RuntimeException). See Errors.
See Also:
Example
DecisionModelResponse decisionModelResponse = client.decisionModels.update("...", UpdateDecisionModelRequest.builder()
// …set required fields…
.build());REST equivalent
curl -X PUT 'http://localhost:8080/v1/decision-models/{id}' \
-H "x-api-key: gm_..." \
-H "Content-Type: application/json" \
-d '{
"displayName": "Updated decision model"
}'Errors
Every method on this page may throw the standard HTTP-error class hierarchy rooted at GoodmemException:
BadRequestException (400), AuthenticationException (401), PermissionDeniedException (403), NotFoundException (404), ConflictException (409), UnprocessableEntityException (422), RateLimitException (429), InternalServerException (5xx), or the generic ApiException for any other 4xx/5xx. All are unchecked (RuntimeException). See Errors.
All error classes live in ai.pairsys.goodmem.client.errors and are unchecked (RuntimeException). Async siblings complete the returned CompletableFuture exceptionally with the same types, wrapped in CompletionException at await time. See Errors on the index for the full table.