Spring Ai In Action Pdf: Github

Artificial intelligence (AI) and machine learning (ML) are transforming the way we build software applications. With the increasing demand for intelligent systems, developers need frameworks and tools that can help them integrate AI and ML into their applications seamlessly. This is where Spring AI comes in – a powerful framework that enables developers to build AI-powered applications with ease.

From ThomasVitale's repo:

record Actor(String name, Integer age) {}

Actor actor = chatClient.prompt() .user("Generate an actor from the 1990s") .call() .entity(Actor.class); // No JSON parsing boilerplate! spring ai in action pdf github

Create a simple endpoint that uses the ChatClient. Artificial intelligence (AI) and machine learning (ML) are

@RestController
public class ChatController
private final ChatClient chatClient;
public ChatController(ChatClient.Builder chatClientBuilder) 
        this.chatClient = chatClientBuilder.build();
@GetMapping("/ai")
    public String generate(@RequestParam(value = "message") String message) 
        return chatClient.prompt()
                .user(message)
                .call()
                .content();

Run the application, hit localhost:8080/ai?message=Tell me a joke about Java, and you have your first Spring AI app running. Create a simple endpoint that uses the ChatClient