GoodMemGoodMem
ReferenceClient SDKs.NET

Decision Models

.NET SDK reference for decision models: methods create, decide, delete, get, list, update.

Decision-model registration and typed evaluation.

Namespace: Goodmem.Client.Api · Class: DecisionModelsApi

Reach this surface as client.DecisionModels on a GoodmemClient. Every network method is asynchronous — it returns a Task<T> (or an IAsyncEnumerable<T> for pagination and streaming) and accepts a CancellationToken; the Async suffix marks the standard .NET Task-based async pattern.

Methods

MethodSummary
CreateAsyncCreate a decision model.
GetAsyncGet a decision model.
ListAsyncList decision models.
UpdateAsyncUpdate a decision model.
DeleteAsyncDelete a decision model.
DecideAsyncRequest decisions from a model.

CreateAsync

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.

Declaration

public Task<DecisionModelResponse> CreateAsync(CreateDecisionModelRequest request, CancellationToken ct = default)

HTTP — POST /v1/decision-models

Parameters

TypeNameDescription
CreateDecisionModelRequestrequestThe request payload; the linked model lists every field and its JSON wire name.
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<DecisionModelResponse> — an awaitable that resolves to DecisionModelResponse.

Exceptions

TypeCondition
ArgumentNullExceptionrequest is null.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

var model = await client.DecisionModels.CreateAsync(new CreateDecisionModelRequest {
    DisplayName = "Doc decision model", ProviderType = DecisionModelProviderType.Laya,
    EndpointUrl = "http://localhost:8000", ModelIdentifier = "laya",
    MonitoringEndpoint = "http://localhost:8000/health",
});


GetAsync

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.

Declaration

public Task<DecisionModelResponse> GetAsync(string id, DecisionModelsGetOptions? options = null, CancellationToken ct = default)

HTTP — GET /v1/decision-models/&#123;id&#125;

Parameters

TypeNameDescription
stringidUUID of the decision model
DecisionModelsGetOptionsoptionsOptions bag carrying the lookup key(s) / convenience knobs; the linked type lists them all. (optional)
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<DecisionModelResponse> — an awaitable that resolves to DecisionModelResponse.

Exceptions

TypeCondition
ArgumentExceptionid is null or empty.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

var fetched = await client.DecisionModels.GetAsync("your-decision-model-id");


ListAsync

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

Declaration

public Task<ListDecisionModelsResponse> ListAsync(DecisionModelsListOptions? options = null, CancellationToken ct = default)

HTTP — GET /v1/decision-models

Parameters

TypeNameDescription
DecisionModelsListOptionsoptionsOptions bag carrying the lookup key(s) / convenience knobs; the linked type lists them all. (optional)
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<ListDecisionModelsResponse> — an awaitable that resolves to ListDecisionModelsResponse.

Exceptions

TypeCondition
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

var page = await client.DecisionModels.ListAsync(new() { ProviderType = DecisionModelProviderType.Laya, PageSize = 20 });
Console.WriteLine($"{page.TotalCount} {page.NextPageToken}");


UpdateAsync

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.

Declaration

public Task<DecisionModelResponse> UpdateAsync(string id, UpdateDecisionModelRequest request, CancellationToken ct = default)

HTTP — PUT /v1/decision-models/&#123;id&#125;

Parameters

TypeNameDescription
stringidUUID of the decision model
UpdateDecisionModelRequestrequestThe request payload; the linked model lists every field and its JSON wire name.
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<DecisionModelResponse> — an awaitable that resolves to DecisionModelResponse.

Exceptions

TypeCondition
ArgumentExceptionid is null or empty.
ArgumentNullExceptionrequest is null.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

await client.DecisionModels.UpdateAsync("your-decision-model-id", new() { DisplayName = "Updated decision model" });


DeleteAsync

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.

Declaration

public Task DeleteAsync(string id, CancellationToken ct = default)

HTTP — DELETE /v1/decision-models/&#123;id&#125;

Parameters

TypeNameDescription
stringidUUID of the decision model
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task — completes when the operation finishes; there is no response body.

Exceptions

TypeCondition
ArgumentExceptionid is null or empty.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

await client.DecisionModels.DeleteAsync("your-decision-model-id");


DecideAsync

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.

Declaration

public Task<DecisionResponse> DecideAsync(string id, DecisionRequest request, CancellationToken ct = default)

HTTP — POST /v1/decision-models/&#123;id&#125;/decide

Parameters

TypeNameDescription
stringidUUID of the decision model
DecisionRequestrequestThe request payload; the linked model lists every field and its JSON wire name.
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<DecisionResponse> — an awaitable that resolves to DecisionResponse.

Exceptions

TypeCondition
ArgumentExceptionid is null or empty.
ArgumentNullExceptionrequest is null.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409).

Example

var result = await client.DecisionModels.DecideAsync("your-evaluation-model-id", new() {
    State = DecisionContent.OfText("The account has been verified."),
    Questions = new Dictionary<string, DecisionQuestion> {
        ["verified"] = new() {
            Instructions = DecisionContent.OfText("Is the account verified?"),
            Noul = new(),
        },
    },
});
Console.WriteLine(result.Answers["verified"].Noul!.ProbabilityTrue);


Data Models

Types in the Goodmem.Client.Models namespace. Each row lists the C# property, its type, the JSON wire name, and a description.

CreateDecisionModelRequest

Connection settings for a new decision model.

PropertyTypeJSON (wire)Description
DisplayNamestringdisplayNameName shown in the console and CLI.
DescriptionstringdescriptionOptional description. (optional)
ProviderTypeDecisionModelProviderTypeproviderTypeProvider used by this model. This cannot be changed after creation.
EndpointUrlstringendpointUrlBase URL of the provider, starting with http:// or https://. Do not include a query string, fragment, or username and password.
ApiPathstringapiPathPath appended to endpointUrl when sending a request. Jev and Laya use /v1/systemone if omitted. Clef requires the path for your account and model. (optional)
ModelIdentifierstringmodelIdentifierModel identifier accepted by the provider.
CredentialsEndpointAuthenticationcredentialsAPI key for the provider, supplied in credentials.apiKey.inlineSecret with kind set to CREDENTIAL_KIND_API_KEY. May be omitted for Laya when the endpoint allows anonymous access. (optional)
ConfigurationIReadOnlyDictionary<string, object>configurationProvider settings. Supported keys are image_preview (Jev only), timeout_millis, and max_response_bytes. These settings cannot change which features the model supports. (optional)
LabelsIReadOnlyDictionary<string, string>labelsLabels for filtering and organization. (optional)
VersionstringversionOptional version label. (optional)
MonitoringEndpointstringmonitoringEndpointOptional URL for the provider health or metrics endpoint. Must start with http:// or https://. (optional)
OwnerIdstringownerIdUUID of the principal that will own the model. If omitted, the authenticated principal becomes the owner. (optional)
DecisionModelIdstringdecisionModelIdOptional UUID for the new model. GoodMem generates one if omitted. A UUID that is already in use returns 409; reusing connection settings is allowed. (optional)

DecisionModelProviderType

Decision-model provider protocol.

String enum: "JEV" · "LAYA" · "CLEF"

DecisionModelResponse

Connection settings and supported features of a registered decision model.

PropertyTypeJSON (wire)Description
DecisionModelIdstringdecisionModelIdUUID of the decision model.
DisplayNamestringdisplayNameName shown in the console and CLI.
DescriptionstringdescriptionOptional description. (optional)
ProviderTypeDecisionModelProviderTypeproviderTypeProvider used by this model.
EndpointUrlstringendpointUrlProvider base URL.
ApiPathstringapiPathInference path appended to the base URL.
ModelIdentifierstringmodelIdentifierConfigured model identifier.
CredentialsEndpointAuthenticationcredentialsStored credentials. Returned only by get when includeCredentials=true and you have READ_DECISION_MODEL_CREDENTIALS permission. (optional)
ConfigurationIReadOnlyDictionary<string, object>configurationSettings used when calling the provider. These do not change which features the model supports.
LabelsIReadOnlyDictionary<string, string>labelsLabels for filtering and organization.
VersionstringversionOptional version label. (optional)
MonitoringEndpointstringmonitoringEndpointOptional HTTP(S) health or metrics URL. (optional)
OwnerIdstringownerIdUUID of the principal that owns this model.
CapabilitiesDecisionModelCapabilitiescapabilitiesSupported questions and media, known limits, and the meaning of each answer type.
CreatedAtDateTimeOffsetcreatedAtCreation time in milliseconds since epoch.
UpdatedAtDateTimeOffsetupdatedAtLast update time in milliseconds since epoch.
CreatedByIdstringcreatedByIdUUID of the principal or API key that created this model.
UpdatedByIdstringupdatedByIdUUID of the principal or API key that last updated this model.

DecisionModelCapabilities

Supported features and known limits for this provider and model. An omitted limit is unknown; it does not mean unlimited.

PropertyTypeJSON (wire)Description
QuestionTypesIReadOnlyList<string>questionTypesTypes of questions this model can answer.
MediaIReadOnlyList<DecisionMediaSupport>mediaSupported media formats, placements and known limits.
LimitsIReadOnlyList<DecisionLimit>limitsKnown numeric limits.
ContextBoundLimitsIReadOnlyList<string>contextBoundLimitsLimits that depend on the provider context window instead of a fixed count.
SemanticsIReadOnlyList<DecisionQuestionSemantics>semanticsMeaning of the answer and confidence value for each question type.
InputOverflowstringinputOverflowWhat the provider does when the input exceeds its context window.

DecisionMediaSupport

Media formats, placements and provider constraints.

PropertyTypeJSON (wire)Description
KindstringkindMedia category.
MimeTypesIReadOnlyList<string>mimeTypesAccepted MIME types.
PlacementsIReadOnlyList<string>placementsAllowed content positions.
LimitsIReadOnlyList<DecisionMediaLimit>limitsKnown limits for media. The provider checks dimensions and duration.

DecisionLimit

A known numeric limit.

PropertyTypeJSON (wire)Description
TypestringtypeLimit identifier.
ValuelongvalueKnown limit value.

DecisionQuestionSemantics

Meaning of the answer and confidence value for one question type.

PropertyTypeJSON (wire)Description
QuestionTypestringquestionTypeQuestion type.
ConfidencestringconfidenceHow to interpret the confidence value reported by the provider.
OutputstringoutputMeaning of the primary answer value.

DecisionMediaLimit

A known media limit.

PropertyTypeJSON (wire)Description
TypestringtypeMedia limit identifier.
ValuelongvalueKnown limit value.

DecisionRequest

Sends named questions and content to a registered decision model. The provider may charge for this request.

PropertyTypeJSON (wire)Description
StateDecisionContentstateContent evaluated by all questions.
AttachmentsIReadOnlyList<DecisionMedia>attachmentsMedia files included with the request. Their order is preserved within each media type. (optional)
QuestionsIReadOnlyDictionary<string, DecisionQuestion>questionsQuestions keyed by names that you choose. The model must support each question type and its media.

DecisionContent

Set exactly one of text, jsonValue, objectValue, arrayValue, or media. Use text for ordinary text. Use jsonValue to preserve a complete JSON value, including the exact precision of its numbers.

PropertyTypeJSON (wire)Description
JsonValuestringjsonValueA complete JSON value encoded as a string. For example, {"jsonValue":"null"} represents JSON null. For ordinary text, use the text field. (optional)
TextstringtextOrdinary text without JSON quoting. (optional)
ObjectValueDecisionObjectobjectValueObject whose fields can contain nested media. (optional)
ArrayValueDecisionArrayarrayValueOrdered array whose elements can contain nested media. (optional)
MediaDecisionMediamediaMedia file included in the request. GoodMem does not download media from URLs. (optional)

DecisionMedia

Media file included in the request. The provider and model determine which formats and sizes are supported.

PropertyTypeJSON (wire)Description
KindstringkindMedia category.
MimeTypestringmimeTypeDeclared MIME type.
Databyte[]dataBase64-encoded file bytes.

DecisionQuestion

Set exactly one of choice, score, noul, or box. Clef requires instructions for every question.

PropertyTypeJSON (wire)Description
InstructionsDecisionContentinstructionsInstructions for this question. Clef requires nonblank text, an object, or an array. Other providers allow omission; to supply JSON null, use {"jsonValue":"null"}. (optional)
ChoiceDecisionChoiceQuestionchoiceChoose one labeled option. (optional)
ScoreDecisionScoreQuestionscoreScore the content against a list of levels ordered from lowest to highest. (optional)
NoulDecisionNoulQuestionnoulEstimate the probability that a statement is true. (optional)
BoxDecisionBoxQuestionboxLocate an object in an image. A returned box does not guarantee that the object is present. (optional)

DecisionObject

Named decision content fields.

PropertyTypeJSON (wire)Description
FieldsIReadOnlyDictionary<string, DecisionContent>fieldsContent keyed by field name.

DecisionArray

Ordered decision content elements.

PropertyTypeJSON (wire)Description
ValuesIReadOnlyList<DecisionContent>valuesOrdered content elements.

DecisionChoiceQuestion

Choice options.

PropertyTypeJSON (wire)Description
OptionsIReadOnlyDictionary<string, DecisionContent>optionsOption identifiers and descriptions.

DecisionScoreQuestion

Ordered rubric levels.

PropertyTypeJSON (wire)Description
LevelsIReadOnlyList<DecisionContent>levelsDescriptions of the score levels, ordered from lowest to highest. The first level has index 0.

DecisionNoulQuestion

Optional true and false descriptions.

PropertyTypeJSON (wire)Description
TrueCriterionDecisionContenttrueCriterionDescription of the true outcome. (optional)
FalseCriterionDecisionContentfalseCriterionDescription of the false outcome. (optional)

DecisionBoxQuestion

Locate an object in an image. Use instructions to describe the object.

(no fields)

DecisionResponse

Structured provider answers with reported usage.

PropertyTypeJSON (wire)Description
ModelstringmodelProvider-reported model identifier.
AnswersIReadOnlyDictionary<string, DecisionAnswer>answersAnswers keyed by the original question identifiers.
UsageDecisionUsageusageToken counts reported by the provider. An omitted count is unknown; a count of 0 means the provider reported zero.

DecisionAnswer

Answer to one question. Exactly one of choice, score, noul, or box is present.

PropertyTypeJSON (wire)Description
ChoiceDecisionChoiceAnswerchoiceSelected option and the probability assigned to each option. (optional)
ScoreDecisionScoreAnswerscoreScore and the probability assigned to each score level. (optional)
NoulDecisionNoulAnswernoulProbability that the statement is true. (optional)
BoxDecisionBoxAnswerboxNormalized image coordinates. (optional)

DecisionUsage

Token usage reported by the provider. Counts are omitted when unknown.

PropertyTypeJSON (wire)Description
InputTokenslonginputTokensReported input tokens. (optional)
OutputTokenslongoutputTokensReported output tokens. (optional)

DecisionChoiceAnswer

Selected option and probability distribution.

PropertyTypeJSON (wire)Description
ChoicestringchoiceSelected option identifier.
ProbabilitiesIReadOnlyDictionary<string, double>probabilitiesProbability for every option.
ConfidencedoubleconfidenceConfidence reported by the provider. This is not a calibrated probability that the answer is correct. (optional)
ConfidenceMeaningstringconfidenceMeaningInterpretation of confidence.

DecisionScoreAnswer

Expected zero-based rubric level; not a percentage.

PropertyTypeJSON (wire)Description
ScoredoublescoreScore on the scale defined by levels. The first level has value 0, and fractional values fall between levels.
ProbabilitiesIReadOnlyDictionary<string, double>probabilitiesProbability assigned to each level, using its index starting at 0.
LevelsIReadOnlyList<DecisionContent>levelsOriginal caller rubric, including structured content and media.
ConfidencedoubleconfidenceConfidence reported by the provider. This is not a calibrated probability that the answer is correct. (optional)
ConfidenceMeaningstringconfidenceMeaningInterpretation of confidence.

DecisionNoulAnswer

Probability that the proposition is true.

PropertyTypeJSON (wire)Description
ProbabilityTruedoubleprobabilityTrueProbability that the statement is true. Your application decides what threshold to use.

DecisionBoxAnswer

Rectangle with coordinates expressed as fractions of the image width or height. A returned box does not guarantee that the object is present.

PropertyTypeJSON (wire)Description
LeftdoubleleftLeft edge as a fraction of image width.
TopdoubletopTop edge as a fraction of image height.
RightdoublerightRight edge as a fraction of image width.
BottomdoublebottomBottom edge as a fraction of image height.
ConfidencedoubleconfidenceOptional provider confidence. (optional)

ListDecisionModelsResponse

One page of decision models that you have permission to read.

PropertyTypeJSON (wire)Description
DecisionModelsIReadOnlyList<DecisionModelResponse>decisionModelsDecision models ordered by creation time, newest first, with UUID descending to break ties.
NextPageTokenstringnextPageTokenToken to pass as pageToken in the next request. Omitted when there are no more results. (optional)
TotalCountlongtotalCountTotal number of models that match the filters and that you have permission to read, across all pages.

UpdateDecisionModelRequest

Changes only the supplied fields. Omitted fields keep their current values. A supplied configuration replaces all existing provider settings.

PropertyTypeJSON (wire)Description
DisplayNamestringdisplayNameName shown in the console and CLI. (optional)
DescriptionstringdescriptionDescription of the model. Send an empty string to clear it, or omit it to keep the current value. (optional)
EndpointUrlstringendpointUrlBase URL of the provider, starting with http:// or https://. Do not include a query string, fragment, or username and password. (optional)
ApiPathstringapiPathPath appended to endpointUrl when sending a request. Omit it to keep the current path. An empty string resets Jev and Laya to /v1/systemone; Clef requires the path for your account and model. (optional)
ModelIdentifierstringmodelIdentifierModel identifier accepted by the provider. (optional)
CredentialsEndpointAuthenticationcredentialsReplacement API key for the provider, supplied in credentials.apiKey.inlineSecret with kind set to CREDENTIAL_KIND_API_KEY. Omit credentials to keep the current key. (optional)
ConfigurationIReadOnlyDictionary<string, object>configurationReplacement provider settings. Supported keys are image_preview (Jev only), timeout_millis, and max_response_bytes. Send {} to reset all settings to defaults, or omit configuration to keep the current settings. (optional)
VersionstringversionVersion label. Send an empty string to clear it, or omit it to keep the current value. (optional)
MonitoringEndpointstringmonitoringEndpointURL for the provider health or metrics endpoint. Must start with http:// or https://. Send an empty string to clear it, or omit it to keep the current value. (optional)
ReplaceLabelsIReadOnlyDictionary<string, string>replaceLabelsReplace all labels with this map. Send {} to remove all labels. Do not combine with mergeLabels. (optional)
MergeLabelsIReadOnlyDictionary<string, string>mergeLabelsAdd labels and replace the values of matching keys. Other labels are unchanged. Do not combine with replaceLabels. (optional)