/ihmi_llm

Primary LanguageTypeScript

IHMI - LLM

Development

Setup

  1. Use Node.JS 22 (I recommend installation via nvm) and pnpm (after Node.JS is installed, using npm i -g pnpm)
  2. Run pnpm install
  3. Install ollama from https://github.com/trustedtomato/ollama (until ollama/ollama#2404 gets merged)
  4. For developing GBNF in Visual Studio Code, install https://marketplace.visualstudio.com/items?itemName=iddar.gbnf-highlighter

Understanding the codebase

In order to have a good understanding of the codebase, it is recommended to start with the entry point of the test suite runner: src/tests/index.ts. From there, you can explore the rest of the codebase by following the imports.

Some of the more interesting files include:

Running the tests

  1. Run ollama by going into its directory and running while true; do ./ollama serve > /dev/null 2>&1 || sleep 1; done
    • The script makes sure to restart the Ollama server in case of a crash, which does happen sometimes
    • The script also suppresses the output of the Ollama server, which could potentially be very verbose and affect the performance metrics of the test suite. For development though, you could remove it, in which case you'd want to remove the > /dev/null 2>&1 part of the command
  2. Run npm run test
    • You can run DEBUG="app:test,app:test:*" npm run test to see the test suite output
    • You can run DEBUG="app:*" npm run test to see the test suite output and the debugging output of all other parts of the codebase
    • To run the test suite multiple times, you could use while true; do npm run test; done