This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This project is a Czech fact-checking research repository that runs on HPC clusters with SLURM job scheduling. The environment requires:
- Python 3.12.3 with specific ML libraries (see requirements.txt)
- CUDA 12.6.0 for GPU acceleration
- Ollama for local LLM inference
- LangChain framework for LLM orchestration
- Virtual environment at
/mnt/personal/ullriher/venvs/aug25/
# Activate virtual environment
source /mnt/personal/ullriher/venvs/aug25/bin/activate
# Install dependencies
pip install -r requirements.txt
# Set Python path for src modules
export PYTHONPATH=src:$PYTHONPATH# Submit Jupyter notebook job with GPU
sbatch script/_slurm_job.sh
# Submit job with Ollama server + Jupyter
sbatch script/_slurm_job_ollama.sh
# Submit job with Ollama + Open WebUI (web-based chat interface)
sbatch script/_slurm_job_openwebui.sh
# Get Jupyter notebook URL from logs
python script/jupyter_url.py
# Get Open WebUI and Ollama API URLs from logs
python script/openwebui_url.py# Install Ollama (custom installer for HPC)
bash script/ollama/install.sh
# Pull required models
ollama pull gpt-oss:20bnotebooks/- Jupyter notebooks for experiments and analysisclaimify.ipynb- Claimify claim extraction pipeline experimentshello.ipynb- Basic environment testing
src/- Source code modulesmodels/- Pydantic models for structured LLM outputsclaimify.py- Data models for claim extraction pipelinereasoning.py- Base model for reasoning-enabled LLM interactions
utils/- Utility moduleschat.py- LangChain chat factory and prompt managementclaimify.py- Complete Claimify pipeline implementation
prompts/claimify/- Structured prompts for claim extraction stages- Selection, disambiguation, decomposition, and other specialized prompts
script/- SLURM job scripts and utility scriptslogs/- Job output and Ollama server logsrequirements.txt- Python dependencies for ML/NLP tasks
- ML Framework: PyTorch with CUDA support, Transformers
- LLM Orchestration: LangChain ecosystem (langchain-core, langchain-community, langchain-openai, langchain-ollama, langchain-huggingface)
- NLP Libraries: spaCy, NLTK, sentence-transformers
- Data Processing: pandas, PyMuPDF (PDF processing), trafilatura (web scraping), dirtyjson
- Search/Retrieval: FAISS, rank-bm25
- LLM Integration: Ollama, OpenAI API, Hugging Face
- Czech Language Focus: Specialized for Czech text processing and fact-checking
- Claim Extraction: Claimify pipeline implementation (based on Microsoft Research methodology)
- Uses AMD GPU partitions (
amdgpu,amdgpufast) - 96GB memory per CPU, single GPU allocation
- Jobs run with custom SSL certificates for secure communication
- Ollama server runs on random high ports (20000-40000) to avoid conflicts
- Submit SLURM job to get compute resources with GPU
- Access Jupyter notebook via generated URL or use Open WebUI for web-based chat
- Use Ollama for local LLM inference alongside cloud APIs
- Experiment with Czech language models and fact-checking datasets
- Jupyter Notebooks: Traditional notebook environment for development and analysis
- Open WebUI: Modern web-based chat interface for interacting with Ollama models
- Direct API: Raw Ollama API access for programmatic usage
- LangChain Integration: Unified interface for multiple LLM providers (OpenAI, Ollama, Hugging Face)
- Structured Outputs: Pydantic models for reliable LLM response parsing
This repository includes a complete reproduction of the Claimify methodology for factual claim extraction, based on the implementation by Adam Gustavsson (https://github.com/AdamGustavsson/ClaimsMCP). Key features:
- Multi-stage Pipeline: Implements sentence splitting, selection, disambiguation, and decomposition stages
- Structured Outputs: Uses Pydantic models with LangChain for reliable claim extraction
- Research-Based: Follows the methodology from Microsoft Research's "Claimify" paper
- Czech Language Support: Adapted for Czech text processing and fact-checking
- Flexible LLM Backend: Supports both OpenAI and Ollama models
The project has been fully migrated to the LangChain ecosystem:
- Prompt Management: Structured prompts loaded from markdown files
- Structured Outputs: Pydantic models for reliable response parsing
- Provider Flexibility: Easy switching between OpenAI, Ollama, and Hugging Face models
Integration of reasoning-capable models through:
- ReasoningBaseModel: Pydantic base class that includes chain-of-thought reasoning fields
- Thinking Models: Support for models that provide explicit reasoning steps
- All development happens in Jupyter notebooks on HPC infrastructure
- The project focuses specifically on Czech language fact-checking
- Custom Ollama installation supports the HPC environment constraints
- Jobs automatically handle port conflicts and SSL certificate management
- Use
script/jupyter_url.pyto extract notebook URLs from SLURM logs - Use
script/openwebui_url.pyto extract Open WebUI and Ollama API URLs - LangChain replaces direct API calls for better maintainability and flexibility
- Docker containers provide isolated environments for Ollama and Open WebUI services