AetheriaLore/scripts/rag/rag.ps1
Meta Vens f339aae186 Add local RAG tooling for vault navigation
Introduce a lightweight local Retrieval-Augmented-Generation (RAG) toolchain for the Aetheria Obsidian vault. Added scripts/rag/rag.py (indexing, chunking, embedding, hybrid semantic+lexical query, stats, and install), a PowerShell wrapper scripts/rag/rag.ps1 that resolves Python and forwards commands, and scripts/rag/README.md with usage (install, build, query, stats). Add requirements-rag.txt for qdrant-client[fastembed] and pywin32, and include a compiled __pycache__ file. Update .gitignore to ignore the .rag/ artifact directory and update AGENTS.md with Vault Navigation guidance recommending the local RAG workflow. The tool stores local artifacts under .rag/ (pydeps, qdrant, model cache, chunks and manifest) and defaults to a CPU-friendly embedding model.
2026-04-19 00:32:30 +01:00

40 lines
993 B
PowerShell

param(
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$Arguments
)
$bundledPython = "C:\Users\Meta\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe"
function Resolve-Python {
if ($env:AETHERIA_RAG_PYTHON -and (Test-Path $env:AETHERIA_RAG_PYTHON)) {
return $env:AETHERIA_RAG_PYTHON
}
if (Test-Path $bundledPython) {
return $bundledPython
}
$python = Get-Command python -ErrorAction SilentlyContinue
if ($python) {
return $python.Source
}
$pyLauncher = Get-Command py -ErrorAction SilentlyContinue
if ($pyLauncher) {
return "$($pyLauncher.Source) -3"
}
throw "No Python interpreter found. Set AETHERIA_RAG_PYTHON to a valid python.exe path."
}
$pythonCommand = Resolve-Python
$ragScript = Join-Path $PSScriptRoot "rag.py"
if ($pythonCommand -like "* -3") {
& py -3 $ragScript @Arguments
}
else {
& $pythonCommand $ragScript @Arguments
}
exit $LASTEXITCODE