c7e2183e3eaa89c57e00d50a55110732e77514f7
Tavily Compare
This Node.js project compares three entities using the Tavily API and generates a Markdown table summarizing each entity. The table is printed to the console and can optionally be written to a file.
Prerequisites
- Node.js v18 or newer (for native ES modules support)
- A Tavily API key
Setup
-
Clone the repository (or copy the files into a new directory):
git clone https://github.com/your-username/tavily-compare.git cd tavily-compare -
Install dependencies:
npm install -
Create a
.envfile in the project root and add your Tavily API key:TAVILY_API_KEY=your_api_key_here
Usage
Run the script with three entity names:
node src/index.js "Entity One" "Entity Two" "Entity Three"
The script will output a Markdown table to the console.
Writing to a file
To also write the table to a file, use the --output (or -o) flag:
node src/index.js "Entity One" "Entity Two" "Entity Three" --output comparison.md
The file comparison.md will contain the same table.
Project Structure
src/index.js– Entry point; orchestrates argument parsing, API calls, and output.src/compare.js– Handles API requests to Tavily and returns summaries.src/markdown.js– Builds the Markdown table string.package.json– Project metadata and dependencies.README.md– Documentation.
License
MIT License
Description
Languages
JavaScript
50.2%
Python
46.2%
CSS
2.8%
HTML
0.8%