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
| Method | Summary |
|---|---|
CreateAsync | Create a decision model. |
GetAsync | Get a decision model. |
ListAsync | List decision models. |
UpdateAsync | Update a decision model. |
DeleteAsync | Delete a decision model. |
DecideAsync | Request 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
| Type | Name | Description |
|---|---|---|
CreateDecisionModelRequest | request | The request payload; the linked model lists every field and its JSON wire name. |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task<DecisionModelResponse> — an awaitable that resolves to DecisionModelResponse.
Exceptions
| Type | Condition |
|---|---|
ArgumentNullException | request is null. |
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The 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/{id}
Parameters
| Type | Name | Description |
|---|---|---|
string | id | UUID of the decision model |
DecisionModelsGetOptions | options | Options bag carrying the lookup key(s) / convenience knobs; the linked type lists them all. (optional) |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task<DecisionModelResponse> — an awaitable that resolves to DecisionModelResponse.
Exceptions
| Type | Condition |
|---|---|
ArgumentException | id is null or empty. |
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The 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
| Type | Name | Description |
|---|---|---|
DecisionModelsListOptions | options | Options bag carrying the lookup key(s) / convenience knobs; the linked type lists them all. (optional) |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task<ListDecisionModelsResponse> — an awaitable that resolves to ListDecisionModelsResponse.
Exceptions
| Type | Condition |
|---|---|
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The 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/{id}
Parameters
| Type | Name | Description |
|---|---|---|
string | id | UUID of the decision model |
UpdateDecisionModelRequest | request | The request payload; the linked model lists every field and its JSON wire name. |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task<DecisionModelResponse> — an awaitable that resolves to DecisionModelResponse.
Exceptions
| Type | Condition |
|---|---|
ArgumentException | id is null or empty. |
ArgumentNullException | request is null. |
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The 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/{id}
Parameters
| Type | Name | Description |
|---|---|---|
string | id | UUID of the decision model |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task — completes when the operation finishes; there is no response body.
Exceptions
| Type | Condition |
|---|---|
ArgumentException | id is null or empty. |
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The 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/{id}/decide
Parameters
| Type | Name | Description |
|---|---|---|
string | id | UUID of the decision model |
DecisionRequest | request | The request payload; the linked model lists every field and its JSON wire name. |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task<DecisionResponse> — an awaitable that resolves to DecisionResponse.
Exceptions
| Type | Condition |
|---|---|
ArgumentException | id is null or empty. |
ArgumentNullException | request is null. |
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The 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.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
DisplayName | string | displayName | Name shown in the console and CLI. |
Description | string | description | Optional description. (optional) |
ProviderType | DecisionModelProviderType | providerType | Provider used by this model. This cannot be changed after creation. |
EndpointUrl | string | endpointUrl | Base URL of the provider, starting with http:// or https://. Do not include a query string, fragment, or username and password. |
ApiPath | string | apiPath | Path 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) |
ModelIdentifier | string | modelIdentifier | Model identifier accepted by the provider. |
Credentials | EndpointAuthentication | credentials | API 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) |
Configuration | IReadOnlyDictionary<string, object> | configuration | Provider settings. Supported keys are image_preview (Jev only), timeout_millis, and max_response_bytes. These settings cannot change which features the model supports. (optional) |
Labels | IReadOnlyDictionary<string, string> | labels | Labels for filtering and organization. (optional) |
Version | string | version | Optional version label. (optional) |
MonitoringEndpoint | string | monitoringEndpoint | Optional URL for the provider health or metrics endpoint. Must start with http:// or https://. (optional) |
OwnerId | string | ownerId | UUID of the principal that will own the model. If omitted, the authenticated principal becomes the owner. (optional) |
DecisionModelId | string | decisionModelId | Optional 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.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
DecisionModelId | string | decisionModelId | UUID of the decision model. |
DisplayName | string | displayName | Name shown in the console and CLI. |
Description | string | description | Optional description. (optional) |
ProviderType | DecisionModelProviderType | providerType | Provider used by this model. |
EndpointUrl | string | endpointUrl | Provider base URL. |
ApiPath | string | apiPath | Inference path appended to the base URL. |
ModelIdentifier | string | modelIdentifier | Configured model identifier. |
Credentials | EndpointAuthentication | credentials | Stored credentials. Returned only by get when includeCredentials=true and you have READ_DECISION_MODEL_CREDENTIALS permission. (optional) |
Configuration | IReadOnlyDictionary<string, object> | configuration | Settings used when calling the provider. These do not change which features the model supports. |
Labels | IReadOnlyDictionary<string, string> | labels | Labels for filtering and organization. |
Version | string | version | Optional version label. (optional) |
MonitoringEndpoint | string | monitoringEndpoint | Optional HTTP(S) health or metrics URL. (optional) |
OwnerId | string | ownerId | UUID of the principal that owns this model. |
Capabilities | DecisionModelCapabilities | capabilities | Supported questions and media, known limits, and the meaning of each answer type. |
CreatedAt | DateTimeOffset | createdAt | Creation time in milliseconds since epoch. |
UpdatedAt | DateTimeOffset | updatedAt | Last update time in milliseconds since epoch. |
CreatedById | string | createdById | UUID of the principal or API key that created this model. |
UpdatedById | string | updatedById | UUID 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.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
QuestionTypes | IReadOnlyList<string> | questionTypes | Types of questions this model can answer. |
Media | IReadOnlyList<DecisionMediaSupport> | media | Supported media formats, placements and known limits. |
Limits | IReadOnlyList<DecisionLimit> | limits | Known numeric limits. |
ContextBoundLimits | IReadOnlyList<string> | contextBoundLimits | Limits that depend on the provider context window instead of a fixed count. |
Semantics | IReadOnlyList<DecisionQuestionSemantics> | semantics | Meaning of the answer and confidence value for each question type. |
InputOverflow | string | inputOverflow | What the provider does when the input exceeds its context window. |
DecisionMediaSupport
Media formats, placements and provider constraints.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Kind | string | kind | Media category. |
MimeTypes | IReadOnlyList<string> | mimeTypes | Accepted MIME types. |
Placements | IReadOnlyList<string> | placements | Allowed content positions. |
Limits | IReadOnlyList<DecisionMediaLimit> | limits | Known limits for media. The provider checks dimensions and duration. |
DecisionLimit
A known numeric limit.
DecisionQuestionSemantics
Meaning of the answer and confidence value for one question type.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
QuestionType | string | questionType | Question type. |
Confidence | string | confidence | How to interpret the confidence value reported by the provider. |
Output | string | output | Meaning of the primary answer value. |
DecisionMediaLimit
A known media limit.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Type | string | type | Media limit identifier. |
Value | long | value | Known limit value. |
DecisionRequest
Sends named questions and content to a registered decision model. The provider may charge for this request.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
State | DecisionContent | state | Content evaluated by all questions. |
Attachments | IReadOnlyList<DecisionMedia> | attachments | Media files included with the request. Their order is preserved within each media type. (optional) |
Questions | IReadOnlyDictionary<string, DecisionQuestion> | questions | Questions 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.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
JsonValue | string | jsonValue | A complete JSON value encoded as a string. For example, {"jsonValue":"null"} represents JSON null. For ordinary text, use the text field. (optional) |
Text | string | text | Ordinary text without JSON quoting. (optional) |
ObjectValue | DecisionObject | objectValue | Object whose fields can contain nested media. (optional) |
ArrayValue | DecisionArray | arrayValue | Ordered array whose elements can contain nested media. (optional) |
Media | DecisionMedia | media | Media 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.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Kind | string | kind | Media category. |
MimeType | string | mimeType | Declared MIME type. |
Data | byte[] | data | Base64-encoded file bytes. |
DecisionQuestion
Set exactly one of choice, score, noul, or box. Clef requires instructions for every question.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Instructions | DecisionContent | instructions | Instructions for this question. Clef requires nonblank text, an object, or an array. Other providers allow omission; to supply JSON null, use {"jsonValue":"null"}. (optional) |
Choice | DecisionChoiceQuestion | choice | Choose one labeled option. (optional) |
Score | DecisionScoreQuestion | score | Score the content against a list of levels ordered from lowest to highest. (optional) |
Noul | DecisionNoulQuestion | noul | Estimate the probability that a statement is true. (optional) |
Box | DecisionBoxQuestion | box | Locate an object in an image. A returned box does not guarantee that the object is present. (optional) |
DecisionObject
Named decision content fields.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Fields | IReadOnlyDictionary<string, DecisionContent> | fields | Content keyed by field name. |
DecisionArray
Ordered decision content elements.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Values | IReadOnlyList<DecisionContent> | values | Ordered content elements. |
DecisionChoiceQuestion
Choice options.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Options | IReadOnlyDictionary<string, DecisionContent> | options | Option identifiers and descriptions. |
DecisionScoreQuestion
Ordered rubric levels.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Levels | IReadOnlyList<DecisionContent> | levels | Descriptions of the score levels, ordered from lowest to highest. The first level has index 0. |
DecisionNoulQuestion
Optional true and false descriptions.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
TrueCriterion | DecisionContent | trueCriterion | Description of the true outcome. (optional) |
FalseCriterion | DecisionContent | falseCriterion | Description 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.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Model | string | model | Provider-reported model identifier. |
Answers | IReadOnlyDictionary<string, DecisionAnswer> | answers | Answers keyed by the original question identifiers. |
Usage | DecisionUsage | usage | Token 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.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Choice | DecisionChoiceAnswer | choice | Selected option and the probability assigned to each option. (optional) |
Score | DecisionScoreAnswer | score | Score and the probability assigned to each score level. (optional) |
Noul | DecisionNoulAnswer | noul | Probability that the statement is true. (optional) |
Box | DecisionBoxAnswer | box | Normalized image coordinates. (optional) |
DecisionUsage
Token usage reported by the provider. Counts are omitted when unknown.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
InputTokens | long | inputTokens | Reported input tokens. (optional) |
OutputTokens | long | outputTokens | Reported output tokens. (optional) |
DecisionChoiceAnswer
Selected option and probability distribution.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Choice | string | choice | Selected option identifier. |
Probabilities | IReadOnlyDictionary<string, double> | probabilities | Probability for every option. |
Confidence | double | confidence | Confidence reported by the provider. This is not a calibrated probability that the answer is correct. (optional) |
ConfidenceMeaning | string | confidenceMeaning | Interpretation of confidence. |
DecisionScoreAnswer
Expected zero-based rubric level; not a percentage.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Score | double | score | Score on the scale defined by levels. The first level has value 0, and fractional values fall between levels. |
Probabilities | IReadOnlyDictionary<string, double> | probabilities | Probability assigned to each level, using its index starting at 0. |
Levels | IReadOnlyList<DecisionContent> | levels | Original caller rubric, including structured content and media. |
Confidence | double | confidence | Confidence reported by the provider. This is not a calibrated probability that the answer is correct. (optional) |
ConfidenceMeaning | string | confidenceMeaning | Interpretation of confidence. |
DecisionNoulAnswer
Probability that the proposition is true.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
ProbabilityTrue | double | probabilityTrue | Probability 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.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Left | double | left | Left edge as a fraction of image width. |
Top | double | top | Top edge as a fraction of image height. |
Right | double | right | Right edge as a fraction of image width. |
Bottom | double | bottom | Bottom edge as a fraction of image height. |
Confidence | double | confidence | Optional provider confidence. (optional) |
ListDecisionModelsResponse
One page of decision models that you have permission to read.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
DecisionModels | IReadOnlyList<DecisionModelResponse> | decisionModels | Decision models ordered by creation time, newest first, with UUID descending to break ties. |
NextPageToken | string | nextPageToken | Token to pass as pageToken in the next request. Omitted when there are no more results. (optional) |
TotalCount | long | totalCount | Total 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.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
DisplayName | string | displayName | Name shown in the console and CLI. (optional) |
Description | string | description | Description of the model. Send an empty string to clear it, or omit it to keep the current value. (optional) |
EndpointUrl | string | endpointUrl | Base URL of the provider, starting with http:// or https://. Do not include a query string, fragment, or username and password. (optional) |
ApiPath | string | apiPath | Path 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) |
ModelIdentifier | string | modelIdentifier | Model identifier accepted by the provider. (optional) |
Credentials | EndpointAuthentication | credentials | Replacement 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) |
Configuration | IReadOnlyDictionary<string, object> | configuration | Replacement 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) |
Version | string | version | Version label. Send an empty string to clear it, or omit it to keep the current value. (optional) |
MonitoringEndpoint | string | monitoringEndpoint | URL 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) |
ReplaceLabels | IReadOnlyDictionary<string, string> | replaceLabels | Replace all labels with this map. Send {} to remove all labels. Do not combine with mergeLabels. (optional) |
MergeLabels | IReadOnlyDictionary<string, string> | mergeLabels | Add labels and replace the values of matching keys. Other labels are unchanged. Do not combine with replaceLabels. (optional) |