66 lines
1.6 KiB
Markdown
66 lines
1.6 KiB
Markdown
# Tavily Comparison Project
|
||
|
||
This project demonstrates how to integrate the **Tavily API** to compare three entities. It performs a search query and summarizes the top results using the official Tavily SDK.
|
||
|
||
## Prerequisites
|
||
|
||
- Node.js (v18 or newer)
|
||
- A Tavily API key. Sign up at https://tavily.com and obtain your key.
|
||
|
||
## Installation
|
||
|
||
```bash
|
||
# Clone the repository
|
||
git clone https://git.brojs.ru/kuzakhmetovartur/povtornyy-ekzamen-2-sravnitelnyy-obzor-3.git
|
||
cd povtornyy-ekzamen-2-sravnitelnyy-obzor-3
|
||
|
||
# Install dependencies
|
||
npm install
|
||
```
|
||
|
||
## Configuration
|
||
|
||
Create a `.env` file in the project root with your Tavily API key:
|
||
|
||
```env
|
||
TAVILY_API_KEY=your_api_key_here
|
||
```
|
||
|
||
## Usage
|
||
|
||
Run the application:
|
||
|
||
```bash
|
||
npm start
|
||
```
|
||
|
||
You should see output similar to:
|
||
|
||
```
|
||
[OtherService] Starting search for: Comparison of three entities
|
||
[OtherService] Results:
|
||
1. Title of first result
|
||
Summary of the first result.
|
||
|
||
2. Title of second result
|
||
Summary of the second result.
|
||
|
||
3. Title of third result
|
||
Summary of the third result.
|
||
```
|
||
|
||
## Project Structure
|
||
|
||
- `src/index.js` – Entry point that starts the application.
|
||
- `src/app.js` – Orchestrates the main flow.
|
||
- `src/services/tavily.js` – Wrapper around the Tavily SDK.
|
||
- `src/services/otherService.js` – Simple logging utility.
|
||
- `package.json` – Project metadata and dependencies.
|
||
|
||
## Notes
|
||
|
||
- The application uses the official `tavily-sdk` package.
|
||
- No additional external services are used beyond Tavily.
|
||
- The code is written in ES modules (`"type": "module"` in `package.json`).
|
||
|
||
Feel free to extend the project with more sophisticated logic or additional services as needed. |