Skip to content

anisul/devbrain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevBrain

A Spring Boot REST API that ingests a Java codebase and answers natural language questions about it using Spring AI and Gemini.


Requirements

  • Java 21
  • Gradle
  • A Gemini API key (free tier, Google AI Studio)

Configuration

Set your Gemini API key as an environment variable before running:

export GEMINI_API_KEY=your_key_here

The application.yml reads it via ${GEMINI_API_KEY}.


Running

./gradlew bootRun

The app starts on http://localhost:8080.


Endpoints

POST /ingest

Ingests a local codebase into the vector store. Point it at any directory containing Java source files.

curl -X POST "http://localhost:8080/ingest?repo=/path/to/your/project"

Response:

{ "filesProcessed": 20, "chunksStored": 13 }

The vector store is in-memory. Re-run /ingest after every restart.

Supported file types: .java, .kt, .xml, .yml, .yaml, .gradle, .properties, .md


GET /ask

RAG mode. Retrieves relevant chunks from the vector store and answers the question using that context. Streams the response as Server-Sent Events.

curl -N "http://localhost:8080/ask?q=What+does+IngestService+do"

Use this for focused, factual questions about specific classes or behaviour.


GET /investigate

Agentic mode. Gemini autonomously decides which tools to call and in what order until it can construct a precise answer. Streams the response as Server-Sent Events.

curl -N "http://localhost:8080/investigate?q=Trace+the+full+ingest+flow"

Use this for open-ended questions that require reading across multiple files.

Available tools Gemini can call:

  • findFiles(keyword) - find files by name or path
  • readFile(path) - read the full content of a file
  • semanticSearch(query) - search the vector store for relevant chunks
  • listMethods(path) - list method signatures in a Java file

Notes

  • gemini-2.0-flash is not available on the free tier in the EU. Use gemini-1.5-flash-latest instead.
  • The embedding model (all-MiniLM-L6-v2) downloads ~90MB on first boot and is cached after that.
  • /ask and /investigate both stream tokens as they arrive. Use curl -N to see them live.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages