Skip to content

Introduce metadata-driven AI model features and parameters - #122

Merged
MikeAlhayek merged 11 commits into
mainfrom
ma/deployment-features
Aug 31, 2026
Merged

Introduce metadata-driven AI model features and parameters#122
MikeAlhayek merged 11 commits into
mainfrom
ma/deployment-features

Conversation

@MikeAlhayek

Copy link
Copy Markdown
Member

Fix #120

Replaces hardcoded, provider-specific model options with an extensible registry of model features (binary capabilities) and model parameters (configurable options carrying kind, allowed values, ranges, and defaults).

AI deployments declare which registered definitions their model exposes and may narrow the allowed values, default, or numeric bounds. AI profiles, profile templates, and chat interactions store the selected values, and the runtime binds them into the outgoing request. Values for parameters a deployment does not expose are never rendered and never sent.

Framework:

  • adds the capability abstractions, descriptors, and metadata models
  • adds AddCoreAIModelCapabilities, AddAIModelFeature, and AddAIModelParameter
  • registers eight built-in features and the reasoningEffort parameter
  • adds DefaultAIModelCapabilityService to merge registrations with deployment metadata without mutating the registered descriptors
  • adds ModelParametersAICompletionServiceHandler as the single enforcement point, with deployment-default fallback and binder dispatch
  • adds IAIModelParameterBinder and a reasoning effort binder that sets ChatOptions.Reasoning.Effort
  • maps the resolved effort onto ChatCompletionOptions.ReasoningEffortLevel in AzureOpenAICompletionClient so both request paths behave the same
  • adds CompletionServiceConfigureContext.Deployment
  • adds a ModelParameters front-matter key to the markdown template parser

Sample hosts:

  • adds a deployment capability editor and a metadata-driven parameter editor to the AI deployment, profile, template, and chat interaction screens in CrestApps.Core.Mvc.Web
  • adds the equivalent ModelCapabilitiesEditor and ModelParametersEditor components to CrestApps.Core.Blazor.Web

Docs:

  • adds the Model Capabilities guide and records the change in the 1.1.0 changelog

Replaces hardcoded, provider-specific model options with an extensible
registry of model features (binary capabilities) and model parameters
(configurable options carrying kind, allowed values, ranges, and defaults).

AI deployments declare which registered definitions their model exposes and
may narrow the allowed values, default, or numeric bounds. AI profiles,
profile templates, and chat interactions store the selected values, and the
runtime binds them into the outgoing request. Values for parameters a
deployment does not expose are never rendered and never sent.

Framework:
- adds the capability abstractions, descriptors, and metadata models
- adds AddCoreAIModelCapabilities, AddAIModelFeature, and AddAIModelParameter
- registers eight built-in features and the reasoningEffort parameter
- adds DefaultAIModelCapabilityService to merge registrations with deployment
  metadata without mutating the registered descriptors
- adds ModelParametersAICompletionServiceHandler as the single enforcement
  point, with deployment-default fallback and binder dispatch
- adds IAIModelParameterBinder and a reasoning effort binder that sets
  ChatOptions.Reasoning.Effort
- maps the resolved effort onto ChatCompletionOptions.ReasoningEffortLevel in
  AzureOpenAICompletionClient so both request paths behave the same
- adds CompletionServiceConfigureContext.Deployment
- adds a ModelParameters front-matter key to the markdown template parser

Sample hosts:
- adds a deployment capability editor and a metadata-driven parameter editor
  to the AI deployment, profile, template, and chat interaction screens in
  CrestApps.Core.Mvc.Web
- adds the equivalent ModelCapabilitiesEditor and ModelParametersEditor
  components to CrestApps.Core.Blazor.Web

Docs:
- adds the Model Capabilities guide and records the change in the 1.1.0
  changelog

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

MikeAlhayek and others added 6 commits August 8, 2026 01:20
- List only genuine trained model capabilities under "Trained features"
  (add image/audio/video input/output; drop provider-hosted web search)
- Add AIModelFeatureDescriptor.EnabledByDefault; default toolCalling + streaming on
- Add ModelFeaturesAICompletionServiceHandler to enforce features at runtime,
  stripping tools/ToolMode and JSON response format when not declared (opt-in on metadata)
- MVC + Blazor: "Trained features" heading, default-on features, read-only
  capability badges in profile/template/chat editors
- MVC: bootstrap-select searchable multi-select on deployment allowed-values pickers
- Update docs and 1.1.0 changelog; add enforcement + registration tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove form-select class from the deployment allowed-values multiselect so
  the native control no longer shows nested inside the bootstrap-select picker
- Upgrade @crestapps/bootstrap-select CDN assets from 1.2.0 to 1.2.1

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add AIModelParameterDescriptor.RequiredFeature so a parameter can declare a
  dependency on a trained feature; wire the built-in reasoningEffort parameter
  to require the reasoning feature
- MVC and Blazor deployment editors only show a dependent parameter while its
  feature is enabled, and clear/disable it when the feature is turned off so a
  contradictory config (e.g. reasoningEffort on a non-reasoning model) can't be saved
- Update docs and 1.1.0 changelog; add RequiredFeature registration and Clone tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…n framework

- Deployment editors now render a parameter that declares a RequiredFeature
  inline beneath its feature checkbox; the "Model parameters" heading only
  appears for parameters not linked to a feature
- Extract the MVC parameter card into a _DeploymentModelParameterCard partial and
  the Blazor card into a shared RenderFragment to reuse in both locations
- Enforce the parameter/feature relationship in the framework:
  DefaultAIModelCapabilityService.GetCapabilities now excludes a parameter whose
  RequiredFeature is not declared by the deployment, so the runtime handlers never
  apply it regardless of how the metadata was authored
- Add framework tests for the new capability filtering; update docs and changelog

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add extensible model capability enforcement so unsupported request
options never reach a provider, avoiding provider validation errors
(e.g. HTTP 400).

Framework:
- Add shared ModelFeatureEnforcement helper that strips tools/ToolMode
  when toolCalling is not declared, removes a JSON response format when
  structuredOutputs is not declared, removes reasoning options when
  reasoning is not declared, removes the reasoning effort when the
  reasoningEffort parameter is not exposed, and coerces an unsupported
  effort to the deployment default (preserving other reasoning state).
- Add CapabilityEnforcingChatClient and wire it into DefaultAIClientFactory
  as the terminal layer above the provider client so enforcement also runs
  for callers that resolve an IChatClient directly. Enforcement is opt-in
  to deployments that declare capability metadata; the capability service
  is optional so unconfigured hosts are unchanged.
- Convert model parameter values written to AdditionalProperties to their
  typed primitive; parse integers through decimal for exact Int64 bounds,
  reject non-finite numbers, and skip values that cannot be represented.
- Log the Azure ExtraHigh -> High reasoning-effort clamp instead of
  downgrading silently.
- Replace the computerUse feature with videoOutput.

UI:
- Unify the Blazor and MVC deployment editors on bootstrap-select (1.2.1)
  and sort trained features alphabetically.

Docs and tests updated; all tests pass with zero warnings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Complete streaming requests as a single buffered (non-streaming) response
when a deployment does not declare the streaming trained feature, replaying
the result via ToChatResponseUpdates(). Enforced on both the client-factory
path (CapabilityEnforcingChatClient) and the Azure SDK direct path
(AzureOpenAICompletionClient). The Azure non-streaming completion no longer
swallows OperationCanceledException, so a suppressed streaming fallback
propagates cancellation like a normal streaming request.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

# Conflicts:
#	src/CrestApps.Core.Docs/docs/changelog/1.1.0.md
#	src/Startup/CrestApps.Core.Blazor.Web/Components/App.razor
#	src/Startup/CrestApps.Core.Mvc.Web/Areas/AI/Controllers/AIProfileController.cs
#	src/Startup/CrestApps.Core.Mvc.Web/Areas/AI/Controllers/AITemplateController.cs
#	src/Startup/CrestApps.Core.Mvc.Web/Areas/ChatInteractions/Controllers/ChatInteractionController.cs
#	src/Startup/CrestApps.Core.Mvc.Web/Views/Shared/_Layout.cshtml
MikeAlhayek and others added 2 commits August 31, 2026 11:03
…ility, changelog

Addresses review follow-ups on the metadata-driven model features/parameters work:

- MVC deployment editor: emit a non-sequential `ModelParameters.Index` token per
  parameter card and keep the structural hidden fields (Name, IsSupported, Index)
  enabled even when a feature-dependent row is disabled. Previously the feature
  dependency script disabled every field in a hidden card, dropping the whole row
  from the POST; with sequential indices the default collection binder truncated
  at the gap and silently dropped later parameters. This only affected hosts that
  register additional parameters, but corrupts their metadata on save.

- Add server-side validation of per-deployment parameter metadata at save time
  (AIDeploymentViewModel.ValidateModelParameters, wired into Create/Edit POST).
  Reuses the descriptor's own IsValidValue so the editor and the request pipeline
  agree: an out-of-range/unlisted default, an unregistered allowed value, or a
  minimum greater than a maximum is reported inline instead of being silently
  corrected at request time.

- AzureOpenAICompletionClient: warn when a binder-less model parameter would be
  applied via ChatOptions.AdditionalProperties. That client projects a fixed set
  of options onto the Azure SDK and has no generic passthrough, so such a value is
  now observable instead of silently dropped. The built-in reasoningEffort binds
  through ChatOptions.Reasoning.Effort and is unaffected.

- Move the changelog entry from the released 1.1.0 notes to the in-development
  2.0.0 notes (VersionPrefix is 2.0.0).

Adds AIDeploymentModelParameterValidationTests. Full suite: 2880 passing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The MVC deployment editor validates per-deployment parameter metadata at save
time, but the Blazor editor could still persist incoherent capability metadata
and undermine the same guarantees. Add the equivalent guard:

- AIDeploymentViewModel.ValidateModelParameters (Blazor) mirrors the MVC check,
  reusing each row's registered Descriptor and the descriptor's own IsValidValue
  so an out-of-range/unlisted default, an unregistered allowed value, or a
  minimum greater than a maximum is reported before save. Wired into the Create
  and Edit page submit handlers, surfacing through the existing validation alert.

Adds BlazorAIDeploymentModelParameterValidationTests. Full suite: 2886 passing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@MikeAlhayek
MikeAlhayek merged commit 7f1c3d7 into main Aug 31, 2026
10 checks passed
@MikeAlhayek
MikeAlhayek deleted the ma/deployment-features branch August 31, 2026 18:19
MikeAlhayek added a commit that referenced this pull request Aug 31, 2026
…DeploymentParameter

Drops the redundant "Model" from the two persisted capability metadata types added
in #122:
- AIDeploymentModelMetadata -> AIDeploymentMetadata
- AIDeploymentModelParameter -> AIDeploymentParameter

Note: these are stored in a deployment's Properties keyed by type name, so the
persisted JSON key changes (AIDeploymentModelMetadata -> AIDeploymentMetadata). No
recipe/appsettings references the old key and 2.0.0 is unreleased, so there is no
shipped data to migrate; any locally-saved dev deployment metadata would need to be
re-saved. Files renamed via git mv. Full suite: 2906 passing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce Metadata-Driven AI Deployment Features and Parameters

1 participant