API: How Farmer.CHAT turns conversations to structured data


📖 To learn more, take a look at our complete API

📤 Example Request

  1. Generate an api key below👇

  2. Install node-fetch & add the GOOEY_API_KEY to your environment variables.
    Never store the api key in your code and don't use direcly in the browser.

$ npm install node-fetch
$ export GOOEY_API_KEY=sk-xxxx
  1. Use this sample code to call the API.
    If you encounter any issues, write to us at [email protected] and make sure to include the full code snippet and the error message.
import fetch from 'node-fetch';

const payload = {
  "input_prompt": "Your job is to analyze incoming chat messages from farmers and the responses from a farming ai chatbot and determine how to categorize them.\n\nThe answer is only missing if the assistant:\n---\n1. Can not give any additional information\n2. Apologizes\n3. Tells the user to check a website\n---\nIf it does not say all three things, the answer has been found.\n\nFor the user's subject answer, choose from the following list as category:\n\nSubject Answers\n*********************\nSalutation\nPlant Death (Infestation and Infection)\nFarming Practice\nIrrigation\nVideo\nSupplements (Fertilizers and Pesticides)\nUnknown Category\n*********************\nAssistant Answers\n*********************\nFound\nMissing\n*********************\nGender\n*********************\nunknown\nmale\nfemale\nunspecified\n*********************\n\nConversation: \"\"\"\n   user: Hi\n   assistant: Hello! How can I assist you with farming today?\n\"\"\"\nAnalysis: {\"user\": {\"crop\": null, \"subject\": \u201dSalutation\u201d, \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: My rice crop has yellow stem borer infestation. Please suggest\n   assistant: Yellow stem borer is a major pest of rice crops. Here are some management practices that can help control the infestation of yellow stem borer in rice crops:\n\n1. Use resistant varieties of rice such as Ratna, Sasyasree, Vikas, HKR 46, NDGR 21, Pantdhan 6, VLK 39, Prahlad, Birsadhan 201, Bhudeb Ainesh, Matangini, Radha, Sudha, Amulya, Bhagirathi, Jogan, Mandira, Nalini, Sabita, VL16 and VL 206. [2][3]\n\n2. Cultural practices such as seed treatment with approved biopesticides or chemical pesticides before sowing, removing and destroying the grass weed hosts in the field bunds, channel or nearby areas of rice fields as these serve as alternative hosts for the pest, avoiding close spacing as it often increases the easy movement of pest, handpicking and destroying egg masses in the seedbed (nursery) before transplanting the field, cutting the leaf-top before transplanting to reduce carry-over of eggs from the seedbed to the field, raising the level of irrigation water periodically to submerge any eggs deposited on the lower parts of the plant, cutting out the stems with dead hearts and removing them from the field and destroying the larvae or burning the stem, and splitting applications of nitrogen fertilizer. High nitrogen application favors build-up of stem\n\"\"\"\nAnalysis: {\"user\": {\"crop\": \u201drice\u201d, \"subject\": \u201dPlant Death (Infestation and Infection)\u201d, \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: A drug can be used to increase the height of chillies in the chilli garden\n   assistant: I'm sorry, but I couldn't find any information in the search results about a drug that can increase the height of chillies in a garden. It is important to note that using untested or unverified drugs on crops can be harmful and may not be effective. It is best to consult with a local agriculture expert for specific recommendations for your district and type of plant.\n\"\"\"\nAnalysis: {\"user\": {\"crop\": \u201dchili\u201d, \"subject\": \u201dSupplements (Fertilizers and Pesticides)\u201d, \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Missing\"}}\n///\nConversation: \"\"\"\n   user: Tell me about organic farming\n   assistant: Organic farming is a method of farming that avoids the use of synthetic fertilizers, pesticides, and genetically modified organisms (GMOs). Instead, it relies on natural methods like crop rotation, composting, and biological pest control to maintain soil fertility and control pests. Organic farming also emphasizes the use of renewable resources and conservation of water and soil. [1]\n\"\"\"\nAnalysis: {\"user\": {\"crop\": null, \"subject\": \"Farming Practice\", \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: How many days should be watered after making the pepper garden?\n   assistant: According to [1], immediately after transplanting chilli seedlings to the field, the field should be irrigated. The second irrigation is given 10 days after transplanting. Afterward, irrigation is given as per the requirement. Generally, 8 to 9 irrigations are given depending on rainfall, soil type, humidity, and temperature. The method of irrigation adopted is ridges and furrow. For more specific information on irrigation practices for your particular crop and district, please consult with your local agriculture extension office or watch relevant videos on https://www.digitalgreen.org/videos. \ud83d\udca6\n\"\"\"\nAnalysis: {\"user\": {\"crop\": \"pepper\", \"subject\": \"Irrigation\", \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: Reasons why chillies fall apart\n   assistant: Chillies can fall apart due to several reasons, including environmental conditions, pests, and diseases. Inadequate pollination due to low bee activity or high temperatures can lead to poor fruit development and cause the chillies to fall apart [2]. Nutrient deficiencies, particularly a lack of phosphorus, can also affect fruit development and cause the chillies to fall apart [1]. Additionally, pests such as the chilli blossom midge can cause poor development of fruits, leading to the chillies falling apart [3]. It is important to consult with a local agriculture expert to identify the specific cause and recommend appropriate management practices for your district and type of plant. For more information on farming in India, you can visit https://www.digitalgreen.org/videos. \ud83c\udf36\ufe0f\ud83c\udf31\n\"\"\"\nAnalysis: {\"user\": {\"crop\": \u201dchili\u201d, \"subject\": \u201dPlant Death (Infestation and Infection)\u201d, \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: How to prepare dukki for planting chili garden\n   assistant: I'm sorry, I couldn't find any relevant information on preparing \"dukki\" for planting chili garden in the search results. Could you please provide more context or try rephrasing your question?\n\"\"\"\nAnalysis: {\"user\": {\"crop\": \"chili\", \"subject\": \"Farming Practice\", \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Missing\"}}\n///\nConversation: \"\"\"\n   user: Is there a video for this?\n   assistant: I'm sorry, I don't have enough information to answer your question. However, you can visit https://www.digitalgreen.org/videos to find helpful videos on various farming practices in India.\n\"\"\"\nAnalysis: {\"user\": {\"crop\": null, \"subject\": \"Video\", \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Missing\"}}\n///\nConversation: \"\"\"\n   user: Which crop can be planted in Anantapur?\n   assistant: Anantapur district in Andhra Pradesh is suitable for growing crops like groundnut, maize, jowar, sunflower, cotton, and chilli. However, the choice of crop depends on various factors such as soil type, climate, and water availability. It is recommended to consult with local agricultural experts or extension officers to determine the best crop for a particular area. [1]\n\"\"\"\nAnalysis: {\"user\": {\"crop\": null, \"subject\": \"Farming Practice\", \"location\": \"Anantapur\", \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: {{ user_msg }}\n   assistant:  {{ assistant_msg }}\n\"\"\"\nAnalysis:",
  "selected_models": [
    "gpt_3_5_turbo"
  ]
};

async function gooeyAPI() {
  const response = await fetch("https://api.gooey.ai/v2/CompareLLM/?example_id=lbjnoem7", {
    method: "POST",
    headers: {
      "Authorization": "Bearer " + process.env["GOOEY_API_KEY"],
      "Content-Type": "application/json",
    },
    body: JSON.stringify(payload),
  });

  if (!response.ok) {
    throw new Error(response.status);
  }

  const result = await response.json();
  console.log(response.status, result);
}

gooeyAPI();
  1. Generate an api key below👇

  2. Install requests & add the GOOEY_API_KEY to your environment variables.
    Never store the api key in your code.

$ python3 -m pip install requests
$ export GOOEY_API_KEY=sk-xxxx
  1. Use this sample code to call the API.
    If you encounter any issues, write to us at [email protected] and make sure to include the full code snippet and the error message.
import os
import requests

payload = {
    "input_prompt": 'Your job is to analyze incoming chat messages from farmers and the responses from a farming ai chatbot and determine how to categorize them.\n\nThe answer is only missing if the assistant:\n---\n1. Can not give any additional information\n2. Apologizes\n3. Tells the user to check a website\n---\nIf it does not say all three things, the answer has been found.\n\nFor the user\'s subject answer, choose from the following list as category:\n\nSubject Answers\n*********************\nSalutation\nPlant Death (Infestation and Infection)\nFarming Practice\nIrrigation\nVideo\nSupplements (Fertilizers and Pesticides)\nUnknown Category\n*********************\nAssistant Answers\n*********************\nFound\nMissing\n*********************\nGender\n*********************\nunknown\nmale\nfemale\nunspecified\n*********************\n\nConversation: """\n   user: Hi\n   assistant: Hello! How can I assist you with farming today?\n"""\nAnalysis: {"user": {"crop": null, "subject": ”Salutation”, "location": null, "gender": "unspecified"}, "assistant": {"answer": "Found"}}\n///\nConversation: """\n   user: My rice crop has yellow stem borer infestation. Please suggest\n   assistant: Yellow stem borer is a major pest of rice crops. Here are some management practices that can help control the infestation of yellow stem borer in rice crops:\n\n1. Use resistant varieties of rice such as Ratna, Sasyasree, Vikas, HKR 46, NDGR 21, Pantdhan 6, VLK 39, Prahlad, Birsadhan 201, Bhudeb Ainesh, Matangini, Radha, Sudha, Amulya, Bhagirathi, Jogan, Mandira, Nalini, Sabita, VL16 and VL 206. [2][3]\n\n2. Cultural practices such as seed treatment with approved biopesticides or chemical pesticides before sowing, removing and destroying the grass weed hosts in the field bunds, channel or nearby areas of rice fields as these serve as alternative hosts for the pest, avoiding close spacing as it often increases the easy movement of pest, handpicking and destroying egg masses in the seedbed (nursery) before transplanting the field, cutting the leaf-top before transplanting to reduce carry-over of eggs from the seedbed to the field, raising the level of irrigation water periodically to submerge any eggs deposited on the lower parts of the plant, cutting out the stems with dead hearts and removing them from the field and destroying the larvae or burning the stem, and splitting applications of nitrogen fertilizer. High nitrogen application favors build-up of stem\n"""\nAnalysis: {"user": {"crop": ”rice”, "subject": ”Plant Death (Infestation and Infection)”, "location": null, "gender": "unspecified"}, "assistant": {"answer": "Found"}}\n///\nConversation: """\n   user: A drug can be used to increase the height of chillies in the chilli garden\n   assistant: I\'m sorry, but I couldn\'t find any information in the search results about a drug that can increase the height of chillies in a garden. It is important to note that using untested or unverified drugs on crops can be harmful and may not be effective. It is best to consult with a local agriculture expert for specific recommendations for your district and type of plant.\n"""\nAnalysis: {"user": {"crop": ”chili”, "subject": ”Supplements (Fertilizers and Pesticides)”, "location": null, "gender": "unspecified"}, "assistant": {"answer": "Missing"}}\n///\nConversation: """\n   user: Tell me about organic farming\n   assistant: Organic farming is a method of farming that avoids the use of synthetic fertilizers, pesticides, and genetically modified organisms (GMOs). Instead, it relies on natural methods like crop rotation, composting, and biological pest control to maintain soil fertility and control pests. Organic farming also emphasizes the use of renewable resources and conservation of water and soil. [1]\n"""\nAnalysis: {"user": {"crop": null, "subject": "Farming Practice", "location": null, "gender": "unspecified"}, "assistant": {"answer": "Found"}}\n///\nConversation: """\n   user: How many days should be watered after making the pepper garden?\n   assistant: According to [1], immediately after transplanting chilli seedlings to the field, the field should be irrigated. The second irrigation is given 10 days after transplanting. Afterward, irrigation is given as per the requirement. Generally, 8 to 9 irrigations are given depending on rainfall, soil type, humidity, and temperature. The method of irrigation adopted is ridges and furrow. For more specific information on irrigation practices for your particular crop and district, please consult with your local agriculture extension office or watch relevant videos on https://www.digitalgreen.org/videos. 💦\n"""\nAnalysis: {"user": {"crop": "pepper", "subject": "Irrigation", "location": null, "gender": "unspecified"}, "assistant": {"answer": "Found"}}\n///\nConversation: """\n   user: Reasons why chillies fall apart\n   assistant: Chillies can fall apart due to several reasons, including environmental conditions, pests, and diseases. Inadequate pollination due to low bee activity or high temperatures can lead to poor fruit development and cause the chillies to fall apart [2]. Nutrient deficiencies, particularly a lack of phosphorus, can also affect fruit development and cause the chillies to fall apart [1]. Additionally, pests such as the chilli blossom midge can cause poor development of fruits, leading to the chillies falling apart [3]. It is important to consult with a local agriculture expert to identify the specific cause and recommend appropriate management practices for your district and type of plant. For more information on farming in India, you can visit https://www.digitalgreen.org/videos. 🌶️🌱\n"""\nAnalysis: {"user": {"crop": ”chili”, "subject": ”Plant Death (Infestation and Infection)”, "location": null, "gender": "unspecified"}, "assistant": {"answer": "Found"}}\n///\nConversation: """\n   user: How to prepare dukki for planting chili garden\n   assistant: I\'m sorry, I couldn\'t find any relevant information on preparing "dukki" for planting chili garden in the search results. Could you please provide more context or try rephrasing your question?\n"""\nAnalysis: {"user": {"crop": "chili", "subject": "Farming Practice", "location": null, "gender": "unspecified"}, "assistant": {"answer": "Missing"}}\n///\nConversation: """\n   user: Is there a video for this?\n   assistant: I\'m sorry, I don\'t have enough information to answer your question. However, you can visit https://www.digitalgreen.org/videos to find helpful videos on various farming practices in India.\n"""\nAnalysis: {"user": {"crop": null, "subject": "Video", "location": null, "gender": "unspecified"}, "assistant": {"answer": "Missing"}}\n///\nConversation: """\n   user: Which crop can be planted in Anantapur?\n   assistant: Anantapur district in Andhra Pradesh is suitable for growing crops like groundnut, maize, jowar, sunflower, cotton, and chilli. However, the choice of crop depends on various factors such as soil type, climate, and water availability. It is recommended to consult with local agricultural experts or extension officers to determine the best crop for a particular area. [1]\n"""\nAnalysis: {"user": {"crop": null, "subject": "Farming Practice", "location": "Anantapur", "gender": "unspecified"}, "assistant": {"answer": "Found"}}\n///\nConversation: """\n   user: {{ user_msg }}\n   assistant:  {{ assistant_msg }}\n"""\nAnalysis:',
    "selected_models": ["gpt_3_5_turbo"],
}

response = requests.post(
    "https://api.gooey.ai/v2/CompareLLM/?example_id=lbjnoem7",
    headers={
        "Authorization": "Bearer " + os.environ["GOOEY_API_KEY"],
    },
    json=payload,
)
assert response.ok, response.content

result = response.json()
print(response.status_code, result)
  1. Generate an api key below👇

  2. Install curl & add the GOOEY_API_KEY to your environment variables.
    Never store the api key in your code.

export GOOEY_API_KEY=sk-xxxx
  1. Run the following curl command in your terminal.
    If you encounter any issues, write to us at [email protected] and make sure to include the full curl command and the error message.
curl 'https://api.gooey.ai/v2/CompareLLM/?example_id=lbjnoem7' \
  -H "Authorization: Bearer $GOOEY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "input_prompt": "Your job is to analyze incoming chat messages from farmers and the responses from a farming ai chatbot and determine how to categorize them.\n\nThe answer is only missing if the assistant:\n---\n1. Can not give any additional information\n2. Apologizes\n3. Tells the user to check a website\n---\nIf it does not say all three things, the answer has been found.\n\nFor the user'"'"'s subject answer, choose from the following list as category:\n\nSubject Answers\n*********************\nSalutation\nPlant Death (Infestation and Infection)\nFarming Practice\nIrrigation\nVideo\nSupplements (Fertilizers and Pesticides)\nUnknown Category\n*********************\nAssistant Answers\n*********************\nFound\nMissing\n*********************\nGender\n*********************\nunknown\nmale\nfemale\nunspecified\n*********************\n\nConversation: \"\"\"\n   user: Hi\n   assistant: Hello! How can I assist you with farming today?\n\"\"\"\nAnalysis: {\"user\": {\"crop\": null, \"subject\": \u201dSalutation\u201d, \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: My rice crop has yellow stem borer infestation. Please suggest\n   assistant: Yellow stem borer is a major pest of rice crops. Here are some management practices that can help control the infestation of yellow stem borer in rice crops:\n\n1. Use resistant varieties of rice such as Ratna, Sasyasree, Vikas, HKR 46, NDGR 21, Pantdhan 6, VLK 39, Prahlad, Birsadhan 201, Bhudeb Ainesh, Matangini, Radha, Sudha, Amulya, Bhagirathi, Jogan, Mandira, Nalini, Sabita, VL16 and VL 206. [2][3]\n\n2. Cultural practices such as seed treatment with approved biopesticides or chemical pesticides before sowing, removing and destroying the grass weed hosts in the field bunds, channel or nearby areas of rice fields as these serve as alternative hosts for the pest, avoiding close spacing as it often increases the easy movement of pest, handpicking and destroying egg masses in the seedbed (nursery) before transplanting the field, cutting the leaf-top before transplanting to reduce carry-over of eggs from the seedbed to the field, raising the level of irrigation water periodically to submerge any eggs deposited on the lower parts of the plant, cutting out the stems with dead hearts and removing them from the field and destroying the larvae or burning the stem, and splitting applications of nitrogen fertilizer. High nitrogen application favors build-up of stem\n\"\"\"\nAnalysis: {\"user\": {\"crop\": \u201drice\u201d, \"subject\": \u201dPlant Death (Infestation and Infection)\u201d, \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: A drug can be used to increase the height of chillies in the chilli garden\n   assistant: I'"'"'m sorry, but I couldn'"'"'t find any information in the search results about a drug that can increase the height of chillies in a garden. It is important to note that using untested or unverified drugs on crops can be harmful and may not be effective. It is best to consult with a local agriculture expert for specific recommendations for your district and type of plant.\n\"\"\"\nAnalysis: {\"user\": {\"crop\": \u201dchili\u201d, \"subject\": \u201dSupplements (Fertilizers and Pesticides)\u201d, \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Missing\"}}\n///\nConversation: \"\"\"\n   user: Tell me about organic farming\n   assistant: Organic farming is a method of farming that avoids the use of synthetic fertilizers, pesticides, and genetically modified organisms (GMOs). Instead, it relies on natural methods like crop rotation, composting, and biological pest control to maintain soil fertility and control pests. Organic farming also emphasizes the use of renewable resources and conservation of water and soil. [1]\n\"\"\"\nAnalysis: {\"user\": {\"crop\": null, \"subject\": \"Farming Practice\", \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: How many days should be watered after making the pepper garden?\n   assistant: According to [1], immediately after transplanting chilli seedlings to the field, the field should be irrigated. The second irrigation is given 10 days after transplanting. Afterward, irrigation is given as per the requirement. Generally, 8 to 9 irrigations are given depending on rainfall, soil type, humidity, and temperature. The method of irrigation adopted is ridges and furrow. For more specific information on irrigation practices for your particular crop and district, please consult with your local agriculture extension office or watch relevant videos on https://www.digitalgreen.org/videos. \ud83d\udca6\n\"\"\"\nAnalysis: {\"user\": {\"crop\": \"pepper\", \"subject\": \"Irrigation\", \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: Reasons why chillies fall apart\n   assistant: Chillies can fall apart due to several reasons, including environmental conditions, pests, and diseases. Inadequate pollination due to low bee activity or high temperatures can lead to poor fruit development and cause the chillies to fall apart [2]. Nutrient deficiencies, particularly a lack of phosphorus, can also affect fruit development and cause the chillies to fall apart [1]. Additionally, pests such as the chilli blossom midge can cause poor development of fruits, leading to the chillies falling apart [3]. It is important to consult with a local agriculture expert to identify the specific cause and recommend appropriate management practices for your district and type of plant. For more information on farming in India, you can visit https://www.digitalgreen.org/videos. \ud83c\udf36\ufe0f\ud83c\udf31\n\"\"\"\nAnalysis: {\"user\": {\"crop\": \u201dchili\u201d, \"subject\": \u201dPlant Death (Infestation and Infection)\u201d, \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: How to prepare dukki for planting chili garden\n   assistant: I'"'"'m sorry, I couldn'"'"'t find any relevant information on preparing \"dukki\" for planting chili garden in the search results. Could you please provide more context or try rephrasing your question?\n\"\"\"\nAnalysis: {\"user\": {\"crop\": \"chili\", \"subject\": \"Farming Practice\", \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Missing\"}}\n///\nConversation: \"\"\"\n   user: Is there a video for this?\n   assistant: I'"'"'m sorry, I don'"'"'t have enough information to answer your question. However, you can visit https://www.digitalgreen.org/videos to find helpful videos on various farming practices in India.\n\"\"\"\nAnalysis: {\"user\": {\"crop\": null, \"subject\": \"Video\", \"location\": null, \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Missing\"}}\n///\nConversation: \"\"\"\n   user: Which crop can be planted in Anantapur?\n   assistant: Anantapur district in Andhra Pradesh is suitable for growing crops like groundnut, maize, jowar, sunflower, cotton, and chilli. However, the choice of crop depends on various factors such as soil type, climate, and water availability. It is recommended to consult with local agricultural experts or extension officers to determine the best crop for a particular area. [1]\n\"\"\"\nAnalysis: {\"user\": {\"crop\": null, \"subject\": \"Farming Practice\", \"location\": \"Anantapur\", \"gender\": \"unspecified\"}, \"assistant\": {\"answer\": \"Found\"}}\n///\nConversation: \"\"\"\n   user: {{ user_msg }}\n   assistant:  {{ assistant_msg }}\n\"\"\"\nAnalysis:",
  "selected_models": [
    "gpt_3_5_turbo"
  ]
}'

🎁 Example Response

{4 Items
"id"
:
string
"b5mibwc80izb"
"url"
:
string
"https://gooey.ai/compare-large-language-models/"
"created_at"
:
string
"2024-02-07T22:00:23.118305+00:00"
"output"
:
{1 Items
"output_text"
:
{1 Items
"gpt_3_5_turbo"
:
[
]1 Items
}
}
}

Please Login to generate the $GOOEY_API_KEY