Inspiration

Agriculture is one of the under looked economies and I wanted to solve one of the problems faced in it using technology which is pesticide selection.

Not only the pest influences the pesticide selection but also but also environmental conditions like temperature and rainfall, crop characteristics such as growth stage and tolerance, and safety considerations including human health risks and environmental impact etc play crucial roles in choosing the right pesticide.

With the above parameters said, there are about 57,588 active pesticides registered with EPA and there are about 8894 pests listed in the Environmental Protection Agency (EPA) database. [1]

Working in an Ag company, I found that there are over 400 different commodities grown in the US and about 20-40% of crop production globally is lost to pests annually. And the presence of weeds hurt the crop yield. Pests alone cost global economy around $300 billion dollars. [2]

It is an extremely difficult for a human solve this problem efficiently at scale whereas LLMs can.

What it does

Kronia App uses the pesticide label data and gives you information about pests and recommendation about Pesticide products in terms of its chemistry, application, storage and safety.

It is smart to pull the weather information based on question and refine the answer related to application and storage based on weather.

Kronia is also multimodal when you upload an image of crop damage. It crafts the response to the crop and the pest damage.

How we built it

Data Pipeline

For the data, we leveraged EPA database for Pesticide labels. To ensure diverse content, we selected a mix of products (herbicides, insecticides, fungicides, etc.). We developed a python script that ingests data into snowflake table and PDFs into Snowflake Internal Stage. This script supports both test and production environments, utilizing GitHub Actions, AWS ECS, ECR, and EC2 pipelines. It processes data incrementally, chunks PDFs, updates the vector database, and creates a Cortex Search service.

App Logic

We used Streamlit for front end chat interface.

We routed the user question to Cortex Complete function with Mistral-Large2 model to determine if weather context is needed. The same function was also used to generate parameters for the OpenWeather API, which retrieved relevant weather data.

To make the app multimodal, we enabled users to upload image and creating context with GPT4o model.

For document data, we utilized Cortex Search to retrieve relevant chunks of information , which were incorporated into the context.

Finally, by assembling weather context, image context, chat history, relevant chunks, and the user query, the Cortex Complete function with Mistral-Large2 generated responses tailored to user questions.

Challenges we ran into

  • Longer run time of ingestion code due to ingestion happening serially
  • Configuring ECS with service and task definitions utilizing free-tier for deployment to higher environments

Accomplishments that we're proud of

  • Even though I have a strong background in Snowflake and dbt as an Analyst, this was the first time I worked end-to-end on Snowflake, taking on multiple roles as an admin, data engineer, and app developer.
  • Being able to contribute to the farming economy using modern technology tools.

What we learned

  • Managing Application Lifecycle using GitHub Actions and AWS for deployment to higher environments.
  • We have worked on Snowflake to create Table and Views as a user but we learned the admin part of the snowflake to set up users, roles, privileges
  • We learned a lot on LLM and specifically we learnt that we can bring contextual awareness to LLM by conditionally changing system prompt which helped in two of our core features

What's next for Kronia

  • Integrate more features such as:
    • Answering product prices and availability based on location.
    • Substitute product recommendations.
    • Quantity suggestions tailored to acreage.

Reference

  1. EPA Pesticide Labels Data
  2. Researchers Helping Protect Crops from Pests

Built With

Share this project:

Updates