Skip to content

An innovative News Feed Analyzer Agent which provides comprehensive summaries of the latest news from many News Outlets based on User Interests, leveraging open-source LLMs, ScrapeGraph AI, Spheron and tools like LangChain ️‍πŸ”₯

License

Notifications You must be signed in to change notification settings

apneduniya/varta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Varta πŸ—žοΈ

An innovative News Feed Analyzer Agent which provides comprehensive summaries of the latest news from many News Outlets based on User Interests, leveraging open-source LLMs, ScrapeGraph AI, Spheron and tools like LangChain ️‍πŸ”₯

πŸ“‹ Table of Contents

πŸŽ₯ DEMO

The Server and Ollama Llama3 was deployed on Spheron when this demo video was shot.

demo video

πŸ“™ Features

An News Feed Analyzer Agent that can:

  • πŸ—žοΈ Aggregate news from 14+ sources.
  • πŸ” Analyze content from 60+ interests choosed by user.
  • πŸ“ Concise and comprehensive summaries of the latest news.
  • πŸ“§ Email subscriptions with customizable frequency.
  • πŸ”– Bookmark news for later read.

🫳 Prerequisites

You should have

πŸ‘£ Steps to Run

Navigate to the Project Directory: Change to the directory where the project files are located. For example:

cd path/to/project/directory

1. Expo App

  1. Install dependencies

    bun install # or npm install
  2. Configure environment variables

    1. Copy .env.example to .env.
    2. Fill in the .env file with the necessary environment variables.
  3. Start the app

     bunx expo start # or npx expo start

In the output, you'll find options to open the app in a

This project uses file-based routing.


2. Server

  1. Change the directory

    cd server
  2. Create a virtual environment.

    python3 virtualenv venv
  3. Activate the virtual environment.

    source ./venv/bin/activate
  4. Install dependencies from requirements.txt

    pip install -r requirements.txt
  5. Configure environment variables

    1. Copy .env.example to .env.
    2. Fill in the .env file with the necessary environment variables.
  6. Start the server

     fastapi dev main.py --reload --port 8000 # or for production, fastapi run main.py --port 8000

Note

Ollama should be running locally before you start the server!

πŸš€ Deploy on Spheron

Here I will help you to deploy Server and Ollama on Spheron using Spheron Protocol CLI πŸ’ͺ

demo video

Prerequisites

You should have this before you start deploying on Spheron:

1. Install Spheron Protocol CLI (Linux, MacOS)

curl -sL1 https://sphnctl.sh | bash

After installation, verify the installation by using a simple command to check the Spheron version:

sphnctl version # or `sphnctl -h` for help

2. Creating a Wallet

sphnctl wallet create --name <your-wallet-name>

Replace <your-wallet-name> with your desired wallet name. Here is an example of how the result will look:

Created account xxx:
 path: /home/thatsmeadarsh/.spheron/<your-wallet-name>.json
 address: 0x3683Ae6bd8f23DEb35f79A750EA0a7e6fc858047
 secret: xxxxxxxxxx
 mnemonic: xxxxxx xxxxx xxxx xxxxx xxxxx xxxx xxxxx xxxxx

Make sure to securely save the mnemonic phrase and key secret provided.

3. Get Test Tokens from the Faucet

You will need some token to deploy on Spheron. Visit the Spheron Faucet to obtain test tokens for deployment. After receiving the tokens, you can check your wallet balance with:

sphnctl wallet balance --token USDT

Here is an example of how the result will look:

Current ETH balance: 0.09993387282 
Total USDT balance: 35 
 
Deposited USDT balance
 unlocked: 14.030481 
 locked: 4e-06 

Note: You might have unlocked or locked USDT balance as 0 but here I don't because I have previously deployed on Spheron. Don't worry, in next step I have covered that πŸ˜‹.

4. Deposit Tokens to Your Escrow Balance

Deposit USDT to your escrow wallet for deployment:

sphnctl payment deposit --amount 20 --token USDT

Now check your balance, if it's unlocked and sufficient (just like mine above):

sphnctl wallet balance --token USDT

5. Create your Deployment

I have already created a docker image for you so you can directly head towards to deployment without worrying πŸ˜‰. In the project directory, navigate to server/:

cd server

Open deploy.yml in a code editor and fill the environmental variables:

- MONGO_CONNECTION_URL=
- DATABASE_NAME=
- JWT_SECRET_KEY=
- JWT_REFRESH_SECRET_KEY=
- ACCESS_TOKEN_EXPIRE_MINUTES=
- REFRESH_TOKEN_EXPIRE_MINUTES=
- ALGORITHM=
- SMTP_SERVER=
- SMTP_PORT=
- SMTP_USERNAME=
- SMTP_PASSWORD=

And deploy the deploy.yml configuration file on Spheron:

sphnctl deployment create deploy.yml

Here is an example of how the result will look:

Validating SDL configuration.
SDL validated.
Sending configuration for provider matching.
Create deployment tx: [Tx Hash]
Waiting for providers to bid on the deployment order...
Bid found.
Order matched successfully.
Deployment created using wallet 0x3683Ae6bd8f23DEb35f79A750EA0a7e6fc858047
 lid: 389
 provider: 0x6634d41cccBD1E1576Ed4c6226832521A66bF874
 agreed price: 0.74
Sending the manifest for deployment…
Deployment manifest sent, waiting for acknowledgment.
Deployment is finished.

Note: The lid we get from the deployment is called Lease ID. This is the identifier you need to use to access your deployment's logs and status.

Now, Congratulations!! You have deployed the Server and Ollama on Spheron successfully πŸ₯³πŸ₯³.

6. Access Your Deployment

To get details about your deployment, including the URL, ports, and status, run:

sphnctl deployment get --lid <lease-id>

Replace the <lease-id> with your actual Lease ID, you obtained after deployment.

πŸ›οΈ Project structure

1. Expo App

β”œβ”€β”€ app/                        # Main application
β”‚   β”œβ”€β”€ email-subscription/     # Email subscription screen
β”‚   β”œβ”€β”€ interest/               # News Interest screen
β”‚   β”œβ”€β”€ news-outlet/            # News Outlet screen
β”‚   β”œβ”€β”€ login/                  # Login screen
β”‚   β”œβ”€β”€ register/               # Register screen
β”‚   β”œβ”€β”€ news/                   # News screen (dynamic)
β”‚   β”œβ”€β”€ (tabs)/                 # Screens those are on Navigation Tab
β”‚       β”œβ”€β”€ index.tsx           # Home screen
β”‚       β”œβ”€β”€ bookmark/           # Bookmark screen
β”‚       └── settings/           # Settings screen
β”œβ”€β”€ assets/                     # Assets like fonts and images
β”‚   β”œβ”€β”€ fonts/                  # Font files
β”‚   └── images/                 # Image and Icon files
β”œβ”€β”€ components/                 # Reusable components
β”‚   β”œβ”€β”€ auth/                   # Authentication components
β”‚   β”œβ”€β”€ button/                 # Button components
β”‚   β”œβ”€β”€ common/                 # Common components
β”‚   β”œβ”€β”€ form/                   # Form-related components
β”‚   └── sections/               # Section components
β”œβ”€β”€ constants/                  # Constant values
β”œβ”€β”€ hooks/                      # Custom hooks
β”œβ”€β”€ server/                     # SERVER (BACKEND)
β”œβ”€β”€ service/                    # Services for API calls
β”‚   β”œβ”€β”€ auth/                   # Authentication services
β”‚   β”œβ”€β”€ email-subscription/     # Email subscription services
β”‚   └── news/                   # News services
β”œβ”€β”€ utils/                      # Utility functions
β”œβ”€β”€ .env.example                # Example environment variables
└── .gitignore                  # Git ignore rules

2. Server

β”œβ”€β”€ app/                        # Main application folder
β”‚   β”œβ”€β”€ auth/                   # Authentication module
β”‚   β”œβ”€β”€ news/                   # News module
β”‚   β”œβ”€β”€ subscription/           # Subscription module
β”‚   └── users/                  # User management module
β”œβ”€β”€ data/                       # Data and templates folder
β”œβ”€β”€ database/                   # Database management module
β”œβ”€β”€ helpers/                    # Helper functions
β”œβ”€β”€ models/                     # Models for data validation, serialization, and type enforcement 
β”œβ”€β”€ service/                    # Service-related code
β”‚   β”œβ”€β”€ news/                   # News service
β”‚   └── subscription/           # Subscription service
β”œβ”€β”€ utils/                      # Utility functions
β”œβ”€β”€ main.py                     # Main application file
β”œβ”€β”€ deploy.yml                  # Spheron Deployment configuration
β”œβ”€β”€ Dockerfile                  # Docker configuration
β”œβ”€β”€ .dockerignore               # Docker ignore rules
β”œβ”€β”€ .env.example                # Example environment variables
β”œβ”€β”€ .gitignore                  # Git ignore rules
└── requirements.txt            # Python dependencies

πŸ€— Contributing

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature-name.
  3. Make your changes.
  4. Push your branch: git push origin feature-name.
  5. Create a pull request.

✍ Acknowledgments

This project couldn't be there if they didn't be there!

Even I had many issues while making this project and this was my first time to make a complete react native project with backend but spheron team helped me to over come the issues, gave me suggestions and I am really thankful to it β€οΈβ€πŸ©Ή!

🧾 License

This project is licensed under the MIT License.

About

An innovative News Feed Analyzer Agent which provides comprehensive summaries of the latest news from many News Outlets based on User Interests, leveraging open-source LLMs, ScrapeGraph AI, Spheron and tools like LangChain ️‍πŸ”₯

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published