This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Timmy-time-dashboard/index_research_docs.py
Alexander Whitestone 3e31cafa83 feat: Implement semantic index for research outputs (#976)
Integrates Ollama embedding for semantic indexing of research outputs. Refactors
memory_search and memory_store tools to align with issue requirements.

- Added  and  to .
- Modified  to use  and
  for generating embeddings via Ollama, with a fallback to .
- Renamed  to  in ,
  adjusting its signature to .
- Updated  in  to use
  as default and pass confidence scoring.
- Created  to demonstrate indexing of research documents.

Fixes #976
2026-03-23 14:15:40 -04:00

34 lines
1.1 KiB
Python

import os
import sys
from pathlib import Path
# Add the src directory to the Python path
sys.path.insert(0, str(Path(__file__).parent / "src"))
from timmy.memory_system import memory_store
def index_research_documents():
research_dir = Path("docs/research")
if not research_dir.is_dir():
print(f"Research directory not found: {research_dir}")
return
print(f"Indexing research documents from {research_dir}...")
indexed_count = 0
for file_path in research_dir.glob("*.md"):
try:
content = file_path.read_text()
topic = file_path.stem.replace("-", " ").title() # Derive topic from filename
print(f"Storing '{topic}' from {file_path.name}...")
# Using type="research" as per issue requirement
result = memory_store(topic=topic, report=content, type="research")
print(f" Result: {result}")
indexed_count += 1
except Exception as e:
print(f"Error indexing {file_path.name}: {e}")
print(f"Finished indexing. Total documents indexed: {indexed_count}")
if __name__ == "__main__":
index_research_documents()