GithubHelp home page GithubHelp logo

dashaun-project-catalog / simple-rag Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 120 KB

Simple Spring AI with Retrieval-Augmented Generation (RAG)

License: Apache License 2.0

Java 95.19% Smalltalk 4.81%
retrieval-augmented-generation spring-ai spring-boot

simple-rag's Introduction

Spring AI RAG Example


Simple example to load the entire text of a document into a vector store and then expose an API through which questions can be asked about the document's content.

docker compose up -d
docker exec -it ollama ollama run mistral

You'll also need a document for it to load. Set the app.resource property in src/main/resources/application.properties to the resource URL of the document. For example:

app.resource=file:///Users/someuser/Spring_in_Action_SixthIEdition.pdf

The resource URL can be a file, classpath, or even an HTTP URL. The file itself can be any document type supported by Apache Tika, including PDF, Word, HTML, and more.

Then run the application as you would any Spring Boot application. For example, using Maven:

./mvnw spring-boot:run

The first time you run it, it will take a little while to load the document into the vector store (which will be persisted at /tmp/vectorstore.json). Subsequent runs will just use the persisted vector store and not try to load the document again. (This means that if you change the document resource, you'll need to delete /tmp/vectorstore.json so that it will be reloaded.)

simple-rag's People

Contributors

dashaun avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.