Code for extracting most valuable + frequent initial parts of quizbowl questions for a particular query with AI.
Summarizes most frequent patterns early in the question so you can ANSWER FASTER! Also makes harder sample questions to practice with.
For now, more API based but may become web app in future.
SETUP STEPS:
- Git setup (see here or tutorials for mac or windows if you haven't already set git up on your computer)
- Clone this repo
a. First, open a folder where you want this to be stored (recommended Desktop/folder inside Desktop)
b. Then, open a terminal and navigate to the folder that you want this to be saved to (cd directory_path_here)
c. Copy and paste this into your terminal:
git clone https://github.com/JackWilson05/QuizBowlQuestionOptimization.git - Get a Gemini API key
a. Create your Gemini key (see here for more information or here for a tutorial)
b. Create a file called .env in the same folder as the contents of this repo
c. Add GEMINI_API_KEY="your_api_key_here" to the first line of the file and save it - Conda environment setup
a. Install anaconda if you have not already (see here for more information or here for a tutorial)
b. Create environment with: conda env create -f environment.yml -p ./qb_opt_ENV (this will create a conda environment inside your current directory at qb_opt_ENV)
c. Activate the environment with: conda activate ./qb_opt_ENV - Run this (and enjoy!): python .\extract_and_filter.py to get your interactive questions
HOW IT WORKS:
User query -> QBReader API Call -> Power Clue Extraction -> Gemini API Call -> Output (summaries, harder questions, and related terms)
EXAMPLE INPUT/OUTPUT:
Input:
- Set: all
- Difficulty: 6,7 (Easy and Medium College)
- Category: 2 (Science)
- Query: Cnidaria
- Exact Match: y
Output:
{
"overall_summary": "Cnidaria is a phylum of aquatic invertebrates that includes corals, jellyfish, sea anemones, and hydras. These organisms are characterized by radial symmetry and possess specialized stinging cells called nematocysts, used for defense and capturing prey. Their body plan typically consists of two epithelial layers surrounding a jelly-like mesoglea, and they exhibit two main body forms: the sessile polyp and the free-swimming medusa. Some cnidarians, like the Irukandji jellyfish, can cause severe reactions in humans. Notably, certain members of this phylum, such as Turritopsis dohrnii, are considered biologically immortal due to their ability to revert to a polyp stage. The phylum also includes the colossal siphonophores, which are colonies of specialized zooids, some reaching impressive lengths.",
"power_summary": "Cnidarians are defined by the presence of nematocysts, explosive stinging organelles crucial for their survival. Their body structure is characterized by two layers of tissue surrounding a mesoglea, and they exhibit both polyp and medusa body forms. Some cnidarians, like those causing Irukandji syndrome, are particularly dangerous. Organisms within this phylum can also be identified by specialized structures like rhopalia for sensing and movement, and remarkably, some are capable of a form of biological immortality by reverting to a stem cell-like state. The extreme lengths of certain siphonophores, which are colonies of specialized individuals, also highlight unique adaptations within this phylum.",
"hard_questions": [
"What phylum contains organisms capable of biological immortality due to stem cell properties, and is known for its stinging nematocysts and radial symmetry?",
"Which phylum's longest known animal is a siphonophore exceeding 40 meters, and whose members include species causing Irukandji syndrome and possess rhopalia for sensory functions?",
"Name the invertebrate phylum whose body plan features mesoglea between two epithelial layers and includes species like corals and jellyfish, some of which are biologically immortal."
],
"related_entities": [
"Jellyfish",
"Corals",
"Sea Anemones",
"Siphonophore",
"Nematocysts"
]
}