ai-experiment/usage-embed.sh

19 lines
596 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PYTHON="${PYTHON:-$BASE_DIR/.venv/bin/python}"
if [ ! -x "$PYTHON" ]; then
echo "Venv not found. Create it with: python3 -m venv .venv && .venv/bin/pip install -r requirements.txt" >&2
exit 1
fi
if [ $# -lt 1 ]; then
echo "Usage: $0 <text...> [--prefix <task prefix>]" >&2
echo " Embed text(s) with nomic-embed-text-v1.5 (llama.cpp)." >&2
echo " Default prefix and model path are set in config/embed.py." >&2
exit 1
fi
"$PYTHON" "$BASE_DIR/embed_runner.py" "$@"