ai-hacking-lab

command module
v0.0.0-...-4747d10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

README

ai-hacking-lab

Learn about AI Hacking!

Screenshots:

Chatting:

image

Run locally

  1. Install templ, redis, Ollama, and Go.
  2. 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
    

Project Overview

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'
Tech Stack
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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
templ: version: v0.2.543
templ: version: v0.2.543

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL