mirror of https://github.com/sysown/proxysql
This commit addresses critical fixes to the sqlite-rembed demonstration scripts
and adds environment variable support for API key configuration.
Key Changes:
1. Fixed sqlite-rembed-demo.sh similarity search queries:
- Changed FROM demo_embeddings e JOIN ... WHERE embedding MATCH pattern
- To correct subquery pattern required by sqlite-vec: FROM (SELECT rowid, distance ... LIMIT) e JOIN ...
- This resolves "A LIMIT or 'k = ?' constraint is required on vec0 knn queries" error
- All three similarity search queries now use proper subquery structure
2. Added comprehensive cleanup at script start:
- Added DROP TABLE IF EXISTS for all demo_embeddings related tables
- Prevents "UNIQUE constraint failed on demo_embeddings primary key" errors
- Uses INSERT OR REPLACE instead of INSERT for embedding storage
3. Added environment variable support for API_KEY:
- Updated all demonstration scripts to use API_KEY="${API_KEY:-YOUR_API_KEY}"
- Users can now set API_KEY environment variable: export API_KEY="actual_key"
- Falls back to YOUR_API_KEY placeholder if environment variable not set
- Improves security by avoiding hardcoded keys in scripts
4. Updated documentation:
- Modified SQLITE-REMBED-TEST-README.md to document environment variable usage
- Updated comments in all scripts to mention environment variable option
Files Modified:
- doc/sqlite-rembed-demo.sh: Fixed similarity search queries, added cleanup,
added environment variable support
- doc/sqlite-rembed-examples.sh: Added environment variable support
- doc/sqlite-rembed-test.sh: Added environment variable support
- doc/SQLITE-REMBED-TEST-README.md: Updated documentation for env var support
Verification:
- sqlite-rembed-demo.sh now runs successfully end-to-end
- All similarity search queries execute without errors
- Environment variable fallback works correctly
- Scripts maintain backward compatibility with direct key replacement
pull/5310/head
parent
e75bd7c84a
commit
612ef326bc
Loading…
Reference in new issue