Skip to content

Instantly share code, notes, and snippets.

View halhenke's full-sized avatar
:octocat:
Segge Fallt

Hal Henke halhenke

:octocat:
Segge Fallt
View GitHub Profile

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

@sabetAI
sabetAI / codex_answers.py
Created August 16, 2021 15:52
Example Prompt for Codex /answers
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Answer.create(
search_model="cushman-codex",
model="davinci-codex",
question="Where is the React component FloatingMenu defined?",
examples_context='''public shouldShow: Exclude<FloatingMenuPluginProps['shouldShow'], null> = ({ state }) => {
const { selection } = state
const { $anchor, empty } = selection
@sabetAI
sabetAI / codex_scrape.py
Created August 16, 2021 15:46
Scraping Files for Upload to Codex
import os
from argparse import ArgumentParser
import openai
import jsonlines
openai.api_key = os.environ['OPENAI_API_KEY']
# read all typescript files in all subdirectories
def get_all_files(dir, ext):
all_files = []
@Skinner927
Skinner927 / classproperty.py
Last active October 12, 2020 23:01
Properties for Python Classes. Supports get and set.
"""
To use simply copy ClassPropertyMeta and classproperty into your project
"""
class ClassPropertyMeta(type):
def __setattr__(self, key, value):
obj = self.__dict__.get(key, None)
if type(obj) is classproperty:
return obj.__set__(self, value)
@i-am-tom
i-am-tom / FizzBuzz.hs
Last active December 21, 2024 10:17
Arguably the fastest implementation of FizzBuzz ever written.
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UnsaturatedTypeFamilies #-}
import GHC.TypeLits
import Prelude hiding (Functor, Semigroup)
type Main = (Fizz <> Buzz) <$> (0 `To` 100)

Nix Flake MVP

Goals

  • To provide Nix repositories with an easy and standard way to reference other Nix repositories.

  • To allow such references to be queried and updated automatically.

  • To provide a replacement for nix-channel, NIX_PATH and Hydra

@teamdandelion
teamdandelion / labels_1024.tsv
Last active February 6, 2024 08:33
TensorBoard: TF Dev Summit Tutorial
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
7
2
1
0
4
1
4
9
5
9
@dfrib
dfrib / DictionaryKeyPath.swift
Last active April 14, 2023 12:45
Swift: Reading and writing to (possible) nested dictionaries for a given key path, using a recursive approach
// For details, see
// http://stackoverflow.com/questions/40261857/remove-nested-key-from-dictionary
import Foundation
extension Dictionary {
subscript(keyPath keyPath: String) -> Any? {
get {
guard let keyPath = Dictionary.keyPathKeys(forKeyPath: keyPath)
else { return nil }
return getValue(forKeyPath: keyPath)
{
"Imei": "354678050021708",
"Timestamp": 1477343460116,
"Priority": 0,
"Gps": {
"Longitude": 1508431968,
"Latitude": -323215269,
"Altitude": 135,
"Angle": 82,
"Satellites": 8,

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.