dimgigov
1e38e29f25
fix(security): SQL injection in Python/JS clients + bare except + session leak
...
CI / test (push) Has been cancelled
CI / verify (push) Has been cancelled
Clients CI / build-server (push) Has been cancelled
Clients CI / test-python (push) Has been cancelled
Clients CI / test-javascript (push) Has been cancelled
Clients CI / test-nim (push) Has been cancelled
Clients CI / test-rust (push) Has been cancelled
- Fix SQL injection vulnerabilities in chat_history.py, langchain_store.py,
rag_pipeline.py, baradb_langchain.js by switching to parameterized queries
- Replace dangerous bare except: with except CatchableError:/ValueError:
in llm.nim, embed.nim, cypher.nim, mcp/server.nim, executor.nim
- Fix session variable leak in MCP handleVectorSearch/handleSchemaInspect
- Build: 0 errors, all tests pass
2026-05-17 16:58:05 +03:00
dimgigov
e23b1d61d2
feat: Session 12 AI Agents & NL->SQL
...
- src/barabadb/ai/llm.nim: LLM client for NL->SQL generation
- Supports OpenAI-compatible and Ollama APIs
- Configurable via BARADB_LLM_ENDPOINT, BARADB_LLM_MODEL, BARADB_LLM_API_KEY
- extractSQL() parses SQL from LLM responses (handles markdown blocks)
- Temperature 0.1 for deterministic SQL generation
- nl_to_sql() SQL function: natural language -> SQL
- Schema-aware prompt with table column definitions + indexes + RLS
- Query validation layer: wraps generated SQL in LIMIT 0 subquery
- Self-correction loop: on error, feeds error back to LLM for fix
- Tenant-aware: respects current session variables
- schema_prompt() SQL function: generates DDL + sample data + indexes
- Returns full CREATE TABLE statement with column types and constraints
- Includes up to 5 sample rows for context
- Lists indexes, RLS policies, foreign keys
- Perfect for feeding into LLM context
- All 340+ existing tests pass
2026-05-17 15:38:14 +03:00
dimgigov
13bc17cfa8
feat: 10.1.4 Chunking + embedding pipeline
...
- New modules: src/barabadb/ai/chunk.nim (text chunking) and embed.nim (HTTP embedding client)
- chunk() SQL function: returns JSON array of chunks with configurable size/overlap
- embed_text() SQL function: calls external embedding API (OpenAI/Ollama compatible)
- Auto-embedding on INSERT: when VECTOR column is null but TEXT column is populated,
generates embeddings via configured embedder
- Configurable via env vars: BARADB_EMBED_ENDPOINT, BARADB_EMBED_MODEL, BARADB_EMBED_API_KEY
- All 340+ existing tests pass
2026-05-17 15:26:24 +03:00