Learn about AI Hacking!
Chatting:
- Install templ, redis, Ollama, and Go.
-
sudo systemctl start redis # start redis ollama run tinyllama # install model # then... templ generate # if you've made any modifications to .templ files go run main.go
This website is meant to serve as a simple framework for challenging students to manipulate large language models into doing what they want.
Administrators can provide prompts with CTF flags and challenge students to get the flags from the model. See ./example-prompts.json
for example prompts. The URL determines prompt selection with /chat/{promptName}
.
Note
Usage of ./ai-hacking-lab:
-address string
the address to host the server on (default ":3000")
-maxTokens int
the maximum number of tokens in a response. (default 100)
-modelName string
the name of the LLM in the Ollama library (default "tinyllama")
-modelTemperature float
the 'temperature' of the LLM (default 0.1)
-redisAddress string
the address to connect to redis on; must not include protocol (default "localhost:6379")
-ollamaAddress string
the address to connect to ollama on; must include protocol (default "http://localhost:11434")
-promptPath string
the filepath to load prompts from (default "./example-prompts.json")
For example,
go run main.go -promptPath='/your/path/here'
Technology | Used for |
---|---|
Go | Programming language |
templ | HTML Templating |
htmx | Render chat messages |
redis | Store temporary chats |
Ollama | LLM access |
LangChain | Integration with Ollama |
slog | Structured Logging |
go-chi | Router |
httprate | Rate limiter |
Tailwind CSS | CSS Framework |
Hero Icons | Icons |