Commit History
-
[NOTICKET] perf(slow-path): DB3 pre-connect + R4 progress events
Rifqi Hafizuddin +1: Claude Opus 4.8DB3 (DB owner): DbExecutor.prewarm(catalog, user_id) warms the pooled engine for schema sources, fired (best-effort, never raises) at slow-path entry so the cold first-query TCP+TLS+auth handshake overlaps the ~4s Planner LLM call. Gated to the default path (skipped when a coordinator factory is injected, so tests stay hermetic). Reuses DbExecutor's existing client resolution + the DB2 engine cache. R4 (agent): SlowPathCoordinator.run gained an optional `progress` callback; ChatHandler bridges it to SSE `status` events via an asyncio queue, and chat.py forwards them. The slow path no longer streams ~13s of silence — live timeline now shows Planning -> Running N steps -> Composing, max wire gap ~4.6s, fixing proxy idle-timeout + UX. Status events only appear when the coordinator calls back, so the existing wiring test's event sequence is unchanged (fake coordinator just accepts **kwargs). Token-streaming the Assembler answer is deferred: it would require splitting the Assembler into a …735c421 -
[NOTICKET][AI] perf(chat): PR-DB1 - memoizing catalog reader + shared ChatHandler
Rifqi Hafizuddin +1: Claude Opus 4.8Cut redundant catalog-DB round-trips in the slow path and stop rebuilding the Azure LLM clients per request. - MemoizingCatalogReader (catalog/reader.py): request-scoped wrapper that caches each read by source_hint. ChatHandler builds one per request and threads it into the slow-path DataAccessToolInvoker, so the planner's catalog load is reused by describe_source / query_structured instead of re-reading from the catalog DB. Measured live: describe_source 3.5s -> ~2.0s; catalog reads/request ~5 -> ~2. - chat.py: one module-level ChatHandler singleton instead of per-request, keeping the Orchestrator/Chatbot Azure clients (and TLS pools) warm across requests. Does not touch the external query_structured handshake (that is the engine-cache work, DB2). Also logs the principal-review fix tracker (R1-R12, DB1-DB3) in PROGRESS. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>4c62146
-
[KM-631][AI] Langfuse tracing: tokens + latency across the chat pipeline
Rifqi Hafizuddin +1: Claude Opus 4.8Wire Langfuse (was scaffolded-only) so each chat request emits one trace with per-call token counts + latency, plus tool spans. Gated and PII-aware. - New src/observability/langfuse/tracing.py: RequestTracer (one trace/request), NullTracer (no-op), TracingToolInvoker (metadata-only span per tool call), _redact MaskFunction. Best-effort: never raises; pipeline unchanged if Langfuse is down or disabled. - Each LLM call (Orchestrator, Planner incl. retries, Assembler, Chatbot) gained an optional `callbacks` param, passed to the LangChain call only when present (so existing fakes/tests are untouched). Coordinator threads planner/assembler callbacks through. - ChatHandler: enable_tracing flag (default OFF so tests never hit Langfuse), creates one trace per request, wraps the tool invoker for spans, ends the trace. - PII policy for Cloud: UNMASKED = Orchestrator + Planner (PII-safe inputs); MASKED (tokens+latency only) = Assembler + Chatbot (see real rows / doc chunks); to…8cb3714 -
[KM-626][AI] Slow-path wiring prep: context + persistence seams, retrieve_documents few-shot
Rifqi Hafizuddin +1: Claude Opus 4.8Three small steps that de-couple the live wiring from the remaining blockers so flipping enable_slow_path on later is a one-liner. - BusinessContext seam: new get_business_context(user_id) (planner/business_context.py) is the single place context is read — returns a stub today, swap the body when the lead's real source lands. ChatHandler now reads through it. - AnalysisStore seam: new slow_path/store.py (Protocol + NullAnalysisStore no-op that logs only). ChatHandler persists the analysis_record through it after streaming (never breaks the answer on failure). Real Postgres-backed store in the catalog DB (Neon dataeyond) is a TODO — table not created yet. - Planner few-shot: add Example C (retrieve_documents) — a mixed structured + unstructured plan showing an independent document-retrieval branch (NL query, no ${t} placeholder, runs in parallel). The Planner had no retrieve_documents example. Verified: slow_path + planner suites green (52 passed); live RUN_PLANNER_EVAL …3b27b6b -
[KM-626][AI] ChatHandler: gated structured->slow-path wiring
Rifqi Hafizuddin +1: Claude Opus 4.8Add an off-by-default slow analytical path to ChatHandler. When enable_slow_path=True, a `structured` intent routes to SlowPathCoordinator (Planner -> TaskRunner -> Assembler) instead of the single-query QueryService path, streaming the assembled chat_answer as SSE. - New keyword-only ctor params: enable_slow_path (default False) and an injectable slow_path_coordinator_factory for tests. - _get_slow_path_coordinator is the composition root: builds a per-request CompositeToolInvoker (data-access needs user_id + CatalogReader) so the slow_path/ package stays tool-agnostic (INV-7). - Flag defaults off and chat.py constructs ChatHandler() unchanged, so live behavior is identical. Gated on two stubs before flipping on: _stub_business_context (-> lead's real BusinessContext) and analysis_record persistence (no store yet). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>50df057
-
[KM-582][DED][AI] Fix Retrieval in Agentic Service
ticket: https://bukittechnology.atlassian.net/browse/KM-582 fix: replace LangChain ORM retrieval with raw SQL and fix pgvector collection name - Rewrite DocumentRetriever.retrieve() using raw SQL cosine/manhattan queries instead of LangChain PGVector ORM, bypassing asyncpg type-mapping issues (id String vs UUID column, jsonb_path_match binding quirks) - Fix _COLLECTION_NAME from "document_embeddings" to "documents" to match the collection name set by the Golang ingestion service - Fix collection_name in vector_store.py to match consistently - Fix Redis chat cache to store {response, sources} dict so cached replies also populate message_sources table - Add cache management endpoints: DELETE /chat/cache, /chat/cache/room/{id}, /retrieval/cache/{user_id} - Invalidate retrieval cache automatically after document processing - Update intent_router prompt: route topical/knowledge questions to unstructured even without explicit document mention; prefer unstructured when ambiguous…61c746f
-
feat/Catalog Retrieval System (#1)
- initial commit (8557a2045ca2c0873e07efdf6227064b83e4a1e5) - initial structure (efc0c0a8b2444014cbe74f04617c3c974d9915be) - [KM-553] initialize shared contract (f31f6731692b0199d8cb5c5d29dffa466d6d4ca0) - [KM-553] migrate retrieval layer and remove obsolete rag/tools modules (df220ea47c96eb8a1efa07c6eebef4604fc308d6) - [NOTICKET] catalog enricher + structured pipeline + on_db_registered (77ea82d29d86400c5ed30ac154be8df6a7e897eb) - Merge commit 'refs/pr/1' of https://huggingface.co/spaces/DataEyond/Agentic-Service-Data-Eyond-Catalog into pr/1 (0ae8717c7efce2cda14fe4b8caecd774459b1f6e) - [NOTICKET] SqlCompiler (Postgres) + DbExecutor (212dad360714508c1aa607995039e6818fa40f78) - Merge commit 'refs/pr/1' of https://huggingface.co/spaces/DataEyond/Agentic-Service-Data-Eyond-Catalog into pr/1 (faf8a4f6d7e06ccf1ce84c2e7f4990c79f27f843) - TabularIntrospector + on_tabular_uploaded trigger + 31 tests (ca425208969b72a20ed76f86ef0faa1a0e912339) - [KM 556] add columns field to QueryResult + update…6bff5d9