[ 
https://issues.apache.org/jira/browse/CAMEL-27245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Federico Mariani updated CAMEL-27245:
-------------------------------------
    Description: 
Spring AI 2.1.0 adds the {{DecisionModel}} API. It answers yes/no, choice and 
score questions about an input and reports the probability of each answer. 
Implementations: {{OpenAiDecisionModel}}, {{OllamaDecisionModel}} (default 
model {{d1-omni:600m}}) and {{SystemOneDecisionModel}}.

Camel already routes on such decisions with the Semantic language 
({{camel-semantic}}) and its experts ({{camel-semantic-openai}}, 
{{camel-semantic-typesafe-ai}}, {{camel-semantic-wolf-defender}}): named 
evaluations, {{refs:}} batches, the Switch EIP, auditing and metrics. A Spring 
AI decision model fits as another expert, rather than as a component with its 
own options and headers.

h3. Proposal

* A new module {{camel-semantic-spring-ai}} with a 
{{SpringAiDecisionSemanticAdapter}} expert, which asks a Spring AI 
{{DecisionModel}} (by default the only one in the registry, as the Spring AI 
starters create it).
* The {{boolean}}, {{choice}} and {{score}} operations, with the parameters and 
result meaning of the OpenAI and TypeSafe AI experts ({{instructions}}, 
{{criteria}}, {{threshold}}, {{uncertainty}}, {{uncertaintyPolicy}}, 
{{descriptions}}), so that an evaluation moves between providers by changing 
its expert.
* A {{refs:}} batch is one call of the decision model. A refused question fails 
the evaluation.
* Text, named fields and images as input.
* Documentation with Spring Boot configuration and a routing example in YAML.

_Claude Code on behalf of Croway_

  was:
Spring AI 2.1.0 adds the {{DecisionModel}} API. It answers yes/no, choice and 
score questions about an input and reports the probability of each answer. 
Implementations: {{OpenAiDecisionModel}}, {{OllamaDecisionModel}} (default 
model {{d1-omni:600m}}) and {{SystemOneDecisionModel}}. A decision model is 
faster and cheaper than asking a chat model the same thing, and the 
probabilities let the application decide how sure the model must be.

This fits Camel's routing: classify a message and route it with a Content-Based 
Router, stop a prompt injection before it reaches a chat model, or check 
whether an answer is supported by the retrieved documents.

h3. Proposal

* A {{spring-ai-decision:name}} producer with an autowired {{decisionModel}}.
* One question from the endpoint options: the kind (yes/no, choice, score), the 
question, the options or levels with their descriptions, and the yes/no 
criteria. The body is the input.
* A {{DecisionPrompt}} body for several questions.
* The answer and the probabilities in headers, so the route can {{choice()}} on 
them, and the body left as it is.
* Documentation with a routing example, and the Spring Boot starter.

_Claude Code on behalf of Croway_

        Summary: camel-semantic-spring-ai - Semantic expert for Spring AI 
decision models  (was: camel-spring-ai-decision - new component for Spring AI 
decision models)

> camel-semantic-spring-ai - Semantic expert for Spring AI decision models
> ------------------------------------------------------------------------
>
>                 Key: CAMEL-27245
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27245
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-spring-ai
>            Reporter: Federico Mariani
>            Assignee: Federico Mariani
>            Priority: Major
>             Fix For: 4.25.0
>
>
> Spring AI 2.1.0 adds the {{DecisionModel}} API. It answers yes/no, choice and 
> score questions about an input and reports the probability of each answer. 
> Implementations: {{OpenAiDecisionModel}}, {{OllamaDecisionModel}} (default 
> model {{d1-omni:600m}}) and {{SystemOneDecisionModel}}.
> Camel already routes on such decisions with the Semantic language 
> ({{camel-semantic}}) and its experts ({{camel-semantic-openai}}, 
> {{camel-semantic-typesafe-ai}}, {{camel-semantic-wolf-defender}}): named 
> evaluations, {{refs:}} batches, the Switch EIP, auditing and metrics. A 
> Spring AI decision model fits as another expert, rather than as a component 
> with its own options and headers.
> h3. Proposal
> * A new module {{camel-semantic-spring-ai}} with a 
> {{SpringAiDecisionSemanticAdapter}} expert, which asks a Spring AI 
> {{DecisionModel}} (by default the only one in the registry, as the Spring AI 
> starters create it).
> * The {{boolean}}, {{choice}} and {{score}} operations, with the parameters 
> and result meaning of the OpenAI and TypeSafe AI experts ({{instructions}}, 
> {{criteria}}, {{threshold}}, {{uncertainty}}, {{uncertaintyPolicy}}, 
> {{descriptions}}), so that an evaluation moves between providers by changing 
> its expert.
> * A {{refs:}} batch is one call of the decision model. A refused question 
> fails the evaluation.
> * Text, named fields and images as input.
> * Documentation with Spring Boot configuration and a routing example in YAML.
> _Claude Code on behalf of Croway_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to