Declarative AI services
Test text analysis, summarization, and sentiment classification using annotated interfaces.
Compare LangChain4j's approach with our custom implementations.
interface AssistantService {
@UserMessage("Analyze this text: {{text}}")
fun analyzeText(text: String): String
}
val assistant = AiServices.builder(AssistantService::class.java)
.chatLanguageModel(chatModel)
.build()
val result = assistant.analyzeText("Your text here")