I spent some time this week sorting out a free / open source stack for adding RAG / LLM based on ESP32 temperature / humidity data.

Ollama - downloads open source models and runs them locally

LLMs - pretrained models that generate conversational responses to prompts, and can be constrained to specific domains and structured outputs

  • gemma2 - Google’s open weight LLM
  • llama3 - Meta’s open weight LLM, NOT related to Ollama
  • gpt-oss - Open AI’s open weight LLM

Text embedding models - small dedicated models for converting text to vectors so an LLM can read them:

  • bge-m3 or nomic-embed-text

LangChain - standardized types and language wrapper for AI agents in python and typescript

  • langchain-ollama integration - Makes it simpler to switch between model APIs without changing code
  • langchain-text-splitters - packages for splitting up PDFs and websites as embeddable chunks of text with metadata

PostgreSQL -

  • supabase - not open source but generous free tier cloud db
  • pgvector - python extension that enables SQL similarity search
  • chromaDB - more advanced storage option specifically for vectors -- for now using supabase / pgvector instead

Retrieval Augmented Generation (RAG) bibliography - starting with a small literature corpus on the subject of indoor environmental sensing for the LLM to consult when providing an answer

  • Mobaraki et al., “Application of Low-Cost Sensors for Building Monitoring: A Systematic Literature Review (Buildings 2021)
  • Mobaraki et al., “Application of Low-Cost Sensors for Accurate Ambient Temperature Monitoring” (Buildings 2022)
  • Venkata et al., “Challenges and Opportunities in Calibrating Low-Cost Environmental Sensors” (Sensors, 2024)
  • Integrating Low-cost Sensor Systems and Networks to Enhance Air Quality Applications (World Meterological Organization, 2024) - PDF
  • ASHRAE 55 Thermal Conditions for Human Occupancy - outdated 2013 standard is available free in PDF and/or use wikipedia
  • International Performance Measurement & Verification (M\&V) Protocol - Concepts and Practices for Improved Indoor Environmental Quality Volume II - PDF
  • M\&V Guidelines: Measurement and Verification for Performance Based Contracts Version 4.0 (US Department of Energy, November 2015) - PDF