An experiment using Claude Code to accelerate research for a presentation on AI adoption in hedge funds. This project demonstrates how to build a two-stage knowledge extraction pipeline that transforms research documents into a queryable knowledge base using LangChain and Google Gemini.
This project explores two complementary approaches to research:
Traditional Approach: Tools like Google Gemini search on Google Drive folders and NotebookLM enable direct querying across research documents. For example, asking "What are important facts and figures about improving developer productivity using AI coding assistants?" across a collection of PDFs returns relevant insights quickly and effectively.
Enhanced Pipeline Approach: This project takes research a step further by:
- Converting documents (PDFs, HTML) to normalized text
- Applying structured prompts to extract key insights for AI strategy presentations
- Organizing extracted knowledge into a queryable database
- Using Claude Code skills to split and manage individual notes
The result is a curated knowledge base optimized for presentation preparation, where insights are pre-extracted, categorized, and ready for rapid retrieval.
-
Install dependencies:
pip install -r requirements.txt
-
Configure API key:
- Copy
.env.exampleto.env - Add your Google Gemini API key:
GOOGLE_API_KEY=your_actual_api_key_here
- Copy
-
Get a Gemini API key:
- Visit Google AI Studio
- Create a new API key
- Copy it to your
.envfile
Run the complete two-stage pipeline:
python extract_knowledge.pyThe pipeline operates in two stages:
Stage 1: Normalization
- Finds all PDF files in
pdf/directory - Finds all HTML files in
html/directory - Extracts and normalizes text from each file
- Saves plain text files to
txt/directory
Stage 2: Processing
- Reads all normalized text files from
txt/directory - Processes each through Gemini with the research prompt
- Saves structured markdown notes to
kb/directory
Each document generates a structured markdown file in the kb/ directory with:
- Key Findings - Major themes, conclusions, and trends
- Supporting Facts & Figures - Data points and statistics
- Key Quotes (with Attribution) - Direct quotes from sources
- Critical Capabilities - Dimensions firms must develop
- Best Practices - Do's and don'ts for AI adoption
- AI Roadmap - Adoption stages and milestones
- Success Metrics - KPIs and benchmarks
Notes are formatted as standalone index cards, suitable for importing into Notion, Obsidian, or a RAG system.
This project includes custom Claude Code skills for knowledge base management:
Splits a single knowledge base markdown file containing multiple notes into individual note files.
Usage:
/split-kb-noteProcesses all markdown files in the kb/ directory and splits each into individual notes in kb2/.
This might need some cleaning up.
Usage:
/split-all-kb-notesTo run a skill, you can just tell Claude Code, use skill X to do y. you can also ask 'what skills are available?' and say e.g.: Skill(split-all-kb-notes)
Skills in Claude Code are documented here
These skills enable granular organization of extracted knowledge, with each insight as a separate file for easier querying and management.
pdf/- Source PDF research documents (not tracked in git)html/- Source HTML documents (not tracked in git)txt/- Normalized text files (not tracked in git)kb/- Structured markdown notes per document (68 files)kb2/- Individual note files split from kb/ (1,843 files)notes.md- All notes concatenated into a single file with---separators
The research extraction prompt is defined in prompt.txt. It instructs the AI to extract insights organized into these categories:
- Key Findings — Major themes, conclusions, or trends
- Supporting Facts & Figures — Data points, statistics, or concrete evidence
- Key Quotes (with Attribution) — Relevant direct quotes from sources
- Critical Capabilities — What buy-side firms must improve or develop
- Decisions — Technology and workflow implementation choices
- Best Practices — Do's and don'ts
- AI Roadmap — Stages and milestones on the path to adoption
- Measuring Success — Criteria, KPIs or benchmarks for evaluating AI initiatives
The prompt produces standalone notes (1-3 sentences each) formatted as index cards with source attribution.
Edit extract_knowledge.py to modify:
GEMINI_MODEL: Change the model (currently using gemini-2.0-flash-exp)PDF_DIR,HTML_DIR,TXT_DIR,KB_DIR: Change directory locationsRESEARCH_PROMPT: Adjust the extraction prompt and categories (or referenceprompt.txt)- Temperature and token settings in
setup_langchain_pipeline()
- Cost Efficiency: Review normalized text before incurring LLM processing costs
- Reprocessing: Rerun Stage 2 with different prompts without re-extracting text
- Debugging: Easier to identify issues in extraction vs. processing
- Incremental Processing: Process subsets of files as needed
- Format Flexibility: Supports both PDF and HTML input formats
- High-Quality Extraction: Uses pymupdf for PDFs and trafilatura for HTML, both industry-standard tools
Source research documents are available in this Google Drive folder (68+ PDFs and HTML files on AI adoption, strategy, and implementation for financial services).
- 68 research documents processed
- 1,843 individual notes extracted and organized
- Consolidated knowledge base in
notes.md(532 KB) - Custom Claude Code skills for knowledge management
- Complete automation from source documents to queryable knowledge base
A custom GPT for AI Strategy Research has been created with:
- Raw article files from the research collection
- Summarized notes from
notes.md - Optimized for querying insights on AI adoption in financial services
This provides an interactive way to explore the research and get answers tailored to specific questions about AI strategy for hedge funds and asset managers.