Files
local 5b027eb0db feat: add extraction schema, sidebar nav, few-shot prompting, and prompt settings
Overhaul extraction pipeline with new TradeItem model, conversation flow,
and dedicated extraction endpoint. Add sidebar navigation with NavMenu
component and landing page. Introduce few-shot prompting service and
tests. Add prompt settings and email upload specs. Update OpenSpec
tooling with improved export-spec and extract-feature commands. Archive
completed changes and export full specs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 23:39:23 +01:00

2.3 KiB

ADDED Requirements

Requirement: Extraction API endpoint

The API SHALL expose POST /api/chat/extract that accepts an ExtractionRequest containing the email HTML content and optional follow-up conversation messages. The endpoint SHALL use the few-shot ChatHistory prefix (not the user-editable system prompt) and load extraction-specific SK plugins.

Scenario: Initial extraction request

  • WHEN the client sends a POST to /api/chat/extract with email HTML and no follow-up messages
  • THEN the API assembles the few-shot ChatHistory, appends the email as the final user message, and streams the extraction response via SSE

Scenario: Follow-up disambiguation request

  • WHEN the client sends a POST to /api/chat/extract with email HTML and follow-up messages (e.g., user selecting a counterparty)
  • THEN the API assembles the few-shot ChatHistory, appends the email, appends all follow-up messages, and streams the continuation response via SSE

Scenario: SSE streaming contract

  • WHEN the extraction endpoint streams a response
  • THEN it uses the same SSE format as /api/chat: data: {"text":"..."}\n\n for deltas and data: [DONE]\n\n for completion

Requirement: ExtractionRequest DTO

The system SHALL define an ExtractionRequest class with EmailHtml (string, required) and Messages (List, optional) for follow-up conversation context.

Scenario: First request has email only

  • WHEN the user uploads an email for the first time
  • THEN the ExtractionRequest contains EmailHtml with the email content and an empty Messages list

Scenario: Follow-up request includes conversation

  • WHEN the user replies to a disambiguation question
  • THEN the ExtractionRequest contains the original EmailHtml plus Messages with the full assistant/user exchange since the extraction started

Requirement: Extraction endpoint uses extraction tools only

The extraction endpoint SHALL import only the extraction-specific SK plugins (counterparty lookup, trade validation, currency validation, schema validation). General chat tools (if any) SHALL NOT be loaded for extraction requests.

Scenario: Tool isolation

  • WHEN the extraction endpoint processes a request
  • THEN only extraction-related KernelFunctions are available to the LLM