Skip to content

Added langchain4j support and API example#70

Open
RaffSStein wants to merge 2 commits into
mainfrom
feat/langchain4j
Open

Added langchain4j support and API example#70
RaffSStein wants to merge 2 commits into
mainfrom
feat/langchain4j

Conversation

@RaffSStein

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 31, 2025 12:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR integrates LangChain4j support into the platform, enabling AI-powered customer eligibility analysis for financial products. The implementation includes shared AI configuration infrastructure and a working example in the customer-service that uses AI agents to determine if a customer can purchase a specific financial product based on their MiFID risk profile.

Key changes:

  • Added LangChain4j dependencies and Ollama chat model configuration to platform-core
  • Implemented an AI agent (CustomerInsightAgent) that analyzes customer eligibility for financial products using tool-augmented LLM calls
  • Created a REST endpoint (/ai/analyze/{customerId}) demonstrating the AI agent in action

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pom.xml Added langchain4j BOM (v0.35.0) and JUnit BOM (v6.0.1) to dependency management
core/platform-core/pom.xml Added langchain4j dependencies including core, spring-boot-starter, and ollama integration
core/platform-core/src/main/resources/platform-shared-properties.yaml Added Ollama configuration properties (base URL and model name)
core/platform-core/src/main/java/raff/stein/platformcore/ai/tool/WealthTool.java Created custom annotation for marking AI tool methods as financially audited
core/platform-core/src/main/java/raff/stein/platformcore/ai/AiAgentEnabler.java Created SPI interface for microservices to expose LangChain4j tools
core/platform-core/src/main/java/raff/stein/platformcore/ai/config/OllamaChatModelProperties.java Created configuration properties record for Ollama chat model settings
core/platform-core/src/main/java/raff/stein/platformcore/ai/config/OllamaChatModelConfiguration.java Created Spring configuration that builds and configures OllamaChatModel bean
business-modules/customer-service/customer-core/src/main/java/raff/stein/customer/model/entity/mifid/mapper/MifidFillingEntityToMifidFillingMapper.java Added mapping for customerRiskProfile.profile field to support AI tools
business-modules/customer-service/customer-core/src/main/java/raff/stein/customer/ai/CustomerInsightAgent.java Created AI agent interface with system/user prompts for customer eligibility analysis
business-modules/customer-service/customer-core/src/main/java/raff/stein/customer/ai/tool/CustomerComplianceTools.java Implemented LangChain4j tools to retrieve MiFID profiles and product details
business-modules/customer-service/customer-core/src/main/java/raff/stein/customer/ai/tool/projection/ProductProjectionStore.java Created in-memory product projection store with sample data for development
business-modules/customer-service/customer-core/src/main/java/raff/stein/customer/ai/config/CustomerAiConfiguration.java Created Spring configuration to wire up the CustomerInsightAgent with tools
business-modules/customer-service/customer-core/src/main/java/raff/stein/customer/controller/AiCustomerAnalysisController.java Created REST controller exposing the AI eligibility analysis endpoint

Comment on lines +24 to +30
@GetMapping("/analyze/{customerId}")
public ResponseEntity<CustomerEligibilityAnalysisResponse> analyze(
@PathVariable UUID customerId,
@RequestParam String isin) {
CustomerInsightAgent.EligibilityResult eligibilityResult = customerInsightAgent.analyzeEligibility(customerId, isin);
return ResponseEntity.ok(new CustomerEligibilityAnalysisResponse(customerId, isin, eligibilityResult));
}

Copilot AI Dec 31, 2025

Copy link

Choose a reason for hiding this comment

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

The new REST endpoint /ai/analyze/{customerId} should be documented in the OpenAPI specification file customer-api-data.yaml as per project conventions. All REST endpoints should have corresponding OpenAPI definitions in the *-api-data module.

Copilot generated this review using guidance from repository custom instructions.
@GetMapping("/analyze/{customerId}")
public ResponseEntity<CustomerEligibilityAnalysisResponse> analyze(
@PathVariable UUID customerId,
@RequestParam String isin) {

Copilot AI Dec 31, 2025

Copy link

Choose a reason for hiding this comment

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

The controller endpoint lacks input validation for the ISIN parameter. Consider adding validation annotations such as @notblank or @pattern to ensure the ISIN follows a valid format before processing the request.

Copilot uses AI. Check for mistakes.
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