feat: implement extraction step (#31) #119

Merged
shahondin1624 merged 2 commits from feature/issue-31-extraction-step into main 2026-03-10 07:03:02 +01:00

Summary

Implements post-retrieval extraction step for the Memory Service's QueryMemory pipeline. After the 4-stage retrieval returns candidates, an LLM call via Model Gateway's Inference RPC extracts the most relevant segment from each candidate's corpus.

Key changes

  • Proto changes: Added skip_extraction field to QueryMemoryRequest and extraction_confidence field to QueryMemoryResponse
  • New extraction/ module: ExtractionClient wrapping Model Gateway Inference RPC, prompt builder/parser in prompt.rs
  • ExtractionConfig in config.rs with enabled, max_tokens, temperature fields
  • Service integration: query_memory handler runs extraction on pipeline results unless disabled by config or per-request toggle
  • Graceful degradation: If extraction fails for a candidate, falls back to truncated corpus

Quality gates

  • Build: PASS
  • Clippy: PASS (zero warnings)
  • Tests: PASS (169 tests, 0 failures)
  • Coverage: PASS (>95% on all new/modified files)

Files

  • Created: extraction/mod.rs, extraction/prompt.rs, issue-031.md
  • Modified: memory.proto, config.rs, service.rs, main.rs, lib.rs, _index.md

Closes #31 | Plan: implementation-plans/issue-031.md

## Summary Implements post-retrieval extraction step for the Memory Service's `QueryMemory` pipeline. After the 4-stage retrieval returns candidates, an LLM call via Model Gateway's `Inference` RPC extracts the most relevant segment from each candidate's corpus. ### Key changes - **Proto changes:** Added `skip_extraction` field to `QueryMemoryRequest` and `extraction_confidence` field to `QueryMemoryResponse` - **New `extraction/` module:** `ExtractionClient` wrapping Model Gateway `Inference` RPC, prompt builder/parser in `prompt.rs` - **`ExtractionConfig`** in `config.rs` with `enabled`, `max_tokens`, `temperature` fields - **Service integration:** `query_memory` handler runs extraction on pipeline results unless disabled by config or per-request toggle - **Graceful degradation:** If extraction fails for a candidate, falls back to truncated corpus ### Quality gates - Build: PASS - Clippy: PASS (zero warnings) - Tests: PASS (169 tests, 0 failures) - Coverage: PASS (>95% on all new/modified files) ### Files - **Created:** `extraction/mod.rs`, `extraction/prompt.rs`, `issue-031.md` - **Modified:** `memory.proto`, `config.rs`, `service.rs`, `main.rs`, `lib.rs`, `_index.md` Closes #31 | Plan: `implementation-plans/issue-031.md`
shahondin1624 added 9 commits 2026-03-09 23:08:09 +01:00
shahondin1624 force-pushed feature/issue-31-extraction-step from 8471c5b19f to 131eac99f7 2026-03-10 07:02:53 +01:00 Compare
shahondin1624 merged commit 307408d0f5 into main 2026-03-10 07:03:02 +01:00
shahondin1624 deleted branch feature/issue-31-extraction-step 2026-03-10 07:03:02 +01:00
Sign in to join this conversation.