CAMEL-22850: Use LangChain4j Spring Boot starters in Camel Spring Boot#20919
CAMEL-22850: Use LangChain4j Spring Boot starters in Camel Spring Boot#20919gnodet merged 4 commits intoapache:mainfrom
Conversation
…ng Boot This commit integrates LangChain4j Spring Boot starters with Apache Camel's langchain4j components, enabling auto-configuration and simplified setup for Spring Boot applications. Changes: - Updated camel-langchain4j-chat component documentation to include Spring Boot starter integration examples with auto-configuration - Updated camel-langchain4j-agent component documentation with Spring Boot starter usage patterns - Updated camel-langchain4j-embeddings component documentation with embedding model auto-configuration examples - Added comprehensive LangChain4j Spring Boot Integration guide covering: * Available LangChain4j Spring Boot starters for various LLM providers * Configuration examples for OpenAI, Azure OpenAI, Ollama, and others * Complete working examples with RAG, streaming, and multi-provider setups * Best practices for production deployments * Troubleshooting guide - Created example Spring Boot application demonstrating the integration: * Maven POM with proper dependencies * Profile-based configuration (dev with Ollama, prod with OpenAI) * Camel routes using auto-configured LangChain4j beans * REST API endpoints for chat interactions Benefits: - Simplified configuration through Spring Boot auto-configuration - Type-safe configuration properties with IDE support - Reduced boilerplate code for LLM integration - Consistent configuration approach across different providers - Production-ready setup with health checks and metrics The integration allows users to leverage LangChain4j's Spring Boot starters (langchain4j-open-ai-spring-boot-starter, langchain4j-ollama-spring-boot-starter, etc.) for automatic bean configuration, while seamlessly using these beans in Camel's langchain4j components for AI/LLM integration workflows.
This commit addresses several issues identified during code review: 1. Fixed Bean Names - Corrected bean references from 'chatModel' to 'chatLanguageModel' - This matches LangChain4j's actual auto-configured bean names - Updated all component documentation and examples 2. Added Multi-DSL Examples - Added tabs for Java, YAML, and XML examples in component docs - Follows Camel documentation best practices - Makes examples more accessible to users of different DSLs 3. Improved Version References - Changed 'x.x.x' placeholders to actual version '1.10.0' - Added comments to guide users on version selection - More explicit and helpful for users 4. Enhanced Example Application - Added .gitignore file for the example project - Created ChatRouteTest.java with integration tests - Tests demonstrate proper usage and include environment checks - Follows Camel example project patterns 5. Added Missing Imports - Added explicit imports in AgentConfig example - Makes examples more complete and copy-paste friendly 6. Improved Code Quality - Better variable naming (myChatModel, myEmbeddingModel) - More consistent formatting - Added helpful comments These enhancements improve the documentation quality, make examples more complete and usable, and align with Apache Camel documentation standards and best practices.
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🤖 CI automation will test this PR automatically. 🐫 Apache Camel Committers, please review the following items:
|
Added Apache License headers to: - pom.xml (XML format) - application.yml (YAML format with ## comments) This fixes the CI build failure where the build process adds headers and then fails the uncommitted changes check.
The example Spring Boot project was causing CI build failures because the license plugin was trying to add headers to files like README.md and .gitignore which don't need them. Full example projects should be in the separate camel-examples repository, not in the main Camel repository's docs directory. The comprehensive documentation in langchain4j-spring-boot-integration.adoc provides sufficient code examples and configuration guidance for users.
|
Hi @gnodet thanks for looking into it, looking great, do you think there are improvements that can be done to https://github.com/apache/camel-spring-boot ? for example, maybe there are starters that can be used directly in camel-spring-boot instead of the springframeowrk dependency? (for autoconfiguration and such) |
Yes, things can probably be improved in camel-spring-boot. I'll have a look... |
CAMEL-22850: Integrate LangChain4j Spring Boot starters in Camel Spring Boot
This commit integrates LangChain4j Spring Boot starters with Apache Camel's
langchain4j components, enabling auto-configuration and simplified setup for
Spring Boot applications.
Changes:
starter integration examples with auto-configuration
starter usage patterns
model auto-configuration examples
Benefits:
The integration allows users to leverage LangChain4j's Spring Boot starters
(langchain4j-open-ai-spring-boot-starter, langchain4j-ollama-spring-boot-starter,
etc.) for automatic bean configuration, while seamlessly using these beans in
Camel's langchain4j components for AI/LLM integration workflows.