Repository navigation
Implement 2-pass summarization with JSON extraction and formatting - #14
Merged
Merged
Conversation
情報抽出(JSON)→フォーマット整形の2段階でLLM出力の安定性を向上。 性能の低いモデルでも一貫したレイアウトの要約結果を得られる。 - パス1: 文書タイプ別JSONスキーマで構造化情報を抽出 - パス2: 低temperature(0.3)で固定テンプレートに沿って整形 - JSON解析失敗時は1パスフォールバック - 設定UIで2パス/1パスの切替が可能(デフォルトON) - トピックス抽出でセグメント別業績・受注増減等の詳細情報を重視 https://claude.ai/code/session_01KrEGwXcD4TS32dd9LvEA67
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement a 2-pass summarization pipeline for TDnet disclosure documents that separates information extraction (pass 1) from output formatting (pass 2). This improves output quality and consistency by using specialized prompts and lower temperature settings for formatting.
Key Changes
New Files
src/lib/summary-schema.ts: Defines TypeScript interfaces and JSON schema strings for each document type (earnings, earnings revision, dividend, M&A, share repurchase, other). Includes document-type-specific extraction rules and rating criteria for earnings reports.src/lib/format-prompts.ts: Provides pass 2 (formatting) prompts that convert extracted JSON data into structured text output using document-type-specific templates.Modified Files
src/background/index.ts:twoPassModesetting (defaults to true)summarizeTwoPass()function that executes pass 1 (extraction) and pass 2 (formatting) sequentiallysummarizeOnePass()function for backward compatibilitytryParseJson()helper to robustly extract JSON from LLM responses with fallback handlingsrc/lib/prompts.ts:getExtractionPrompt()function for pass 1 (information extraction)summary-schema.tssrc/lib/llm-client.ts:temperatureparameter toLLMConfiginterface for fine-grained control over generation behaviorsrc/options/Options.tsx:twoPassModesetting to Chrome storageImplementation Details
https://claude.ai/code/session_01KrEGwXcD4TS32dd9LvEA67