Skip to content

CLI to develop code using natural language (integrated with AOC puzzles!)

License

Notifications You must be signed in to change notification settings

huntergregory/ai-code-colleague

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Code Colleague

Have fun or practice your skills:

  • Solve puzzles using dictation (integrated with Advent of Code!).
  • Describe code at a high-level (like in interviews/collaboration).

Demo

Demo

Advent of Code Integration

Automated puzzle-solving experience:

  • Creates files.
  • Downloads inputs.
  • Runs code.
  • Submits answers.

Note: AI should not be used for AOC submissions impacting leaderboards. For more info, see https://adventofcode.com/about.

Usage

Supports OpenAI or a locally run model for privacy.

Option 1: OpenAI

Python Dependencies

python -m pip install langchain
python -m pip install openai

API Key

First, create your key.

Then:

  • Modify this line in config.py:
OAI_API_KEY=None # replace with string

or

  • Set an environment variable like:
export OAI_API_KEY='<your-key>'

Option 2: Local Model

Work in progress.

Dependencies

Install/configure LLM utility with below commands:

python -m pip install llm
llm install llm-gpt4all

Then:

  • Modify this line in config.py:
LOCAL_LLM='mistral-7b-openorca' # replace with model name from llm utility

or

  • Set an environment variable like:
export LOCAL_LLM='mistral-7b-openorca'

Advent of Code

Optional: Advent of Code Session Key

This allows automation of downloading input and submitting answers.

  1. Login to adventofcode.com
  2. Get your session key from inspecting the webpage:
  • Open the Inspector (CTRL + SHIFT + C).
  • Copy the cookie value called "session" in Application > Cookies cookie-location
  1. Modify config:
  • Modify this line in config.py:
AOC_SESSION_KEY=None # replace with string

OR

  • Set an environment variable like:
export AOC_SESSION_KEY='<your-key>'

Special Notes

Some AOC submission logic is inspired by github.com/caderek/aocrunner. Like aocrunner, this project respects the concerns of the AoC creator, and limits unnecessary requests.

The tool:

  • Downloads inputs once (re-download by deleting the input directory).
  • Submits only valid answers (final output, if it's a single number).
  • Prevents resubmissions until the server-specified timeout for incorrect answers.

About

CLI to develop code using natural language (integrated with AOC puzzles!)

Topics

Resources

License

Stars

Watchers

Forks

Languages