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

  1. Clone the repository (or copy the files into a new directory):

    git clone https://github.com/your-username/tavily-compare.git
    cd tavily-compare
    
  2. Install dependencies:

    npm install
    
  3. Create a .env file 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

S
Description
BroJS: Повторный экзамен #2: Сравнительный обзор 3 сущностей (Tavily)
Readme 98 KiB
Languages
JavaScript 50.2%
Python 46.2%
CSS 2.8%
HTML 0.8%