{"id":25972188,"url":"https://github.com/felipesalvadordev/spring-ai-samples","last_synced_at":"2026-04-18T00:31:02.673Z","repository":{"id":278926829,"uuid":"936934657","full_name":"felipesalvadordev/spring-ai-samples","owner":"felipesalvadordev","description":"Use of Spring AI with ChatClient, Large Language Models (LLMs) and Retrieval Augmented Generation (RAG) with Spring AI to build more accurate and contextually aware applications.","archived":false,"fork":false,"pushed_at":"2025-05-09T12:03:34.000Z","size":1219,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-09T13:23:37.021Z","etag":null,"topics":["chatclient","chatgpt4","llm","openai","rag","springai"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/felipesalvadordev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-22T00:38:14.000Z","updated_at":"2025-05-09T12:03:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"4e0a10d7-8f95-431e-b27b-9d3fd4b01b16","html_url":"https://github.com/felipesalvadordev/spring-ai-samples","commit_stats":null,"previous_names":["felipesalvadordev/spring-ai-samples"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/felipesalvadordev/spring-ai-samples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipesalvadordev%2Fspring-ai-samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipesalvadordev%2Fspring-ai-samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipesalvadordev%2Fspring-ai-samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipesalvadordev%2Fspring-ai-samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felipesalvadordev","download_url":"https://codeload.github.com/felipesalvadordev/spring-ai-samples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipesalvadordev%2Fspring-ai-samples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31951212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatclient","chatgpt4","llm","openai","rag","springai"],"created_at":"2025-03-05T00:20:24.488Z","updated_at":"2026-04-18T00:31:02.665Z","avatar_url":"https://github.com/felipesalvadordev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring AI Samples \n\nA demonstration project showcasing Retrieval Augmented Generation (RAG) implementation using Spring AI and OpenAI's GPT models. This application enables intelligent document querying by combining the power of Large Language Models (LLMs) with local document context.  \nA demonstration of chat memory using MessageChatMemoryAdvisor.\nAnd a demonstration of how to parse the AI's response into a structured Java object.\n## Overview\n\nThis project demonstrates how to:\n- Ingest PDF documents into a vector database\n- Perform semantic searches using Spring AI\n- Augment LLM responses with relevant document context\n- Create an API endpoint for document-aware chat interactions\n- Build a ChatClient with a MessageChatMemoryAdvisor that uses InMemoryChatMemory. This setup allows our chatbot to remember previous interactions.  \n- Build a book recommendation system using Spring AI and Spring Boot and parse the AI's response into a structured Java object.  \n- Build an image analyser with OpenAiChatModel\n\nQuery the API using curl or your preferred HTTP client:\n\n```bash\ncurl http://localhost:8080/advisor-using-vector-store\n```\nThe response will include context from your documents along with the LLM's analysis.\n\n```bash\ncurl http://localhost:8080/chatbot?question=\"What was the first car with line production?\"\n```\nThe response will be a chatbot with memory capabilities. A chatID also can be sent as a parameter to remain in the same conversation context.\n\n```bash\ncurl http://localhost:8080/advisor-with-memory?message=\"Whats my name?\"\n```\nThe chatbot remembers the user's name from the first interaction and can recall it in the second interaction\n\n```bash\ncurl http://localhost:8080/book-recomendations\n```\nThis code demonstrates how to automatically parse the AI's response into a structured Java object whitout JSON mapping. \n\n```bash\ncurl http://localhost:8080/image-explained\n```\nAnalyze images, answer questions about them, classify them, and generate summaries based on provided instructions.\n## Architecture Anatomy of RAG and LLM process\n\n- **Document Processing**: Uses Spring AI's PDF document reader to parse documents into manageable chunks\n- **Vector Storage**: Utilizes PGVector for efficient similarity searches\n- **Context Retrieval**: Automatically retrieves relevant document segments based on user queries\n- **Response Generation**: Combines document context with GPT-4's capabilities for informed responses\n\n## References\nhttps://www.danvega.dev/blog/getting-started-with-spring-ai-rag  \nhttps://www.danvega.dev/blog/spring-ai-chat-memory  \nhttps://www.danvega.dev/blog/ai-java-developers  \nhttps://www.baeldung.com/spring-ai-anthropics-claude-models  \nhttps://docs.spring.io/spring-ai/reference/api/chat/openai-chat.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipesalvadordev%2Fspring-ai-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelipesalvadordev%2Fspring-ai-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipesalvadordev%2Fspring-ai-samples/lists"}