What inspired me

I built AgriAfrica AI because I wanted to solve a real problem that I believe can have a direct impact on farmers across Africa: access to reliable agricultural information.

Farmers often need quick answers about crops, diseases, irrigation, and agricultural practices, but access to reliable information is not always easy, especially when internet connectivity is limited. I wanted to build an AI assistant that could work locally, without depending on cloud APIs or a constant internet connection.

That led me to the idea of AgriAfrica AI — an offline agricultural AI assistant that retrieves information from trusted agricultural sources and uses a local language model to generate grounded answers.

What I learned

This project taught me much more than just how to build an AI application.

I learned how to build a complete RAG (Retrieval-Augmented Generation) pipeline, starting from collecting and processing agricultural documents, extracting and chunking their content, generating embeddings, building a FAISS vector database, retrieving relevant information, and finally passing that information to a local LLM.

I also learned how important model selection and optimization are when working with limited hardware. I tested different configurations and evaluated the model based on speed, RAM usage, latency, and answer quality. This helped me understand that building an AI system is not only about choosing the biggest model, but about finding the right balance between quality and available resources.

Another important lesson was that groundedness matters. I designed the system so that the model should rely on retrieved agricultural sources instead of simply generating an answer from its own knowledge.

How I built it

I built AgriAfrica AI as a completely local system.

The knowledge base was created from agricultural resources, including FAO material. I processed the documents, split them into meaningful chunks, generated multilingual embeddings, and stored them in a FAISS vector database.

When a user asks a question, the system:

  1. Converts the question into an embedding.
  2. Searches the FAISS database for the most relevant agricultural information.
  3. Retrieves the best matching sources.
  4. Sends the retrieved information together with the question to a local Qwen2.5-3B-Instruct model running through llama.cpp.
  5. Generates a concise answer in the same language as the user's question.

I also built a Streamlit interface that allows the user to ask questions, see the retrieved sources, and view performance statistics such as retrieval time, generation time, total response time, and generation speed.

Challenges I faced

The biggest challenge was running the entire system locally on limited hardware.

Running a 3B language model together with the embedding model, FAISS, and the Streamlit application required careful management of memory and performance. I had to test different configurations and optimize the system so that it could actually run on a normal CPU-based machine.

I also faced challenges with packaging and deployment. I wanted the project to be easy for someone else to run without having to manually configure every component, so I worked on creating a simple launcher and including the required local inference components.

Another challenge was making the AI reliable rather than simply impressive. I spent time evaluating the answers against a dataset and manually reviewing responses to understand where the system was performing well and where it needed improvement.

What I achieved

Despite working with limited hardware and resources, I was able to build a complete offline agricultural AI prototype from the ground up.

AgriAfrica AI combines a multilingual agricultural knowledge base, semantic search, FAISS retrieval, a local Qwen2.5-3B model, and a user-friendly interface into one system.

For me, the most important achievement is that the project is not just an idea or a prototype connected to an external AI API. It is a working local AI system that I designed, implemented, tested, and optimized myself.

This project also showed me that meaningful AI solutions do not always require expensive infrastructure. With the right architecture and careful optimization, it is possible to build useful AI systems that can run locally and potentially reach users in environments where cloud connectivity is limited.

Built With

  • faiss
  • llama.cpp/qwen2.5-3b
  • python
  • sentencetransformers
  • streamlit
Share this project:

Updates