my first project(if you could call it that) that i've truly vibecoded initially meant to just be better than my ap csp practice create task turned into a monster
local/offline-ish chatbot with fake confidence but real python files (does more than expected and less than promised)
- math parsing
- sympy solving (single var, multi var, systems)
- intent/emotion detection
- context-ref matching
- does the cool ai math thing with words -> vectorization
- topic extraction
- follow-ups
- looks stuff up on wikipedia when local brain is cooked
recent additions:
- correction handling (
no, i meant x) - pronoun/reference repair (
can you explain that?) - light knowledge graph expansion
- adaptive depth (simple vs deep)
- strategy-based replies (direct, socratic, analogy, hints)
- nonchalant style pass (less support bot, more chill)
- no-key wikipedia fallback when local brain fails
- solve-for-x -> solve-for-anything (
x,y,a, systems, roots)
- just about everything
more specifically:
- not a real llm
- not trained on your private brain notes
- regex can and will occasionally do regex things
- memory is short and selective, like me on precalc tests
- confidence score != actual correctness
- symbolic solving can get cursed-looking exact forms for some equations
chatbot.py: main loop + glueintent.py: intent + entities + math parserresponses.py: reply gen + tone + strategy + graph usememory.py: chat memory + profile-ish state + refsknowledge.json: tiny local facts + concept graphutils.py: typing effect + text/vector helpers
- user says something
- intent detector scores it (semantic + pattern + structure + state)
- entities are extracted (topic, expression, correction target, pronoun ref)
- memory stores both user and bot messages w/ vectors
- response generator picks a template, depth, tone, and strategy
- you get an answer that is sometimes surprisingly solid
cd chatbot-ollama
.venv\Scripts\python.exe chatbot.pyif you dont have the venv yet:
python -m venv .venv
.venv\Scripts\python.exe -m pip install sympy
.venv\Scripts\python.exe chatbot.pyto stop the venv:
deactivatefor mac/linux equivalent:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install sympy
python chatbot.py- python 3.10+
- sympy (symbolic solving)
- standard library only for everything else (including wikipedia lookup)
explain machine learning in simple termsno, i meant artificial intelligencecan you explain that?what is 12 mod 5i'm stuck, give me a hintexplain python with an analogysolve for a: a^2 - 5a + 6 = 0solve for x and y: 2x + y = 5, x - y = 1solve x^3 - 6x^2 + 11x - 6 = 0who is alan turing(forces lookup path if local logic taps out)
- if input is vague enough, it asks for clarification (better than hallucinating ig)
- sometimes it gets the right intent for the wrong reason
- math handling is safe-ish and p strict
- internet lookup depends on internet existing and wikipedia not being mad at your request
- some symbolic answers are exact but unreadable unless you're into math masochism
- better multi-step tracking
- less brittle parsing
- stronger topic graph + retrieval
- cleaner tests so future me doesnt suffer
- inequality solving and domain constraints (
real-only,integer-only) - optional step-by-step algebra traces
because building things is fun and overengineering random stuff is a hobby
my bad decisions and several ai models tag-teaming the codebase
used:
- gpt-5.4 for planning
- deepseek-v3.1:671b for initial setup
- combination of opus-4.6, gpt-5.3-codex, and gpt 5.4 for development