用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/vamseeachanta/workspace-hub --skill pdf-openai-codex-conversion命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Write outbound email and external messages in Vamsee Achanta's voice — a subtle offer to help, never bold or rash claims. Load before drafting ANY email, LinkedIn/Collide reply, proposal note, or outreach sent under his name.
Save/publish analysis or computation results from ANY ecosystem repo to Hugging Face as a queryable, viewer-renderable dataset. Use when the user wants to "save results to hugging face", "publish dataset to HF", "hugging face data saving", "save analysis results", "hf dataset", "make results queryable", or "render via datasets-server API". Reshapes nested results into flat parquet tables, writes a dataset card with a viewer `configs:` block and provenance, applies license/public-vs-private routing, enforces a domain data-quality gate (faithful-to-source != correct), publishes to `aceengineer/<repo>-<projection>`, and verifies via the datasets-server API.
Clone, create, fork, configure, and manage GitHub repositories. Manage remotes, secrets, releases, and workflows. Works with gh CLI or falls back to git + GitHub REST API via curl.
正在显示 SKILL.md
基于 SOC 职业分类
| name | pdf-openai-codex-conversion |
| description | Sub-skill of pdf: OpenAI Codex Conversion. |
| version | 1.2.2 |
| category | data |
| type | reference |
| scripts_exempt | true |
Prerequisites:
pip install openai pypdf
export OPENAI_API_KEY="your-api-key-here"
Basic Conversion:
import openai
from pypdf import PdfReader
from pathlib import Path
def pdf_to_markdown_codex(pdf_path, output_md_path=None, model="gpt-4.1"):
"""
Convert PDF to markdown using OpenAI Codex.
Args:
pdf_path: Path to PDF file
output_md_path: Optional path for output .md file (auto-generated if None)
model: OpenAI model to use (gpt-4.1, gpt-4.1-mini, etc.)
Returns:
Path to generated markdown file
"""
# Extract text from PDF
reader = PdfReader(pdf_path)
pdf_text = ""
for page_num, page in enumerate(reader.pages, 1):
text = page.extract_text()
pdf_text += f"\n\n--- Page {page_num} ---\n\n{text}"
# Generate markdown using OpenAI Codex
client = openai.OpenAI()
response = client.chat.completions.create(
model=model,
messages=[
{
"role": "system",
"content": """You are an expert document converter. Convert the provided PDF text
to well-structured markdown format. Preserve:
- Document structure (headings, sections)
- Lists and bullet points
- Tables (convert to markdown tables)
- Code blocks and technical content
- Links and references
Format the output as clean, readable markdown."""
},
{
"role": "user",
"content": f"Convert this PDF text to markdown:\n\n{pdf_text}"
}
],
temperature=0.3, # Lower temperature for more consistent formatting
)
markdown_content = response.choices[0].message.content
# Save to file
if output_md_path is None:
pdf_stem = Path(pdf_path).stem
output_md_path = Path(pdf_path).parent / f"{pdf_stem}.md"
# Ensure parent directory exists
Path(output_md_path).parent.mkdir(parents=True, exist_ok=True)
Path(output_md_path).write_text(markdown_content, encoding='utf-8')
return output_md_path
# Usage
md_file = pdf_to_markdown_codex("document.pdf")
print(f"Markdown saved to: {md_file}")
Batch Conversion:
from pathlib import Path
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def batch_pdf_to_markdown(pdf_directory, output_directory=None, model="gpt-4.1"):
"""
Convert all PDFs in a directory to markdown.
Args:
pdf_directory: Directory containing PDF files
output_directory: Optional output directory (defaults to pdf_directory/markdown)
model: OpenAI model to use
"""
pdf_dir = Path(pdf_directory)
if output_directory is None:
output_dir = pdf_dir / "markdown"
else:
output_dir = Path(output_directory)
output_dir.mkdir(parents=True, exist_ok=True)
pdf_files = list(pdf_dir.glob("*.pdf"))
total = len(pdf_files)
logger.info(f"Found {total} PDF files to convert")
for i, pdf_file in enumerate(pdf_files, 1):
try:
output_md = output_dir / f"{pdf_file.stem}.md"
logger.info(f"[{i}/{total}] Converting {pdf_file.name}...")
pdf_to_markdown_codex(pdf_file, output_md, model=model)
logger.info(f"✓ Saved to {output_md.name}")
except Exception as e:
logger.error(f"✗ Failed to convert {pdf_file.name}: {e}")
logger.info(f"\nConversion complete! Files in: {output_dir}")
batch_pdf_to_markdown(, model=)
Chunked Conversion for Large PDFs:
def pdf_to_markdown_chunked(pdf_path, output_md_path=None,
chunk_pages=10, model="gpt-4.1"):
"""
Convert large PDF by processing in chunks.
Args:
pdf_path: Path to PDF file
output_md_path: Optional output path
chunk_pages: Number of pages per chunk
model: OpenAI model to use
"""
reader = PdfReader(pdf_path)
total_pages = len(reader.pages)
markdown_sections = []
for start_page in range(0, total_pages, chunk_pages):
end_page = min(start_page + chunk_pages, total_pages)
# Extract chunk
chunk_text = ""
for page_num in range(start_page, end_page):
text = reader.pages[page_num].extract_text()
chunk_text += f"\n\n--- Page {page_num + 1} ---\n\n{text}"
# Convert chunk
client = openai.OpenAI()
response = client.chat.completions.create(
model=model,
messages=[
{
"role": "system",
"content": "Convert PDF text to markdown. Maintain structure and formatting."
},
{
"role": "user",
"content": f"Convert pages {start_page + 1}-{end_page} to markdown:\n\n{chunk_text}"
}
],
temperature=0.3,
)
markdown_sections.append(response.choices[0].message.content)
()
full_markdown = .join(markdown_sections)
output_md_path :
output_md_path = Path(pdf_path).with_suffix()
Path(output_md_path).parent.mkdir(parents=, exist_ok=)
Path(output_md_path).write_text(full_markdown, encoding=)
output_md_path
*Content truncated — see parent skill full reference.*