Spaces:
Sleeping
Sleeping
Commit History
-
Update commitment to VC scripts
3626208
-
Merge branch 'main' of https://huggingface.co/spaces/CGIAR/PERI-AI
d113d61 -
local updates
d3dee93
-
Update src/ingest.py
Verified signature7a17e0a
-
Update src/ingest.py
Verified signatureaba1e48 -
Update src/ingest.py
Verified signature6ccd595
-
Update support for llama/HF models
5044f4c
-
fix: pre-release audit round 12 — 33 bugs fixed across all tiers
Tier 1 (ship-blockers): - README/verifier layer count corrected to 7-layer/10-point - SQL keyword regex now strips quoted strings before checking - validate_citations counts unique sources, extracts from body only - Provider-specific error messages for all 3 LLM backends - Missing config error handling in ingest.py entry point Tier 2 (quality): - SQL injection: alphanumeric validation on interpolated values - LIKE wildcard escaping with ESCAPE clause - Fallback builds fresh keyword query instead of re-running failed SQL - NaN/NaT/inf filtering across all tabular readers - Merged docx table cells deduplicated via element identity - .env double-escaping fix in setup wizard - Verification LLM exceptions skip correction instead of triggering it - References check handles SQL and web sources - Dead pre-loop validate_citations removed - KB meta extension detection uses Path.suffix - QU prompt omits SQL fields when no schema available - Redundant collection.count() eliminated - Row padding f…fbd18c8
-
fix: clear both kb_meta.txt and kb_meta_brief.txt on every re-ingestion
Ensures stale overview files are always overwritten, both in the normal ingestion path and the no-files-found cleanup path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>b199600 -
fix: curated model lists, reasoning model token scaling, skip temp files
- Restrict each provider to 3 supported models instead of fetching all from API (OpenAI: gpt-4.1/4o/4o-mini, Anthropic: sonnet/opus/haiku, Gemini: 2.5-pro/2.5-flash/2.0-flash) - Scale up max_completion_tokens 4x for OpenAI reasoning models (o1/o3/o4) since reasoning tokens count against the budget - Skip ~$ temp Excel files during ingestion - Log LLM errors in codebook description generation for debugging Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>112b4f4 -
fix: pre-release audit round 9 — anti-hallucination hardening + error handling
CRITICAL: Correction prompt now includes previous response for targeted fixing instead of blind regeneration (AH-06). HIGH fixes: - Add deterministic citation audit Layer 4.5 (AH-12) - Strengthen verification to 10-point checklist with exact-evidence requirement (AH-07) - Warn when verification disabled or max_iterations=0 (AH-08) - Fix Gemini NameError crash in ValueError handler (ERR-1) - Add error handling to OpenAI/Anthropic with sanitized messages (ERR-2) - Clear stale data when knowledge_base/ is empty (BUG-P1) MEDIUM fixes: - Sanitize Gemini exception messages to prevent API key leaks (SEC-1) - Add config.yaml to .gitignore (SEC-2) - Detect Gemini error strings in verifier guard - Recompute citation warnings each verification iteration 174/174 tests passing. Bug fix log updated. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>91410f8 -
fix: Round 8 audit — 15 bugs fixed across 10 files (1 CRITICAL, 7 HIGH, 3 MEDIUM, 4 LOW)
Security fixes: - CRITICAL: execute comment-stripped SQL query (not original) to prevent injection bypass - HIGH: iterative comment stripping to handle nested comment attacks - HIGH: expand dangerous SQL keyword blocklist from 11 to 23 entries - HIGH: data loss prevention — deferred clear only on first successful embed Robustness fixes: - HIGH: parse_verification_result(None) crash guard - HIGH: try/except on all verification loop generate() calls - HIGH: empty rows guard in Excel reader - MEDIUM: strict boolean normalization for verification pass/fail - MEDIUM: R-style "na" added to null string detection - MEDIUM: broad exception handling for Gemini API errors Minor fixes: - LOW: distinct error message for empty LLM response vs no sources - LOW: bounds check on setup wizard model selection - LOW: route/sql_query keys in CLI and web fallback dicts - LOW: SQL fallback extended to route="both" Cross-checked by 2 verification agents — all fixes confirmed correct. 165/165 tests passing,…9093d8f -
fix: 10 bugs (4 HIGH + 6 MEDIUM) from comprehensive codebase audit
HIGH fixes: - H1: Gemini blocked-response detection in verifier (safety filter short-circuit) - H2: Config load crash guard in app_web.py (st.stop instead of traceback) - H3: Brace-escape user text in kb_meta.py prompts (prevent KeyError) - H4: Web UI clarification state tracking (pending_clarification_question) MEDIUM fixes: - M1: Preserve leading zeros as TEXT in sql_ingest type inference - M2: Deferred clearing in ingest.py prevents data loss on total failure - M3: Strip markdown fences from LLM-generated SQL in sql_retriever - M4: max_iterations=0 guard in verifier (skip verification, do not refuse) - M5: Add clarification QA to conversation history for pronoun resolution - M6: Remove hardcoded knowledge_base/ prefix in retriever source paths Also adds CLAUDE.md, docs/plans/, full test suite (162 tests, 17 files), and updates WORKLOG.md with audit results. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1330e5c
-
fix: harden source display, subdirectory paths, and chunk ID uniqueness
- app_cli: _format_sources now includes SQL results in /sources output - ingest: source_name uses full relative path (preserves subdirectories) - ingest: chunk IDs use full path prefix to prevent collisions - kb_meta: import _escape_braces from prompts instead of duplicating Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>01b9f34 -
feat: add KB meta overview for meta-question answering and LLM awareness
Generate an LLM-powered high-level summary of the knowledge base at ingestion time. The overview is stored as a ChromaDB chunk (enabling vector search for meta-questions like "what data do you have?") and injected into QU and system prompts (giving the LLM full KB awareness for routing and contextualized answers). New: src/kb_meta.py, tests/test_kb_meta.py (20 tests) Modified: ingest.py, prompts.py, query_engine.py, verifier.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>8f35c1b -
feat: integrate SQL ingestion into the main ingest pipeline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>3653d68 -
fix: harden codebase against format injection, empty responses, and unsafe config access
- Add _escape_braces() to all prompt builders to prevent str.format() crash when user documents contain {placeholder} patterns - Fix app_web.py display_query fallback to preserve clarification context - Add empty-response guards to all 3 LLM providers (openai, anthropic, gemini) - Replace all remaining direct dict access with .get() + defaults - Add 2 regression tests for curly-brace format injection - Expand query engine tests with display_query coverage - 62 tests pass across 13 test files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>9815e49 -
fix: use .get() for all config access + add CLAUDE.md and docs to repo
- src/ingest.py: replace cfg["paths"]["vector_db"] and cfg["paths"]["knowledge_base"] with .get() + defaults - src/llm/__init__.py: replace cfg["llm"]["provider"] and cfg["llm"].get(...) with safe llm_cfg = cfg.get("llm", {}) - src/search/__init__.py: replace r['authors'], r['title'], etc. with .get() + defaults in web results formatter - app_web.py: respect max_clarifications config (was hardcoded to allow 1 round regardless of config) - tests/test_setup.py: add missing assertions for retrieval.top_k and retrieval.max_distance - Add CLAUDE.md, docs/plans/, docs/WORKLOG.md to the repository Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>83087ed -
Initial commit: RAG Research Chatbot Template
Citation-verified research assistant with 6-layer anti-hallucination stack, 15 file format readers, 3 LLM providers, and dual CLI/Web interfaces. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>0017280