GoodMemGoodMem

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

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:

Returns: DecisionModelResponse

Throws:

See Also:

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/&#123;id&#125;/decide

Parameters:

  • id (String) — UUID of the decision model
  • request (DecisionRequest) — full request payload. The linked Javadoc lists every field and its Builder setter.

Returns: DecisionResponse

Throws:

See Also:

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/&#123;id&#125;

Parameters:

  • id (String) — UUID of the decision model

Returns: None (HTTP 204).

Throws:

See Also:

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/&#123;id&#125;

Parameters:

  • id (String) — UUID of the decision model
  • options (DecisionModelGetOptions, optional) — typed query parameters; pass null for an empty filter set. The linked Javadoc lists every field.

Returns: DecisionModelResponse

Throws:

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; pass null for an empty filter set. The linked Javadoc lists every field.

Returns: ListDecisionModelsResponse

Throws:

See Also:

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/&#123;id&#125;

Parameters:

  • id (String) — UUID of the decision model
  • request (UpdateDecisionModelRequest) — full request payload. The linked Javadoc lists every field and its Builder setter.

Returns: DecisionModelResponse

Throws:

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.