# Tavily Comparative Review Utility This project provides a simple Node.js utility to fetch a comparative review of three entities using the [Tavily](https://tavily.com) API. ## Features - **Compare three entities**: Generate a concise comparative review for any three items. - **Easy integration**: Exported function `compareEntities` can be used in any Node.js project. - **Environment‑based configuration**: API key is loaded from a `.env` file. - **Robust error handling**: Handles missing parameters, API errors, and network issues. ## Prerequisites - Node.js v18 or newer - A Tavily API key. Sign up at https://tavily.com to obtain one. ## Setup 1. **Clone the repository** ```bash git clone https://git.brojs.ru/kuzakhmetovartur/povtornyy-ekzamen-2-sravnitelnyy-obzor-3.git cd povtornyy-ekzamen-2-sravnitelnyy-obzor-3 ``` 2. **Install dependencies** ```bash npm install ``` 3. **Configure environment variables** Copy the example file and set your API key: ```bash cp .env.example .env # Edit .env and replace YOUR_TAVILY_API_KEY_HERE with your actual key ``` ## Usage ```js const { compareEntities } = require('./src/index'); (async () => { try { const result = await compareEntities('Apple', 'Samsung', 'Google'); console.log(JSON.stringify(result, null, 2)); } catch (err) { console.error('Error:', err.message); } })(); ``` Run the script: ```bash node src/index.js ``` ## Testing The project uses Jest for unit tests. ```bash npm test ``` ## Project Structure ``` ├── src │ └── index.js # Main utility ├── tests │ └── compare.test.js # Unit tests ├── .env.example # Environment variable template ├── .gitignore ├── package.json └── README.md ``` ## License MIT © Your Name --- Feel free to open issues or pull requests if you encounter any problems or have suggestions for improvement.