# Tavily Compare A lightweight Node.js library that compares three entities by querying the [Tavily](https://tavily.com) API. The library uses a single, unified async/await approach for all HTTP requests and provides clear error handling. ## Installation ```bash npm install tavily-compare ``` ## Usage ```js import { compare } from 'tavily-compare'; // Set your Tavily API key in the environment process.env.TAVILY_API_KEY = 'YOUR_TAVILY_API_KEY'; (async () => { try { const results = await compare('entity1', 'entity2', 'entity3'); console.log(results); // { // entity1: { ...tavily response... }, // entity2: { ...tavily response... }, // entity3: { ...tavily response... } // } } catch (err) { console.error(err.message); } })(); ``` ## API ### `compare(entity1, entity2, entity3)` - **Parameters** - `entity1` – *string* – First entity to compare. - `entity2` – *string* – Second entity to compare. - `entity3` – *string* – Third entity to compare. - **Returns** – *Promise\* – An object mapping each entity to its Tavily API response. - **Throws** – *Error* – If any API call fails or if arguments are missing. ## Testing Run the test suite with: ```bash npm test ``` The tests mock the Tavily API to ensure no real HTTP requests are made. ## License MIT © Your Name