Skip to content

About

An Agent Skill for Visual Studio Code enabling RAG using PDFs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VSCode PDF RAG Skill

A GitHub Copilot Agent Skill for using Retrieval-Augmented Generation (RAG) to increase accuracy of AI responses based on information from manuals, datasheets, etc.
Uses a locally stored vector store based on hashlib to store the embeddings, and provides a cli tool for generating embeddings from PDF files using Ollama.

Installation

1. Prerequisites

Install Ollama.
Install Python dependencies

pip install requests PyPDF2 pycryptodome

Install Ollama model (default is nomic-embed-text)

ollama pull nomic-embed-text

2. Add as Submodule to Your Repo

cd your-repo

git submodule add https://github.com/Gherkin/vscode-pdf-rag-skill.git .github/skills/pdf-rag-knowledge
git submodule update --init --recursive

3. Enable in VS Code Insiders

Add to your repo's .vscode/settings.json (or set it globally):

{
  "chat.useAgentSkills": true
}

Usage

4. Adding PDFs

cd .github/skills/pdf-rag-knowledge
python3 rag_search.py --index /path/to/your/datasheets/*.pdf

Direct Search (Command Line)

cd .github/skills/pdf-rag-knowledge

# Search
./search_rag.sh "GPIO pins"
python3 rag_search.py --search "power consumption"

# Check status
python3 rag_search.py --stats

# Index PDFs
python3 rag_search.py --index /path/to/pdfs/*.pdf

# Clear database
python3 rag_search.py --clear

With GitHub Copilot

Just ask natural questions in Copilot Chat. The skill activates automatically when you ask about:

  • Hardware specifications
  • Pin configurations
  • Register details
  • Timing diagrams
  • Power requirements
  • Communication protocols
  • Any technical info from datasheets

How It Works

  1. Indexing: PDFs chunked into 2000-char segments with 400-char overlap
  2. Embeddings: Generated via Ollama (local, free, private)
  3. Search: Semantic similarity using cosine distance
  4. Integration: Auto-loads when Copilot detects relevant questions

Configuration

Optional environment variables used (the default can be changed in the python script):

export OLLAMA_BASE_URL=http://localhost:11434
export OLLAMA_MODEL=mxbai-embed-large
export CHUNK_SIZE=2000
export CHUNK_OVERLAP=400

Troubleshooting

# Check status
python3 rag_search.py --stats

# Test search
./search_rag.sh "test query"

# Verify Ollama
curl http://localhost:11434/api/tags

See SKILL.md for detailed documentation.

About

An Agent Skill for Visual Studio Code enabling RAG using PDFs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages