Farmer Rank AI: Using Generative AI to Connect Farmers with the Right Buyers Shaik Inzamam, a B.Tech Computer Science student and aspiring AI engineer from India, built Farmer Rank AI, a generative AI-powered agricultural marketplace assistant that helps buyers find and connect with suitable farmers based on crop type, quantity, quality, price, and location. The project aims to make agricultural trading more accessible, transparent, and efficient for farmers and buyers in India by using natural language processing to understand buyer requests and rank farmers accordingly. Introduction Hello, I am Shaik Inzamam, a B.Tech Computer Science student and aspiring AI engineer from India. I enjoy building practical AI solutions using Generative AI, large language models, backend development, cloud technologies, and automation tools. I am especially interested in creating solutions that address real problems faced by local communities. For the Gen AI Academy APAC – Meet the Builders initiative, I am sharing my project: Farmer Rank AI Farmer Rank AI is a Generative AI-powered agricultural marketplace assistant that helps buyers find and connect with suitable farmers based on crop type, quantity, quality, price, and location. The goal of the project is to make agricultural trading more accessible, transparent, and efficient for farmers and buyers in India. The Local Problem Agriculture plays an important role in India, but many farmers still face challenges when trying to connect directly with genuine buyers. Farmers may have quality produce available, but they often lack visibility and access to the right market. Buyers also face difficulties identifying farmers who can meet their exact requirements. For example, a buyer may need: 500 kilograms of tomatoes Grade A quality A maximum price of ₹20 per kilogram A farmer located near Bengaluru Immediate availability Finding the right farmer manually can take a lot of time. Buyers may need to contact several farmers individually before finding a suitable match. At the same time, smaller farmers may be ignored because they do not have access to advanced digital platforms or strong marketing networks. Some of the major problems include: Difficulty connecting farmers directly with buyers Limited visibility for small and regional farmers Time-consuming manual search Lack of intelligent farmer ranking Incomplete information about crop quantity and quality Poor location-based matching Lack of transparency in recommendations Communication gaps between farmers and buyers The Idea Behind Farmer Rank AI Farmer Rank AI acts as an intelligent bridge between agricultural buyers and farmers. Instead of manually selecting multiple filters, a buyer can describe their requirement in normal language. For example: I need 500 kg of Grade A tomatoes near Bengaluru for under ₹20 per kg. The application understands the request, extracts the important information, searches available farmer listings, and recommends the most suitable farmers. The platform does not simply return a long list of results. It ranks farmers according to how closely they match the buyer’s needs. It also explains why each farmer was recommended. Example Buyer Request A buyer can enter: Find farmers who can supply 500 kg of Grade A tomatoes near Bengaluru for less than ₹20 per kilogram. The application extracts structured information such as: { "crop": "tomato", "quantity kg": 500, "quality grade": "A", "preferred location": "Bengaluru", "maximum price per kg": 20 } The system then searches the available farmer data and evaluates each farmer using multiple conditions. These conditions include: Crop availability Quantity available Quality grade Price per kilogram Location Distance from the buyer Farmer reliability Previous buyer preferences How Farmer Rank AI Works The application follows a structured AI workflow. Step 1: Buyer Enters a Requirement The buyer enters a crop requirement using natural language. The buyer does not need to understand technical filters or database fields. Example: I need 1,000 kg of onions near Hyderabad within ₹25 per kilogram. Step 2: Gemini Understands the Request Google Gemini processes the request and identifies important information such as: Crop name Required quantity Quality grade Location Maximum budget Buyer intent Step 3: Structured Filters Are Created The natural-language request is converted into structured search filters. This makes it easier for the backend to search available farmer listings. Step 4: Matching Farmers Are Retrieved The system searches farmer records based on the extracted requirements. Farmers who do not meet the basic conditions are removed. For example, a farmer may be excluded when: The crop does not match The available quantity is too low The price exceeds the buyer’s budget The farmer is too far from the preferred location The required quality grade is unavailable Step 5: Farmers Are Ranked The remaining farmers receive a ranking score. The ranking system considers: Crop match Quantity match Quality match Price match Location relevance Distance Farmer availability Buyer preferences Step 6: Gemini Generates Explanations Gemini generates a simple explanation for each recommendation. Example: This farmer is recommended because they have 600 kg of Grade A tomatoes available at ₹18 per kilogram and are located close to Bengaluru. Step 7: Buyer Reviews the Results The buyer receives a ranked list of farmers with: Farmer name Crop Available quantity Quality grade Price Location Matching score Recommendation reason Contact option Step 8: Buyer Connects With the Farmer After reviewing the results, the buyer can contact the selected farmer and continue the discussion. Google AI and Google Cloud Technologies Google technologies play an important role in the architecture of Farmer Rank AI. Google Gemini is the main Generative AI layer of the project. It is used to understand buyer requirements written in natural language. Gemini helps the application perform tasks such as: Detecting buyer intent Extracting crop names Extracting required quantities Understanding quality grades Identifying locations Extracting budget constraints Converting text into structured data Generating farmer recommendation explanations Summarizing matching results Supporting multilingual requests Producing easy-to-understand responses Gemini makes the application more natural because buyers can communicate with the system like they would communicate with another person. Vertex AI provides a managed platform for working with Gemini models on Google Cloud. Vertex AI can help Farmer Rank AI: Access Gemini securely Manage AI model requests Configure generation settings Handle production workloads Monitor AI usage Evaluate model responses Improve prompt quality Scale AI operations Vertex AI can also support future improvements such as prompt evaluation, model monitoring, and AI response testing. The backend of Farmer Rank AI can be deployed using Google Cloud Run. Cloud Run allows the application to run as a containerized service without manually managing servers. Cloud Run is useful because it provides: Automatic scaling Container-based deployment Secure API hosting Reduced infrastructure management Faster deployment Support for backend services Pay-per-use infrastructure When a buyer submits a query, the backend running on Cloud Run receives the request, communicates with Gemini, searches farmer data, and returns ranked recommendations. Google Cloud Firestore can store structured information used by the application. This includes: Farmer profiles Farmer names Crop listings Crop quantity Crop quality Price per kilogram Farmer location Contact information Buyer preferences Search history Recommendation history Crop availability status Firestore supports real-time updates, which can be useful when farmers update crop quantity, price, or availability. Google Cloud Storage can be used to store larger files that should not be saved directly in the database. Examples include: Crop images Farmer profile images Farmer verification documents Quality certificates Dataset files Generated reports Application screenshots Demo assets The database can store the file reference, while the actual file remains securely stored in Cloud Storage. Google Maps Platform can improve location-aware farmer recommendations. It can help the application: Convert addresses into coordinates Calculate distances Display farmer locations Identify nearby farmers Estimate travel distance Support regional searches Improve logistics planning For example, when a buyer requests tomatoes near Bengaluru, the system can prioritize farmers located closer to the buyer. Location information can become an important part of the ranking score. Farmer Rank AI uses several sensitive credentials, such as AI keys, database credentials, and service configuration. Google Cloud Secret Manager can securely store: Gemini credentials Database connection details Authentication secrets External API keys Application configuration values This prevents sensitive keys from being written directly into the project source code. Farmer Rank AI uses Docker for containerization. The backend Docker image can be stored in Google Artifact Registry before deployment. The deployment process can follow these steps: Build the application Create the Docker image Push the image to Artifact Registry Deploy the image to Cloud Run Make the backend API available to the frontend Artifact Registry provides a secure location for storing and managing container images. Google Cloud Build can automate the project build and deployment workflow. When new code is pushed, Cloud Build can: Install project dependencies Run build commands Build the Docker image Push the image to Artifact Registry Deploy the application to Cloud Run This makes deployment faster and reduces manual work. Cloud Logging can record important application events. Examples include: Buyer queries Gemini requests Gemini response errors Farmer search results Ranking workflow activity Database errors API failures Safety validation events Logging makes it easier to debug the application and understand how users interact with the system. Cloud Monitoring can track the health and performance of the application. It can monitor: Number of requests API response time Error rate Cloud Run performance Resource usage Service availability Failed AI requests Monitoring is important for maintaining a reliable production application. Firebase Authentication can be used to manage secure user access. It can support: Farmer registration Buyer registration Email login Google login User authentication Role-based access Secure sessions Farmers and buyers can have separate profiles and different application permissions. The frontend application can be hosted using Firebase Hosting. Firebase Hosting can provide: Fast web hosting HTTPS support Global content delivery Easy deployment Integration with Firebase services The Next.js frontend can communicate with the backend deployed on Cloud Run. Google-Powered Workflow The complete Google-powered application workflow can operate as follows: A buyer opens the web application hosted using Firebase Hosting. The buyer signs in through Firebase Authentication. The buyer enters an agricultural requirement in natural language. The frontend sends the query to the backend deployed on Cloud Run. The backend sends the buyer query to Gemini through Vertex AI. Gemini identifies the buyer’s intent and converts the request into structured filters. Farmer listings are retrieved from Firestore. Google Maps Platform calculates location relevance and distance. The ranking workflow evaluates crop, quantity, grade, price, and proximity. Gemini generates a clear explanation for every recommendation. Crop images and farmer documents are retrieved from Cloud Storage when required. Ranked farmer results are returned to the buyer. Cloud Logging records important workflow events. Cloud Monitoring tracks service performance. Secret Manager protects sensitive credentials. Cloud Build and Artifact Registry support deployment updates. System Architecture Farmer Rank AI uses a modular architecture so that each component has a clear responsibility. Buyer | v Next.js Web Application | v Firebase Authentication | v Backend API on Google Cloud Run | +--------------------------+ | | v v Gemini through Vertex AI Firestore | | v v Intent Extraction Farmer Records | | +-------------+------------+ | v Google Maps Platform | v Farmer Ranking Engine | v Gemini Explanation Generator | v Ranked Farmer Results Other Google Cloud services support the application: Cloud Storage - Crop images and documents Secret Manager - API keys and credentials Artifact Registry - Docker images Cloud Build - Automated deployment Cloud Logging - Application logs Cloud Monitoring - Performance monitoring Complete Technology Stack Google AI and Cloud Stack Google Gemini API Vertex AI Google Cloud Run Google Cloud Firestore Google Cloud Storage Google Maps Platform Google Cloud Secret Manager Google Artifact Registry Google Cloud Build Google Cloud Logging Google Cloud Monitoring Firebase Authentication Firebase Hosting Application Development Stack Next.js Node.js TypeScript Express.js Mastra Docker Git GitHub Data and Retrieval Stack PostgreSQL Qdrant Vector-based retrieval Structured farmer filtering AI-powered ranking workflow