Skip to content

Conversation

@FlorisVleugels
Copy link
Contributor

@FlorisVleugels FlorisVleugels commented Oct 11, 2025

Introduce Spring AI dependency (for OQL Assistant)

Spring AI provides abstractions to integrate with various models

Key Changes

  • Added Spring AI dependency
  • Added a context resource so model can be given instructions
  • New endpoint /api/assistant

Todo

Spring AI has a built in evaluator for determining whether the the AI model has produced a hallucinated response or not (using another ai call to validate the other).
At the moment the context resource includes the instruction to add OQL: TRUE or OQL:FALSE to the generated text (see example below), which is used by the frontend to decide whether to render the message or an error.

Could be better to let the evaluator decide and change response accordingly, or have some feedback loop for n iterations until valid oql is returned or max is reached?

Example

curl -X POST \
  http://localhost:8080/api/assistant \
  -H "Content-Type: application/json" \
  -d '"Find all somatic driver mutations in TP53 and BRCA1, except missense mutations, and also get EGFR and MYC with mRNA expression greater than 2 SD. Include KRAS mutations only at positions 12 and 13, but exclude nonsense mutations."'
{
  "aiResponse": "TP53: DRIVER_SOMATIC_MUT != MISSENSE BRCA1: DRIVER_SOMATIC_MUT != MISSENSE EGFR: EXP > 2 MYC: EXP > 2 KRAS: MUT = (12-13) != NONSENSE OQL: TRUE"
}

Related PR

frontend PR that adds the OQL Assistant UI

@Floris-Hyve Floris-Hyve marked this pull request as ready for review October 13, 2025 13:19
@inodb inodb requested a review from zainasir October 20, 2025 18:48

@Validated
@RestController()
@ConditionalOnProperty(name = "spring.ai.enabled", havingValue = "true")
Copy link
Member

Choose a reason for hiding this comment

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

wondering if we need to set CORS restrictions somewhere for these endpoints? So only users of the website can use m

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