Skip to content

Instantly share code, notes, and snippets.

View filmo's full-sized avatar

PhilGlau filmo

  • Georgia Tech University
  • Los Angeles
View GitHub Profile
from typing import List, Optional, Dict, Any
from llama_index.core.callbacks.base_handler import BaseCallbackHandler
from llama_index.core.callbacks import CBEventType, EventPayload
from pprint import pprint
import uuid
"""
For recovering metadata from the 'raw' part of the ChatCompletion
"""
# noinspection PyAbstractClass
@filmo
filmo / symantic_if_statement.py
Created July 14, 2025 18:06
semantic IF-THEN-ELSE loops
# set of actions for which a system would require additional confirmation from the user
ACTIONS_REQUIRING_CONFIRMATION = [
"saving a file to disk",
"executing a file",
"stopping a computer process",
]
# This function takes the original user input and attempts to determine if any actions are being requested
# that require human confirmation. This is more flexible the searching for a string literal.
@filmo
filmo / flat_vs_chroma.py
Last active July 12, 2025 21:40
problem getting embeddings to store in chroma_db
# llm is a valid OpenAI|Ollama object
# Settings.embed_model is a valid "nomic-embed-text" embedding model producing 768-d vectors
# This code works and 'default_vector_store.json' contains the embeddings
documents = SimpleDirectoryReader(
"data/DIR_WORD_DOCs",
filename_as_id=False,
file_extractor={'.docx':DocxReader()}
).load_data(num_workers=num_workers)
@filmo
filmo / gist:2c1ac7467c26f62f589422aa55206a2e
Created June 18, 2018 02:52
problem with train.py for donkeycar
On line 35 shuffle is imported from sklearn
from sklearn.utils import shuffle
and then later called inside the data generator with:
shuffle(keys)
However, shuffle from sklearn does ~not~ shuffle in-place. It returns a shuffled list, leaving the input parameter untouched.
@filmo
filmo / binned_throttle.py
Last active March 14, 2018 00:50
binned throttle for donkeycar
import numpy as np
np.set_printoptions(precision=4,suppress=True,linewidth=180)
def clamp(n, min, max):
if n < min:
return min
if n > max:
return max
return n
Used a 2-layer Fully Connected network with H1=100, H2=60 and ReLU
He Initialization of weights
Adam Optimizer. Initial learning rate = 0.001 Learning rate reduced using gamma of 0.50 every 350 episodes
Gamma = 0.99
Eps = 1.00
Eps Decay = 0.98
Eps Decay every new episode. (not each step)
q_learning walkthrough. GATech OMSCS. (School policy prohibits our publishing code for honor policy)
@filmo
filmo / gist:e32bb82249c73e868ef3f23234966363
Created June 19, 2017 05:53
OMSCS GaTech walkthrough
Used Value Iteration as shown in class walkthrough. (School policy prohibits us showing code for honor policy.)
GATech OMSCS
philglau (master *) pr1 $ python submit.py gfserver
Tests that the client properly sends an ERROR response.: failed
Tests that the server properly sends an OK response and medium messag: failed
Tests that the server properly sends an OK response and a long messag: failed
Tests that the server properly sends an OK response and a short messa: failed
Tests that the server compiles: passed
Tests that the server properly handles a gfs_abort call.: passed
Tests that the server properly sends a FILE_NOT_FOUND response.: passed
Tests that the server properly handles a malformed request.: passed
Tests that the server properly handles a malformed request.: passed
philglau (master) pr1 $ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/xenial64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/xenial64'
default: URL: https://atlas.hashicorp.com/ubuntu/xenial64
==> default: Adding box 'ubuntu/xenial64' (v20160826.0.0) for provider: virtualbox
default: Downloading: https://atlas.hashicorp.com/ubuntu/boxes/xenial64/versions/20160826.0.0/providers/virtualbox.box
==> default: Successfully added box 'ubuntu/xenial64' (v20160826.0.0) for 'virtualbox'!