Skip to main content

transform arXiv papers into a single latex prompt for LLMs

Project description

arxiv-to-prompt

PyPI version Tests License Changelog

A command-line tool to transform arXiv papers into a single LaTeX source that can be used as a prompt for asking LLMs questions about the paper. It downloads the source files, automatically finds the main tex file containing \documentclass, and flattens multiple files into a single coherent source by resolving \input and \include commands. The tool also provides an option to remove LaTeX comments from the output (which can be useful to shorten the prompt).

Installation

pip install arxiv-to-prompt

Usage

Basic usage:

# Display LaTeX source with comments
arxiv-to-prompt 2303.08774

# Display LaTeX source without comments
arxiv-to-prompt 2303.08774 --no-comments

# Copy to clipboard
arxiv-to-prompt 2303.08774 | pbcopy

# Combine with the `llm` library from https://github.com/simonw/llm to chat about the paper
arxiv-to-prompt 1706.03762 | llm -s "explain this paper"

The arXiv ID can be found in the paper's URL. For example, for https://arxiv.org/abs/2303.08774, the ID is 2303.08774. It will automatically download the latest version of the paper, so you don't need to specify the version.

Python API

You can also use arxiv-to-prompt in your Python code:

from arxiv_to_prompt import process_latex_source

# Get LaTeX source with comments
latex_source = process_latex_source("2303.08774")

# Get LaTeX source without comments
latex_source = process_latex_source("2303.08774", keep_comments=False)

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arxiv_to_prompt-0.1.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arxiv_to_prompt-0.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file arxiv_to_prompt-0.1.1.tar.gz.

File metadata

  • Download URL: arxiv_to_prompt-0.1.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for arxiv_to_prompt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aea48b441be75aeba580ce336cda28e01493cb729b6673cc01ca49d85faf4115
MD5 c351b091748561034f3a6317627aa10f
BLAKE2b-256 7055e1083572aa3d0d278f702e9b4e95cc770fce5a032cf7732f88e490fcfd93

See more details on using hashes here.

File details

Details for the file arxiv_to_prompt-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for arxiv_to_prompt-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3e627dbe9007982690713eea3ac010d1a1130c924c52a46f693cdcb4106eb0f
MD5 807ea7b60faf044ca065e082f642cb7f
BLAKE2b-256 3531dd4f04450cf24793fc12ef10ae0c3409daa84bcabf54064de153035f5864

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page