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

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.1.tar.gz (5.1 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.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: any_to_md_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 5.1 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.1.tar.gz
Algorithm Hash digest
SHA256 3737f20f5d7670056f2608b112224759cb74f638c6b9e399838213eecfef17bf
MD5 7890d66bb5bb61811a80e9e791d79f09
BLAKE2b-256 7be546242ade5adf3410da6cc5fb229416aa565c57e52b39c87bdc5957c87d9f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: any_to_md_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 93304a409aa0aebf89e7d9b6f280092bff25453238c3415f95d7e11432d5415a
MD5 0d6753a795dcc53f92c4113f88cfb6fd
BLAKE2b-256 0325240275675d6597eca45118075cb429daf8ea07dbf1438248da654bfda27c

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