Rifqi Hafizuddin commited on
Commit
2adb6e1
Β·
1 Parent(s): 277f7e2

update claude.md files

Browse files
Files changed (2) hide show
  1. PROGRESS.md +2 -2
  2. REPO_CONTEXT.md +3 -3
PROGRESS.md CHANGED
@@ -83,7 +83,7 @@ Persistent tracker mirroring the 42-item ownership table in `REPO_CONTEXT.md` "T
83
  | 17 | IR validator (`query/ir/validator.py`) | B | `[x]` | PR1 (DB owner) β€” full rule set; descriptive errors for planner retry |
84
  | 18 | Planner LLM service (`query/planner/service.py`) | B | `[x]` | PR2b β€” Azure OpenAI structured output β†’ `QueryIR`. Injectable chain. Supports retry via `previous_error` argument. |
85
  | 19 | Planner prompt (`query/planner/prompt.py`, `config/prompts/query_planner.md`) | B | `[x]` | PR2b β€” system prompt with hard constraints + few-shot for DB and tabular sources. `build_planner_prompt(question, catalog, previous_error)` calls `catalog.render.render_source` (renamed from `catalog.enricher.render_source` in KM-557). |
86
- | 20 | Intent router (`agents/intent_router.py`, `config/prompts/intent_router.md`) | B | `[x]` | PR2b β€” single LLM call β†’ `IntentRouterDecision(needs_search, source_hint, rewritten_query)`. Supports conversation history. |
87
  | 21 | Executor base + `QueryResult` (`query/executor/base.py`) | B | `[x]` | Pre-existing scaffold |
88
  | 22 | Executor dispatcher (`query/executor/dispatcher.py`) | B | `[x]` | PR4 β€” picks DbExecutor / TabularExecutor by `source.source_type`. Lazy imports of production executors keep import side-effect-free for tests. Caches per source_type. |
89
  | 23 | Compiler base ABC (`query/compiler/base.py`) | B | `[x]` | Pre-existing scaffold |
@@ -235,7 +235,7 @@ the upcoming catalog refresher.
235
  ## What shipped previously (PR2b/4/5/6/7-bundle β€” DB owner solo, teammate reviews)
236
 
237
  **Files implemented**:
238
- - `src/agents/intent_router.py` β€” `IntentRouter.classify(message, history) β†’ IntentRouterDecision`. Pydantic model for structured output. History-aware query rewriting.
239
  - `src/agents/answer_agent.py` β€” `AnswerAgent.astream(...)` streams answer tokens; accepts `QueryResult` and/or `list[DocumentChunk]`. Renames to `chatbot.py` in cleanup PR.
240
  - `src/agents/chat_handler.py` β€” `ChatHandler.handle(message, user_id, history)` returns `AsyncIterator[dict]` of `intent` / `chunk` / `done` / `error` SSE events. All deps injectable; lazy default builders.
241
  - `src/query/planner/prompt.py` β€” `render_catalog(catalog)` + `build_planner_prompt(question, catalog, previous_error)`. Reuses `catalog.enricher.render_source` for consistency across LLM call sites.
 
83
  | 17 | IR validator (`query/ir/validator.py`) | B | `[x]` | PR1 (DB owner) β€” full rule set; descriptive errors for planner retry |
84
  | 18 | Planner LLM service (`query/planner/service.py`) | B | `[x]` | PR2b β€” Azure OpenAI structured output β†’ `QueryIR`. Injectable chain. Supports retry via `previous_error` argument. |
85
  | 19 | Planner prompt (`query/planner/prompt.py`, `config/prompts/query_planner.md`) | B | `[x]` | PR2b β€” system prompt with hard constraints + few-shot for DB and tabular sources. `build_planner_prompt(question, catalog, previous_error)` calls `catalog.render.render_source` (renamed from `catalog.enricher.render_source` in KM-557). |
86
+ | 20 | Intent router (`agents/orchestration.py` β€” class `OrchestratorAgent`; `config/prompts/intent_router.md`) | B | `[x]` | PR2b β€” single LLM call β†’ `IntentRouterDecision(needs_search, source_hint, rewritten_query)`. Supports conversation history. **NOTE**: source filename + class name were kept from Phase 1 for import-site compatibility; only the body is Phase 2. Prompt file and test file use the `intent_router` name. |
87
  | 21 | Executor base + `QueryResult` (`query/executor/base.py`) | B | `[x]` | Pre-existing scaffold |
88
  | 22 | Executor dispatcher (`query/executor/dispatcher.py`) | B | `[x]` | PR4 β€” picks DbExecutor / TabularExecutor by `source.source_type`. Lazy imports of production executors keep import side-effect-free for tests. Caches per source_type. |
89
  | 23 | Compiler base ABC (`query/compiler/base.py`) | B | `[x]` | Pre-existing scaffold |
 
235
  ## What shipped previously (PR2b/4/5/6/7-bundle β€” DB owner solo, teammate reviews)
236
 
237
  **Files implemented**:
238
+ - `src/agents/orchestration.py` β€” `OrchestratorAgent.classify(message, history) β†’ IntentRouterDecision`. Pydantic model for structured output. History-aware query rewriting. Phase 1 filename + class name preserved; body fully rewritten for Phase 2.
239
  - `src/agents/answer_agent.py` β€” `AnswerAgent.astream(...)` streams answer tokens; accepts `QueryResult` and/or `list[DocumentChunk]`. Renames to `chatbot.py` in cleanup PR.
240
  - `src/agents/chat_handler.py` β€” `ChatHandler.handle(message, user_id, history)` returns `AsyncIterator[dict]` of `intent` / `chunk` / `done` / `error` SSE events. All deps injectable; lazy default builders.
241
  - `src/query/planner/prompt.py` β€” `render_catalog(catalog)` + `build_planner_prompt(question, catalog, previous_error)`. Reuses `catalog.enricher.render_source` for consistency across LLM call sites.
REPO_CONTEXT.md CHANGED
@@ -101,7 +101,7 @@ src/ β€” all application code
101
 
102
  | Path | Role |
103
  |---|---|
104
- | `agents/intent_router.py` | classify message β†’ `needs_search`, `source_hint ∈ {chat, unstructured, structured}`, `rewritten_query` |
105
  | `agents/chatbot.py` | `ChatbotAgent` β€” final answer formation (receives Cu chunks or QueryResult); SSE-streamed via `astream` |
106
  | `agents/chat_handler.py` | `ChatHandler` β€” top-level orchestrator; routes to chat / unstructured / structured and yields SSE-style `intent`/`chunk`/`done`/`error` events |
107
 
@@ -286,7 +286,7 @@ Single-table only in v1. `having`, `offset`, boolean filter trees, `distinct`, j
286
  | Catalog ingestion β€” unstructured | βœ… | `on_document_uploaded` implemented; full DocumentPipeline (extract β†’ chunk β†’ embed β†’ PGVector) |
287
  | Catalog store / reader / validator / PII detector | βœ… | `data_catalog` jsonb table (renamed from `catalogs` in KM-557) |
288
  | LLM enrichment | ❌ removed (KM-557) | Cost cut β€” planner reads `column.stats` + `sample_values` + `top_values` + `column.name` directly. `catalog/render.py` keeps the source-rendering helper |
289
- | `IntentRouter` | βœ… | 3-way `source_hint`, history-aware query rewriting |
290
  | `CatalogReader` | βœ… | Loads full catalog; filters by `source_hint` |
291
  | `QueryPlanner` LLM call | βœ… | Azure OpenAI structured output β†’ `QueryIR`; supports retry with `previous_error` |
292
  | IR validator | βœ… | Catalog-aware; full rule set; descriptive errors |
@@ -351,7 +351,7 @@ The service is built by two engineers; many modules are source-type-agnostic and
351
  | 17 | IR validator (catalog-aware) | `query/ir/validator.py` | B | Recommend DB; both must agree on exact error messages so retry-prompt is consistent |
352
  | 18 | Planner LLM service | `query/planner/service.py` | B | Type-agnostic |
353
  | 19 | Planner prompt (catalog β†’ text) | `query/planner/prompt.py`, `config/prompts/query_planner.md` | B | **Pair-program**. Must describe DB tables and tabular files in one consistent format |
354
- | 20 | Intent router (chat/unstructured/structured) | `agents/intent_router.py`, `config/prompts/intent_router.md` | B | Type-agnostic |
355
  | 21 | Executor base + `QueryResult` | `query/executor/base.py` | B | Lock the shape before either implements an executor |
356
  | 22 | Executor dispatcher | `query/executor/dispatcher.py` | B | Reads `source.source_type` from catalog; pair |
357
  | 23 | Compiler base ABC | `query/compiler/base.py` | B | Already done |
 
101
 
102
  | Path | Role |
103
  |---|---|
104
+ | `agents/orchestration.py` | `OrchestratorAgent` β€” classifies message β†’ `needs_search`, `source_hint ∈ {chat, unstructured, structured}`, `rewritten_query`. Filename + class name kept from Phase 1; body replaced with Phase 2 logic. Output model is `IntentRouterDecision` |
105
  | `agents/chatbot.py` | `ChatbotAgent` β€” final answer formation (receives Cu chunks or QueryResult); SSE-streamed via `astream` |
106
  | `agents/chat_handler.py` | `ChatHandler` β€” top-level orchestrator; routes to chat / unstructured / structured and yields SSE-style `intent`/`chunk`/`done`/`error` events |
107
 
 
286
  | Catalog ingestion β€” unstructured | βœ… | `on_document_uploaded` implemented; full DocumentPipeline (extract β†’ chunk β†’ embed β†’ PGVector) |
287
  | Catalog store / reader / validator / PII detector | βœ… | `data_catalog` jsonb table (renamed from `catalogs` in KM-557) |
288
  | LLM enrichment | ❌ removed (KM-557) | Cost cut β€” planner reads `column.stats` + `sample_values` + `top_values` + `column.name` directly. `catalog/render.py` keeps the source-rendering helper |
289
+ | `IntentRouter` (lives as `OrchestratorAgent` in `agents/orchestration.py`) | βœ… | 3-way `source_hint`, history-aware query rewriting. Filename + class name kept from Phase 1; Phase 2 body |
290
  | `CatalogReader` | βœ… | Loads full catalog; filters by `source_hint` |
291
  | `QueryPlanner` LLM call | βœ… | Azure OpenAI structured output β†’ `QueryIR`; supports retry with `previous_error` |
292
  | IR validator | βœ… | Catalog-aware; full rule set; descriptive errors |
 
351
  | 17 | IR validator (catalog-aware) | `query/ir/validator.py` | B | Recommend DB; both must agree on exact error messages so retry-prompt is consistent |
352
  | 18 | Planner LLM service | `query/planner/service.py` | B | Type-agnostic |
353
  | 19 | Planner prompt (catalog β†’ text) | `query/planner/prompt.py`, `config/prompts/query_planner.md` | B | **Pair-program**. Must describe DB tables and tabular files in one consistent format |
354
+ | 20 | Intent router (chat/unstructured/structured) | `agents/orchestration.py` (class `OrchestratorAgent` β€” Phase 1 filename + class name preserved; Phase 2 body), `config/prompts/intent_router.md` | B | Type-agnostic. The prompt file uses `intent_router.md`, but the source module is still `orchestration.py` |
355
  | 21 | Executor base + `QueryResult` | `query/executor/base.py` | B | Lock the shape before either implements an executor |
356
  | 22 | Executor dispatcher | `query/executor/dispatcher.py` | B | Reads `source.source_type` from catalog; pair |
357
  | 23 | Compiler base ABC | `query/compiler/base.py` | B | Already done |