Home

Awesome

GenAI Stack

The GenAI Stack will get you started building your own GenAI application in no time. The demo applications can serve as inspiration or as a starting point. Learn more about the details in the introduction blog post.

Configure

Create a .env file from the environment template file env.example

Available variables:

Variable NameDefault valueDescription
OLLAMA_BASE_URLhttp://host.docker.internal:11434REQUIRED - URL to Ollama LLM API
NEO4J_URIneo4j://database:7687REQUIRED - URL to Neo4j database
NEO4J_USERNAMEneo4jREQUIRED - Username for Neo4j database
NEO4J_PASSWORDpasswordREQUIRED - Password for Neo4j database
LLMllama2REQUIRED - Can be any Ollama model tag, or gpt-4 or gpt-3.5 or claudev2
EMBEDDING_MODELsentence_transformerREQUIRED - Can be sentence_transformer, openai, aws, ollama or google-genai-embedding-001
AWS_ACCESS_KEY_IDREQUIRED - Only if LLM=claudev2 or embedding_model=aws
AWS_SECRET_ACCESS_KEYREQUIRED - Only if LLM=claudev2 or embedding_model=aws
AWS_DEFAULT_REGIONREQUIRED - Only if LLM=claudev2 or embedding_model=aws
OPENAI_API_KEYREQUIRED - Only if LLM=gpt-4 or LLM=gpt-3.5 or embedding_model=openai
GOOGLE_API_KEYREQUIRED - Only required when using GoogleGenai LLM or embedding model google-genai-embedding-001
LANGCHAIN_ENDPOINT"https://api.smith.langchain.com"OPTIONAL - URL to Langchain Smith API
LANGCHAIN_TRACING_V2falseOPTIONAL - Enable Langchain tracing v2
LANGCHAIN_PROJECTOPTIONAL - Langchain project name
LANGCHAIN_API_KEYOPTIONAL - Langchain API key

LLM Configuration

MacOS and Linux users can use any LLM that's available via Ollama. Check the "tags" section under the model page you want to use on https://ollama.ai/library and write the tag for the value of the environment variable LLM= in the .env file. All platforms can use GPT-3.5-turbo and GPT-4 (bring your own API keys for OpenAI models).

MacOS Install Ollama on MacOS and start it before running docker compose up using ollama serve in a separate terminal.

Linux No need to install Ollama manually, it will run in a container as part of the stack when running with the Linux profile: run docker compose --profile linux up. Make sure to set the OLLAMA_BASE_URL=http://llm:11434 in the .env file when using Ollama docker container.

To use the Linux-GPU profile: run docker compose --profile linux-gpu up. Also change OLLAMA_BASE_URL=http://llm-gpu:11434 in the .env file.

Windows Ollama now supports Windows. Install Ollama on Windows and start it before running docker compose up using ollama serve in a separate terminal. Alternatively, Windows users can generate an OpenAI API key and configure the stack to use gpt-3.5 or gpt-4 in the .env file.

Develop

[!WARNING] There is a performance issue that impacts python applications in the 4.24.x releases of Docker Desktop. Please upgrade to the latest release before using this stack.

To start everything

docker compose up

If changes to build scripts have been made, rebuild.

docker compose up --build

To enter watch mode (auto rebuild on file changes). First start everything, then in new terminal:

docker compose watch

Shutdown If health check fails or containers don't start up as expected, shutdown completely to start up again.

docker compose down

Applications

Here's what's in this repo:

NameMain filesCompose nameURLsDescription
Support Botbot.pybothttp://localhost:8501Main usecase. Fullstack Python application.
Stack Overflow Loaderloader.pyloaderhttp://localhost:8502Load SO data into the database (create vector embeddings etc). Fullstack Python application.
PDF Readerpdf_bot.pypdf_bothttp://localhost:8503Read local PDF and ask it questions. Fullstack Python application.
Standalone Bot APIapi.pyapihttp://localhost:8504Standalone HTTP API streaming (SSE) + non-streaming endpoints Python.
Standalone Bot UIfront-end/front-endhttp://localhost:8505Standalone client that uses the Standalone Bot API to interact with the model. JavaScript (Svelte) front-end.

The database can be explored at http://localhost:7474.

App 1 - Support Agent Bot

UI: http://localhost:8501 DB client: http://localhost:7474

(Chat input + RAG mode selector)

(CTA to auto generate support ticket draft)(UI of the auto generated support ticket draft)

App 2 - Loader

UI: http://localhost:8502 DB client: http://localhost:7474

App 3 Question / Answer with a local PDF

UI: http://localhost:8503
DB client: http://localhost:7474

This application lets you load a local PDF into text chunks and embed it into Neo4j so you can ask questions about its contents and have the LLM answer them using vector similarity search.

App 4 Standalone HTTP API

Endpoints:

Example cURL command:

curl http://localhost:8504/query-stream\?text\=minimal%20hello%20world%20in%20python\&rag\=false

Exposes the functionality to answer questions in the same way as App 1 above. Uses same code and prompts.

App 5 Static front-end

UI: http://localhost:8505

This application has the same features as App 1, but is built separate from the back-end code using modern best practices (Vite, Svelte, Tailwind).
The auto-reload on changes are instant using the Docker watch sync config.