|
--- |
|
title: AI News Agent |
|
emoji: π |
|
colorFrom: blue |
|
colorTo: indigo |
|
sdk: docker |
|
pinned: false |
|
--- |
|
|
|
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference |
|
|
|
The AI News Agent is a Flask application deployed on Hugging Face Spaces via Docker. This application provides multiple endpoints that allow users to search, query, and analyze news articles based on various parameters such as keywords, tone, and policy changes. |
|
|
|
## Endpoints |
|
Base url: https://oxbridge-economics-AI-News-Agent.hf.space/ |
|
|
|
### `/search` |
|
|
|
**Purpose**: Search for articles based on category and title keywords. |
|
|
|
**Request Example**: |
|
```json |
|
POST /search |
|
Content-Type: application/json |
|
|
|
{ |
|
"titles": ["economy", "finance"], |
|
"categories": ["business", "technology"] |
|
} |
|
``` |
|
|
|
### `/query` |
|
|
|
**Purpose**: Retrieve detailed responses to queries about specific articles identified by article IDs. |
|
|
|
**Request Example**: |
|
```json |
|
POST /query |
|
Content-Type: application/json |
|
|
|
{ |
|
"ids": ["article1_id", "article2_id"], |
|
"query": "What is the impact of the new economic policy?" |
|
} |
|
``` |
|
|
|
### `/tone` |
|
|
|
**Purpose**: Compare the tone between two articles. |
|
|
|
**Request Example**: |
|
```json |
|
POST /tone |
|
Content-Type: application/json |
|
|
|
{ |
|
"source": "internal or external", |
|
"article1": "article1_id or article1 content", |
|
"article2": "article2_id or article2 content" |
|
} |
|
``` |
|
|
|
### `/compare` |
|
|
|
**Purpose**: Compare policy changes between two articles. |
|
|
|
**Request Example**: |
|
```json |
|
POST /tone |
|
Content-Type: application/json |
|
|
|
{ |
|
"source": "internal or external", |
|
"article1": "article1_id or article1 content", |
|
"article2": "article2_id or article2 content" |
|
} |
|
``` |
|
|
|
### `/keyword` |
|
|
|
**Purpose**: Count how many times a specific keyword appears in two different articles. |
|
|
|
**Request Example**: |
|
```json |
|
POST /tone |
|
Content-Type: application/json |
|
|
|
{ |
|
"source": "internal or external", |
|
"keyword": "keyword to search", |
|
"article1": "article1_id or article1 content", |
|
"article2": "article2_id or article2 content" |
|
} |
|
``` |
|
|
|
## Structure |
|
|
|
- **`/routes`**: Contains `main.py` which configures the routes for the Flask application. |
|
- **`/controllers`**: |
|
- `article_search_service.py`: Functions to search for articles in the database. |
|
- `article_query_service.py`: Functions to query an LLM for information about articles. |
|
- `article_comparison_service.py`: Functions to compare tone, policy, and count keywords in articles. |
|
|
|
## Deployment |
|
|
|
This application is deployed on [Hugging Face Spaces](https://huggingface.co/spaces/Oxbridge-Economics/AI-News-Agent?logs=container). The deployment process is managed through Docker, configured in the Dockerfile within this repository, and automated by GitHub Actions. |
|
|