GoodMemGoodMem
ReferenceClient SDKsRust

DecisionModels

Rust decision_models API reference: typed methods, request options, return values, and resource models.

goodmem::api::DecisionModels

Access this service with client.decision_models().

pub struct DecisionModels<'a> {
    /* private fields */
}

Methods

MethodHTTPPath
createPOST/v1/decision-models
decidePOST/v1/decision-models/{id}/decide
deleteDELETE/v1/decision-models/{id}
getGET/v1/decision-models/{id}
listGET/v1/decision-models
updatePUT/v1/decision-models/{id}

Errors and cancellation

Calls return Result<T>. See Error for validation, HTTP, transport, decoding, and timeout failures. Stream items can also return errors after the call succeeds.

Pagination helpers fetch pages when polled. Drop a page or event stream to cancel further work.

Implementations

impl DecisionModels<'_>

create

pub async fn create(&self, body: &CreateDecisionModelRequest) -> Result<DecisionModelResponse>

Create a decision model

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.

Errors include local validation, HTTP failures, and malformed responses.

HTTP: POST /v1/decision-models

decide

pub async fn decide( &self, id: impl std::fmt::Display, body: &DecisionRequest, ) -> Result<DecisionResponse>

Request decisions from a model

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.

Errors include local validation, HTTP failures, and malformed responses.

HTTP: POST /v1/decision-models/{id}/decide

delete

pub async fn delete(&self, id: impl std::fmt::Display) -> Result<()>

Delete a decision model

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.

Errors include local validation, HTTP failures, and malformed responses.

HTTP: DELETE /v1/decision-models/{id}

get

pub async fn get( &self, id: impl std::fmt::Display, options: &DecisionModelsGetOptions, ) -> Result<DecisionModelResponse>

Get a decision model

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.

Errors include local validation, HTTP failures, and malformed responses.

HTTP: GET /v1/decision-models/{id}

list

pub async fn list( &self, options: &DecisionModelsListOptions, ) -> Result<ListDecisionModelsResponse>

List decision models

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).

Errors include local validation, HTTP failures, and malformed responses.

HTTP: GET /v1/decision-models

update

pub async fn update( &self, id: impl std::fmt::Display, body: &UpdateDecisionModelRequest, ) -> Result<DecisionModelResponse>

Update a decision model

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.

Errors include local validation, HTTP failures, and malformed responses.

HTTP: PUT /v1/decision-models/{id}

Types

Trait implementations

  • Clone (derived)
  • Copy (derived)
  • Debug (derived)

On this page