How hmeyrakrklnc/foundrylocal works
This is an offline Turkish RAG assistant. A user submits a question through the chat loop; the app retrieves relevant chunks from local TXT/PDF documents, adds them and recent chat history to a prompted request, then returns a Phi-4 mini response. Document loading, chunking, embedding, persistent Chroma storage and MMR retrieval form the retrieval stages; Foundry Local serves generation. The README also documents the major integrations. Edges follow the shown calls or explicit README descriptions; the generated Chroma directory is not in the supplied tree.
Main entry points: main.py Chat loop · model.py Foundry wrapper · database.py Chroma store · metin.txt Local documents
Components 15
Chat interaction
- Chat loop
main.py - Query context
main.py - Chat memory
main.py - Assistant answer
main.py
Document retrieval
- Local documents
data/metin.txt - Document loading
database.py - Chunking
database.py - Embeddings
database.py - Chroma store
database.py - MMR retrieval
database.py
Answer generation
- System prompt
config.py - Foundry wrapper
model.py - Endpoint discovery
model.py
Other components
- User
- Foundry Local
Connections 18
- User → Chat loop: submits question
main.py - Chat loop → Query context: prepares query
main.py - Chat loop → Chat memory: reads and updates
main.py - Chat loop → MMR retrieval: invokes search
main.py - Local documents → Document loading: loads TXT/PDF
database.py - Document loading → Chunking: splits documents
database.py - Chunking → Chroma store: indexes chunks
database.py - Embeddings → Chroma store: embeds content
database.py - Chroma store → MMR retrieval: creates retriever
database.py - MMR retrieval → Chat loop: returns matching chunks
main.py - Chat loop → System prompt: uses instructions
main.py - Chat loop → Foundry wrapper: invokes model
main.py - Foundry wrapper → Endpoint discovery: looks up endpoint
model.py - Endpoint discovery → Foundry Local: checks server status
model.py - Foundry wrapper → Foundry Local: posts completion request
model.py - Foundry Local → Foundry wrapper: returns completion
model.py - Foundry wrapper → Assistant answer: returns response
main.py - Assistant answer → User: displays answer
main.py