We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Nisarg-123-web/MCP2'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
test_pdf_reader.pyβ’1.46 KiB
#!/usr/bin/env python3
"""Test PDF Reader functionality"""
import os
from pathlib import Path
def test_pdf_reader():
print("π TEST 3: PDF Reader Module")
try:
from data.multimodal.pdf_reader import extract_text_from_pdf, EnhancedPDFReader
# Find PDF files
pdf_dir = Path("data/multimodal/uploaded_pdfs")
pdf_files = list(pdf_dir.glob("*.pdf"))
print(f"PDF files found: {len(pdf_files)}")
if pdf_files:
# Test basic extraction
test_pdf = pdf_files[0]
result = extract_text_from_pdf(str(test_pdf), verbose=False)
success = len(result) > 0 and not result.startswith('β')
print(f"Text extraction: {'SUCCESS' if success else 'FAILED'}")
print(f"Text length: {len(result)}")
# Test enhanced reader
reader = EnhancedPDFReader()
print(f"Enhanced reader LLM: {reader.llm is not None}")
print(f"Enhanced reader Embeddings: {reader.embeddings is not None}")
print("β PDF Reader: PASS" if success else "β PDF Reader: FAIL")
return success
else:
print("No PDF files found for testing")
print("β PDF Reader: PASS (no files to test)")
return True
except Exception as e:
print(f"β PDF Reader: FAIL - {e}")
return False
if __name__ == "__main__":
test_pdf_reader()