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
litellmfor versatile conversion. - Supports various LLM providers and models configurable via
litellm. - Allows custom prompt templates for tailored conversions.
Installation
-
Clone the repository (if developing):
git clone <repository-url> cd any-to-md-cli-project # Or your chosen project directory name
-
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 togpt-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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c0c49fd3db5767df372759d316e5b868585d340371c7773744291763e013f73
|
|
| MD5 |
e443f93070151b09a20ff9ec398470f5
|
|
| BLAKE2b-256 |
79237ef574784e004b8b28a0f988e772e3a27dfc32060459028e296c2e17bcc0
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8abff80e917d5ce4c05864cc72c210b1f2b1a03c327f0995992cf60d1b8fdba
|
|
| MD5 |
cff444b12ddf52004825b394ba523b84
|
|
| BLAKE2b-256 |
797063225f01caf7cfc315304f89a76ca371829d78a23b3e14bba85d51a638d9
|