Skip to content

Feature: implementation of classification and decision service contracts - #2062

Open
jimador wants to merge 10 commits into
mainfrom
feature/classification-contracts
Open

jimador wants to merge 10 commits into
mainfrom
feature/classification-contracts

Conversation

@jimador

@jimador jimador commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Related: #2049, #2050, #2051, #2052, #2057, https://github.com/embabel/embabel-agent-experimental/issues/42. This splits the contract work out of prototype #2059 and precedes #2061.

This prototype implementation adds classification and decision service contracts for Java and Kotlin consumers. The TypeSafe integration in #2061 will implement these interfaces.

Classification answers which declared category applies. Categories have stable identifiers and descriptions, and callers can map the result to an enum or an application type without asking the provider to construct an object. No match, an inconclusive assessment and a provider failure are separate outcomes. Provider confidence stays optional. A supplied map determines category order; use an ordered map when that order matters.

DecisionService adds proposition assessment and also supports classification. Its model family remains DECISION when it is used as a classifier. A false proposition answer is a successful assessment. The application decides what to do with it.

flowchart LR
    Consumer[Java or Kotlin consumer] --> Mapping[Typed category mapping]
    Mapping --> Request[Provider-neutral request]
    Request --> Service[ClassificationService]
    Decision[DecisionService] -->|classification capability| Service
    Decision --> Assessment[Proposition assessment]
    Service --> Result[Selected / no match / inconclusive / failure]
    Result --> Mapping
    Mapping --> Policy[Application policy]
    Service -.-> Metadata[Pure model metadata snapshot]
    Adapter[TypeSafe adapter in follow-up PR] -.-> Decision
Loading

The new CLASSIFICATION and DECISION model families require consumers with exhaustive ModelType switches to handle those cases.

The contracts live beside embedding services in embabel-agent-ai. There is no new Maven module or provider SDK dependency. The guide covers typed categories, result semantics, metadata snapshots and observations. Services support ordinary dependency injection. Model registry selection, role defaults, BYOK and provider autoconfiguration follow with the adapter.

Signed-off-by: James Dunnam <7660553+jimador@users.noreply.github.com>
Signed-off-by: James Dunnam <7660553+jimador@users.noreply.github.com>
Signed-off-by: James Dunnam <7660553+jimador@users.noreply.github.com>
Signed-off-by: James Dunnam <7660553+jimador@users.noreply.github.com>
Signed-off-by: James Dunnam <7660553+jimador@users.noreply.github.com>
Signed-off-by: James Dunnam <7660553+jimador@users.noreply.github.com>
Signed-off-by: James Dunnam <7660553+jimador@users.noreply.github.com>
@jimador jimador changed the title Prototype implementation of classification and decision service contracts feat: implementation of classification and decision service contracts Sep 25, 2026
@jimador
jimador marked this pull request as ready for review September 25, 2026 17:31
@jimador
jimador requested a review from igordayen September 25, 2026 17:32
@jimador jimador self-assigned this Sep 25, 2026
@igordayen igordayen changed the title feat: implementation of classification and decision service contracts Feature: implementation of classification and decision service contracts Sep 25, 2026
@jimador
jimador added this pull request to stack #2067 September 25, 2026 18:45

@igordayen igordayen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jimador - few comments, thank you.

* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.embabel.common.ai.model

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although embeddingservice and its impl reside in the same package, I would recommend moving the Observed services into sub-package.
Looping in @azanux to review observability integration


[source,java]
----
include::../../../../../../embabel-agent-common/embabel-agent-ai/src/test/java/com/embabel/common/ai/classification/ClassificationJavaTest.java[tag=enum-mapping]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be resolved by doc build?

@igordayen igordayen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jimador - one more comment, thanks

@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants