Giter Club home page Giter Club logo

news-gist's Introduction

Carbon News


Overview

The script first searches the custom google search engine and collects all urls given by the search engine. Articles are then extracted through their url by using newscat to get the text of the articles. We then push these text files to the agent. The agent creates their embeddings, and uses them when querying.

Requirements

  1. Python 3.9
  2. OpenAI API Key

Components

  1. Custom Google Search Engine (link)
  2. newscat (link)
  3. langchain agent (link)

Mounting EFS on EC2


  1. sudo yum install -y amazon-efs-utils
  2. sudo mount -t efs -o tls fs-0123456789:/ /path/to/mnt

Deploying to EC2 (Slack Bot)


  1. ssh into ec2

  2. scp app.py into ec2

  3. make sure you have golang installed

  4. install the required packages

    1. for the app: pip install langchain openai chromadb tiktoken google-api-python-client
    2. for deploying fastapi: pip install fastapi uvicorn pickle5 pydantic requests pypi-json pyngrok nest-asyncio python-multipart httpx
    3. you might encounter a problem with chromadb (see below)
  5. install newscat

    1. go install github.com/slyrz/newscat@latest
    2. add GOPATH to your PATH
    export GOPATH=$HOME/go
    export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
  6. run python app.py 1 1

    1. the 2 positional arguments determine if the script will search for articles and extract links respectively. set them to 0 or omit them if you want to skip those steps.
  7. to start a running process

    1. start a screen session with screen
    2. run python app.py
    3. press ctrl + a, followed by d to leave it in the background
  8. if you want to go back to a running session, do screen -r or alternatively, to check the session pid, ps aux | grep screen

    1. to kill, do kill -15 [pid]

Possible problems you might encounter

  • chromadb โ€” RuntimeError: Unsupported compiler -- at least C++11 support is needed!
    • you need g++, run the following commands and try again
    • sudo yum -y install gcc
    • sudo yum -y install gcc-c++
    • sudo yum install python3-devel

Systemd

[Unit]
Description=carbon news service

[Service]
User=ec2-user
WorkingDirectory=/home/ec2-user
ExecStart=/usr/bin/python3 app.py
Restart=always
RestartSec=1

[Install]
WantedBy=multi-user.target

news-gist's People

Contributors

dexterkwxn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.