Logo Lanfrica
  • Home
  • Atlas
  • Insights
  • Docs
  • Sign in

© 2026 Lanfrica. All rights reserved. All copyrights of the resources shown on the Lanfrica website belong to the original copyright holders, unless explicitly stated otherwise.

LNshuti/national-bank-of-Rwanda

Domain:

socioeconomic

Record type:

software
Creator:
LNs
Host:
Applied AI Embeddings with Python using National Economic Reports # National Bank of Rwanda Applied AI Embeddings with Python using National Economic Reports ## Tools Used * Python * Openai * Pinecone * Langchain ## Clone this repo to your machine ```bash git clone github.com cd national-bank-of-Rwanda/ ``` ## Install requirements ### Conda ```bash conda env create --file=environment.yaml conda env config vars set OPENAI_API_KEY=YOUR_API_KEY ``` ## Import libraries ```python import os import faiss from langchain.document_loaders import UnstructuredPDFLoader from langchain.embeddings.openai import OpenAIEmbeddings from langchain import OpenAI, ConversationChain import time # Load OpenAI API key from environment openai_api_key = os.environ.get('OPENAI_API_KEY') ``` ## Load API Keys ```python import os # Load openai api key openai_api_key = os.environ.get('OPENAI_API_KEY') # Load Pinecone API key pinecone_api_key = os.environ.get('PINECONE_API_KEY') # Load pinecode api env pinecone_api_env = os.environ.get('PINECONE_API_ENV') ``` # Load PDF document ```{python} pdf_loader = UnstructuredPDFLoader("data/Annual_Report_2021_22_Web_English_Versio.pdf") pdf_text = pdf_loader.load() ``` # Initialize embeddings and language model ```{python} embeddings = OpenAIEmbeddings(openai_api_key=openai_api_key) llm = OpenAI(temperature=0.5, openai_api_key=openai_api_key) conversation = ConversationChain(llm=llm, verbose=True) ``` ```{r} # Get embeddings for PDF document start_time = time.time() pdf_emb = embeddings.embed(pdf_text) end_time = time.time() print(f"Embedding generation time: {end_time - start_time} seconds") # Build Faiss index with HNSW algorithm index = faiss.IndexHNSWFlat(pdf_emb.shape[1], 32) # Add PDF embeddings to index index.add(pdf_emb) # Train the index index.train(pdf_emb) ``` # Search the index for some questions ```{python} questions = [ "What are the key challenges that Rwanda faces this year?", "Summarize key metrics for Rwanda including the amount of reser …

Visit

github.com

Tags

aipythonsemantic-search

Licenses

MIT

Similar

LNshuti/eactradeLNshuti/food-securityLNshuti/pop-density-mapsLNshuti/environmental-impact-drivingPlace of Kinyarwanda Language in Banks in Rwanda: A Case of Equity Bank RwandaFruit-feeding butterflies of Nyungwe National Park, Rwanda

LNshuti/eactrade

Explore historical trade for the East African Community: A Network Analysis Study ## Analyzing Inte

LNshuti/food-security

Explore African food production and trade. Where does our food come from? How can we grow more of it

LNshuti/pop-density-maps

PopDensity Africa: Explore Interactive Maps! # Population Density Maps This Gradio Python applicati

LNshuti/environmental-impact-driving

The goal of this repository is to attempt to answer the following questions: What is the estimated m

Place of Kinyarwanda Language in Banks in Rwanda: A Case of Equity Bank Rwanda

Fruit-feeding butterflies of Nyungwe National Park, Rwanda

A study was conducted in Nyungwe National Park, Rwanda from October 2019 to August 2020. The study