Skip to main content

A CLI tool to convert various file formats to Markdown using AI

Project description

Any-to-MD CLI

A command-line tool that uses AI (via litellm) to convert various file contents into Markdown format.

Features

  • Converts content from a specified input file.
  • Outputs well-formatted Markdown to a specified output file.
  • Leverages Large Language Models (LLMs) through litellm for versatile conversion.
  • Supports various LLM providers and models configurable via litellm.
  • Allows custom prompt templates for tailored conversions.

Installation

  1. Clone the repository (if developing):

    git clone <repository-url>
    cd any-to-md-cli-project # Or your chosen project directory name
    
  2. Install the package: For local development (ensure you have a virtual environment activated):

    pip install -e .
    

    Once published to PyPI, you'll be able to install it via:

    pip install any-to-md-cli
    

API Key Configuration

This tool relies on litellm, which requires API keys for the chosen LLM provider (e.g., OpenAI, Anthropic, Cohere, etc.).

You MUST set the appropriate environment variable for the LLM provider you intend to use. For example:

  • For OpenAI models (like gpt-3.5-turbo, gpt-4): export OPENAI_API_KEY="your_openai_api_key"
  • For Anthropic models (like claude): export ANTHROPIC_API_KEY="your_anthropic_api_key"

Refer to the LiteLLM documentation for a comprehensive list of supported providers and their required environment variables. You can also pass the API key directly using the --api-key option.

Usage

any-to-md-cli --input path/to/your/input.file --output path/to/your/output.md

Options:

  • -i, --input FILE_PATH: Path to the input file (Required).
  • -o, --output FILE_PATH: Path to the output Markdown file (Required).
  • -m, --model MODEL_NAME: Specify the LLM model to use (e.g., gpt-4o, claude-3-opus-20240229). Defaults to gpt-3.5-turbo.
  • -p, --prompt PROMPT_TEMPLATE: Custom prompt template. Must include {content} placeholder.
  • --api-key YOUR_API_KEY: Directly provide the API key for the LLM.
  • --base-url YOUR_BASE_URL: Specify a custom base URL for API calls.
  • --version: Show the version and exit.
  • --help: Show this message and exit.

Example with default prompt:

any-to-md-cli -i notes.txt -o notes.md -m gpt-4o

Example with custom prompt:

any-to-md-cli -i code.py -o code_explanation.md -m gpt-4o -p "Explain the following Python code and provide usage examples in Markdown format."

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

any_to_md_cli-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

any_to_md_cli-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file any_to_md_cli-0.1.0.tar.gz.

File metadata

  • Download URL: any_to_md_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for any_to_md_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c0c49fd3db5767df372759d316e5b868585d340371c7773744291763e013f73
MD5 e443f93070151b09a20ff9ec398470f5
BLAKE2b-256 79237ef574784e004b8b28a0f988e772e3a27dfc32060459028e296c2e17bcc0

See more details on using hashes here.

File details

Details for the file any_to_md_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: any_to_md_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for any_to_md_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e8abff80e917d5ce4c05864cc72c210b1f2b1a03c327f0995992cf60d1b8fdba
MD5 cff444b12ddf52004825b394ba523b84
BLAKE2b-256 797063225f01caf7cfc315304f89a76ca371829d78a23b3e14bba85d51a638d9

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