Skip to content

A simple Spring Boot app demonstrating how to use Spring AI's Structured Output Converters to transform responses from Large Language Models (LLMs) into clean, usable data formats for your Java applications.

Notifications You must be signed in to change notification settings

BootcampToProd/spring-ai-structured-output

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Spring AI - Structured Output

This repository demonstrates how to use Spring AI's Structured Output Converters to transform responses from Large Language Models (LLMs) into clean, usable data formats for your Java applications.

πŸš€ It covers several key ways to get structured data:

  • Generating raw JSON responses directly from the AI model.
  • Converting AI output into specific Java objects (Entities) using BeanOutputConverter.
  • Obtaining a List of Java objects (Entities) for multiple structured items.
  • Getting flexible Map-based output (Map<String, Object>) for dynamic data structures.
  • Retrieving simple Lists of Strings using ListOutputConverter.

All examples are built around a fun "Social Media Analytics" theme.

πŸ“– Dive Deeper: For a complete walkthrough, detailed explanations of each structured output type, and step-by-step instructions, read our blog post.
πŸ‘‰ Spring AI Structured Output: Converting AI Responses into Structured Data

πŸŽ₯ Visual Learning: Prefer video tutorials? Watch our step-by-step implementation guide on YouTube.
πŸ‘‰ Spring AI Structured Output: Convert AI Responses to Java Objects in Minutes

πŸ“¦ Environment Variables

Make sure to provide these Java environment variables when running the application:

  • GEMINI_API_KEY: Your Google Gemini API key.

About

A simple Spring Boot app demonstrating how to use Spring AI's Structured Output Converters to transform responses from Large Language Models (LLMs) into clean, usable data formats for your Java applications.

Topics

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages