Skip to content

Connected's python backend built with FastAPI, Cohere, Weaviate and Sqlite

Notifications You must be signed in to change notification settings

itcentralng/connected-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ConnectEd

ConnectEd is a platform that aims to address a significant knowledge gap by providing a centralized digital hub for various organizations to upload important updates and information. The platform would streamline the dissemination of crucial data to populations across wide geographic areas.

The SMS functionality would ensure even those in remote, rural localities without consistent internet access could still receive and interact with timely advisories on topics such as agriculture, education, finance, and more.

By partnering both information providers and citizens on one cohesive platform, ConnectED could virtually extend the reach of institutional messaging far beyond what traditional in-person community outreach allows.

Tools used

Cohere and Langchain: Our large language model through Langchain to give personalized responses

Weaviate: Our vector store for embeddings generated through cohere's embedding model through Weaviate's text2vec-cohere plugin.

FastAPI: Our web framework for building APIs in python

ReactJS: Our JavaScript frontend framework for the user dashboard.

Datasets

  1. The Pregnancy Book (St George’s University Hospitals NHS Foundation Trust) download | source

How to use Connected

  1. Create an account on AfricasTalking.
  2. Go to the simulator click here.
  3. Enter any number (can be any number its only active in the sandbox) and click connect.
  4. Send a question to our service short codes (3525 for the WHO example about pregnancy and baby care).

How to setup Connected locally on your computer

The Backend

  1. Create accounts in the following platforms: Cohere, Weaviate, AfricasTalking, Ngrok.
  2. Clone the backend repo git clone https://github.com/itcentralng/connected-cohere-hack.git
  3. Create a virtual environment python -m venv venv
  4. Activate the virtual environment. For Windows ./venv/Scripts/activate and Linux/Mac/Git bash source venv/Scripts/activate
  5. Install the project dependencies pip install -r requirements.txt
  6. Copy the contents of .env.example file into a new file .env (make sure you get your API keys from Cohere, Weaviate, AfricasTalking).
  7. Get your Weaviate cluster URL and put it as your WEAVIATE_URL value in the .env file
  8. Create an empty db/ directory that will house the database
  9. Run the project uvicorn main:app
  10. Follow the instruction on Ngrok to expose you local host (this is required to receive incoming SMS from AfricasTalking).
  11. Enter your Ngrok address here (make sure you add a /sms at the end of the address)

Note: AfricasTalking API key may take some time after creation before you can use it. Note: OpenAI and Cohere have a rate limit on their free plan, so uploading a file will result in an error.

The FrontEnd

  1. Clone the frontend repo git clone https://github.com/itcentralng/connected-frontend.git
  2. Install the project dependencies npm install
  3. Copy the contents of .env.example file into a new file .env and add in your APIs (backend's) URL
  4. Run it npm start
  5. Open another terminal and run npx convex dev
  6. Go to http://localhost:3000/

Note: To see the message sent from the frontend dashboard you need to use AfricasTalking simulator (Use one of the numbers from the insert_dummy_data() function, which can be found in the backend's utils/db.py file.)

Note: At the time of submission, the Africastalking API we are using is facing downtime and does not work due to the network outage caused by undersea cable.

About

Connected's python backend built with FastAPI, Cohere, Weaviate and Sqlite

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published