DEV Community

Cover image for Local AI Chatbot Project Update
Rohit Rajvaidya
Rohit Rajvaidya

Posted on

Local AI Chatbot Project Update

This project is a local AI assistant built with Python and Ollama.

Latest Development Log

Project Log — AI Assistant Development

Date

March 15, 2026

Progress Today

Today I worked on improving the memory system of my local AI assistant built with Python, Ollama, and PostgreSQL.


1. Git Workflow Update

  • Created a new Git branch for database-related work:
git checkout -b feature/database_store
Enter fullscreen mode Exit fullscreen mode
  • This branch is dedicated to developing and testing database memory features without affecting the main branch.

2. PostgreSQL Memory Integration

  • Connected the assistant to a PostgreSQL database.

  • Created a memory table to store important user information.

  • Implemented database helper functions:

  • store_memory() → stores a memory in the database

  • get_memories() → retrieves stored memories

  • clear_whole_database() → clears the memory table

This allows the assistant to persist information between sessions.


3. Memory Trigger System

Added logic to detect when the user wants the assistant to remember something.

The assistant now looks for trigger words such as:

  • remember
  • store
  • save

Example:

User input:

remember my name is Rohit Rajvaidya
Enter fullscreen mode Exit fullscreen mode

The assistant detects the trigger and prepares the information for storage.


4. Memory Paraphrasing with LLM

Implemented a small LLM prompt that converts the user sentence into a clean factual memory before storing it.

Example transformation:

Input:

remember my name is Rohit Rajvaidya
Enter fullscreen mode Exit fullscreen mode

Stored memory:

User name is Rohit Rajvaidya
Enter fullscreen mode Exit fullscreen mode

This ensures the database stores structured and consistent information.


5. Output Cleaning

Added a cleanup step to remove unnecessary text returned by the model, such as:

Output:
Explanation:
Enter fullscreen mode Exit fullscreen mode

This ensures only the final fact is stored in the database.


6. Assistant Improvements

The assistant now includes:

  • Local LLM interaction using Ollama
  • Model fallback system (tinyllama → phi3 → llama3)
  • Terminal commands (clear chat, switch models)
  • Loading animation during model generation
  • PostgreSQL memory storage
  • Automatic detection of memory instructions
  • Memory paraphrasing before database storage

Next Steps

Planned improvements:

  • Inject stored memories into the system prompt so the assistant can recall user information across sessions.
  • Prevent duplicate memory entries in the database.
  • Improve memory extraction prompts.
  • Introduce structured memory types (name, preferences, location, etc.).
  • Implement memory retrieval during conversation to make the assistant more context-aware.

Previous Logs

See the full history in the ProjectLogs folder.

Here's Github Link :

Local AI Chatbot Project

This project is a local AI assistant built with Python and Ollama.

Latest Development Log

Project Log — AI Assistant Development

Date

March 15, 2026

Progress Today

Today I worked on improving the memory system of my local AI assistant built with Python, Ollama, and PostgreSQL.


1. Git Workflow Update

  • Created a new Git branch for database-related work:
git checkout -b feature/database_store
Enter fullscreen mode Exit fullscreen mode
  • This branch is dedicated to developing and testing database memory features without affecting the main branch.

2. PostgreSQL Memory Integration

  • Connected the assistant to a PostgreSQL database.

  • Created a memory table to store important user information.

  • Implemented database helper functions:

  • store_memory() → stores a memory in the database

  • get_memories() → retrieves stored memories

  • clear_whole_database() → clears the memory table

This allows the assistant to persist information between sessions.


3. Memory Trigger System

Added logic to detect when the user wants the assistant…




Top comments (0)