Skip to content

Instantly share code, notes, and snippets.

@bitbutter
bitbutter / knowledge_extractor.py
Created April 24, 2023 14:46
A python console program that uses Chroma and OpenAI to query text files
import chromadb
import openai
import os
from tqdm import tqdm
import tiktoken
from chromadb.errors import NotEnoughElementsException
import re
from colorama import Fore, Style
# Instructions (assumes Windows OS)
@bitbutter
bitbutter / create_embeddings.py
Created July 30, 2023 16:53
create embeddings from tweets, then semantic search them
import json
import spacy
import zipfile
import os
import pickle
# File paths
zip_path = r"pathtotwitterarchive.zip" # Path to zipped twitter archive
extract_path = r"somepath\twitter_data" # Path to extract twitter data
embeddings_path = r"somepath\tweet_embeddings.pkl" # Path to save embeddings
@bitbutter
bitbutter / SignalWaiter.gd
Created July 8, 2024 08:25
A godot 4 class. Waits for multiple signals to be received before continuing
class_name SignalWaiter
signal AllFinished
# Internal variables
var _active_nodes = {}
var _signal_connections = {}
var _callables = []
## External method to add a node, its callable, and the signal to listen for.