Calvin Course Advisor Bot¶

In [ ]:
 

Step 1: Get an LLM running

https://ollama.com/library/gemma3:1b

Option 1: Run locally:¶

  1. Install ollama.
  2. Start the server: ollama serve.
  3. Pull the model: ollama pull gemma3:1b-it-qat
  • If you have a lot of memory, or a good GPU, you can try gemma3:4b-it-qat.

If you do this, you can use:

client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")

Option 2: Use the Google Gemini API (talking the OpenAI protocol)¶

See the instrucitons in CS 375 Homework 1.

Warm-Up: Structured Outputs¶

We want to ask the model to output a set of search queries. So we'll want to have the model output in a structured way that's easy for us to parse.

See https://platform.openai.com/docs/guides/structured-outputs?api-mode=chat for an intro.

https://ollama.com/blog/structured-outputs

In [43]:
import openai

First we'll use Pydantic to declare what type of output we want. Despite being named "model", this isn't an AI model; it's basically a data class (a struct).

In [83]:
from typing import Literal
from pydantic import BaseModel

class SearchTool(BaseModel):
    tool_name: Literal["search_course_catalog"] = "search_course_catalog"
    thinking: str
    queries: list[str]

example_search = SearchTool(
    thinking="The user wants to know some trivia.",
    queries=[
        "What is the capital of France?",
        "What is the largest mammal?",
    ])
example_search
Out[83]:
SearchTool(tool_name='search_course_catalog', thinking='The user wants to know some trivia.', queries=['What is the capital of France?', 'What is the largest mammal?'])
In [115]:
json.dumps(SearchTool.model_json_schema())
Out[115]:
'{"properties": {"tool_name": {"const": "search_course_catalog", "default": "search_course_catalog", "title": "Tool Name", "type": "string"}, "thinking": {"title": "Thinking", "type": "string"}, "queries": {"items": {"type": "string"}, "title": "Queries", "type": "array"}}, "required": ["thinking", "queries"], "title": "SearchTool", "type": "object"}'

Now let's ask the LLM to create these queries for us. We'll use response_format in the OpenAI API.

We'll need to do some prompt engineering to get reasonable results from this small model.

https://platform.openai.com/docs/guides/text?api-mode=chat

In [120]:
client = openai.OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
MODEL_NAME = "gemma3:1b-it-qat" # change this if you want to use a different model

completion = client.beta.chat.completions.parse(
    model=MODEL_NAME,
    messages=[
        {"role": "system", "content": f"""
Write 10 search queries for a course catalog that would find information relevant to the user's interest. The queries should match titles or descriptions of courses in an undergraduate program.

Example:
Student interest: "art"
Queries: ["art", "photography", "visual rhetoric", "painting", "sculpture", "art history", "graphic design", "digital media", "art theory", "contemporary art"]

Notes:
- Before responding, write a short thought about what kinds of courses might be relevant to the user's interest.
- Ensure that each query would match one or more specific courses.
       
The output should be JSON with the following schema: {json.dumps(SearchTool.model_json_schema())}
"""},
        {"role": "user", "content": "I'm looking for courses related to AI."},
    ],
    response_format=SearchTool,
    temperature=0.5
)

event = completion.choices[0].message.parsed
event
Out[120]:
SearchTool(tool_name='search_course_catalog', thinking="Given the topic of AI, I'll focus on courses related to machine learning, deep learning, natural language processing, and potentially robotics.  I'll also include introductory courses to give a broad overview.", queries=['ai', 'machine learning', 'deep learning', 'natural language processing', 'robotics', 'artificial intelligence', 'algorithms', 'neural networks', 'data science', 'computer vision', 'ethics of ai'])

Step 2: Make a simple retrieval system¶

We'll pull course descriptions from a Calvin course search endpoint.

In [85]:
sections_json_url = 'https://app.calvin.edu/coursesearch/AY25FA25_Sections.json'
# TODO: replace with our mirror.

import requests

sections_json = requests.get(sections_json_url)
sections_json.raise_for_status()
sections = sections_json.json()
In [86]:
len(sections)
Out[86]:
1020
In [87]:
next(section for section in sections if section['SectionName'].startswith('CS 108'))
#[section for section in sections if 'programming' in section.get('CourseDescription', '').lower()]
Out[87]:
{'AcademicLevel': 'Undergraduate',
 'AcademicPeriod': '2025 Fall (09/02/2025-12/18/2025)',
 'Campus': 'Grand Rapids Campus',
 'CourseNumber': '108',
 'DeliveryMode': 'In-Person',
 'CourseDescription': 'An introduction to computing as a problem-solving discipline. A primary emphasis is on programming as a methodology for problem solving, including: the precise specification of a problem, the design of its solution, the encoding of that solution, and the testing, debugging and maintenance of programs. A secondary emphasis is the discussion of topics from the breadth of computing including historical, theoretical, ethical and biblical perspectives on computing as a discipline. Laboratory. Lab fee - see catalog for details.',
 'SectionEndDate': '2025-12-18',
 'EnrolledCapacity': '8/16',
 'SectionHours': '3',
 'InstructionalFormat': 'Lecture',
 'Instructors': 'Rocky Chang (張蛟川)',
 'Locations': 'Science Building 372 - PC Classroom',
 'MeetingPatterns': 'MWF | 11:00 AM - 12:05 PM | 09/02/2025 - 12/18/2025',
 'AcademicPeriod_RefID': 'AY25/FA25',
 'SectionNumber': 'A',
 'SectionName': 'CS 108-A',
 'SectionTitle': 'Introduction to Computing',
 'SectionStartDate': '2025-09-02',
 'SectionStatus': 'Open',
 'SectionSubject': 'Computer Science',
 'Subject_RefID': 'CS',
 'Section_RefID': 'COURSE_SECTION-3-116645',
 'CourseLevel': '100'}
In [88]:
course_descriptions = {
    section['SectionName'].split('-', 1)[0].strip(): (section["SectionTitle"], section["CourseDescription"])
    for section in sections
    if "CourseDescription" in section
    and section.get('AcademicLevel') == 'Undergraduate'
    and section.get('Campus') == 'Grand Rapids Campus'
}
In [89]:
len(course_descriptions)
Out[89]:
430
In [90]:
def search_courses(query: str):
    """
    Search for courses that match the query.
    """
    query = query.lower()
    matches = []
    for course, (title, description) in course_descriptions.items():
        if query in title.lower() or query in description.lower():
            matches.append((course, title, description))
    return matches
search_courses("programming")
Out[90]:
[('CS 106',
  'Introduction to Scientific Computation And Modeling',
  'An introduction to computing as a tool for science, emphasizing programming as a methodology for problem solving, quantitative data analysis, and simulation in science and mathematics. This includes in silico modeling of natural phenomena, precise specification of a problem, design of its algorithmic solution, testing, debugging, and maintaining software, using scripting to increase scientific productivity, and the use of existing scientific software libraries. A secondary emphasis is the discussion of breadth topics, including historical, theoretical, ethical and biblical perspectives on computing as a discipline. This course provides an alternative to CS 108, providing an introduction to computing focusing on scientific examples and applications. Laboratory. Lab fee - see catalog for details.'),
 ('CS 108',
  'Introduction to Computing',
  'An introduction to computing as a problem-solving discipline. A primary emphasis is on programming as a methodology for problem solving, including: the precise specification of a problem, the design of its solution, the encoding of that solution, and the testing, debugging and maintenance of programs. A secondary emphasis is the discussion of topics from the breadth of computing including historical, theoretical, ethical and biblical perspectives on computing as a discipline. Laboratory. Lab fee - see catalog for details.'),
 ('CS 112',
  'Introduction to Data Structures',
  'A continuation of CS 108, CS 106, or CS 104, using C++ classes to introduce and implement the elementary data structures including lists, stacks, queues and trees. Advanced programming techniques such as indirection, inheritance, and templates are introduced, along with an emphasis on algorithm analysis, efficiency, and good programming style. Laboratory. Lab fee - see catalog for details.'),
 ('DATA 202',
  'Predictive Analytics',
  'A conceptual and practical introduction data preparation, visualization, and predictive analytics. Students will use programming to construct generalizable workflows to acquire, filter, transform, and combine data sets from various sources; to construct quantitative summaries and basic visualizations; and to apply a range of modeling tools to label and predict data. Students will also discuss ethical and social considerations of data collection and data-driven systems. Lab fee - see catalog for details. Minimum of C in chosen prerequisite course.'),
 ('RECR 314',
  'Programming Principles of Therapeutic Recreation',
  'This course will provide students with an understanding of the role and function of the therapeutic recreation profession in the delivery of habilitative and rehabilitative services to persons with disabilities. This course will help students understand and develop comprehensive programs in health care settings. The management of therapeutic recreation in clinical and community settings will be also examined.'),
 ('CS 374',
  'High Performance Computing',
  'A study of architectures, algorithms and programming techniques that help minimize the execution times of computer programs that solve particular problems. Topics include high performance computer architectures, parallel programming techniques for distributed and shared-memory multiprocessors, code optimization and hands-on experience using the Calvin University supercomputer. Laboratory. Lab fee - see catalog for details.')]

A Complete Bot¶

In [105]:
scenario = "I want to do graduate school in computational biology. What undergrad courses could I take to prepare myself?"

messages = [
    {"role": "system", "content": """
You are a course advisor bot that can make search queries to a course catalog. You will help students find courses that match their interests.

The conversation will follow the following format:
1. The user will describe their interests. 
2. The assistant will write 10 search queries that would match titles or descriptions of courses in an undergraduate program. For example, if the student is interested in art, the assistant should query for "art", "photography", "visual rhetoric", etc.
3. The user will respond with a list of courses that match the queries.
4. The assistant will then suggest specific courses relevant to the user's interests.

Notes:
- Before responding, think about the user's interests.
- Ensure that each query would match one or more specific courses in the course catalog.
- Queries should be one or two words long
"""},
        {"role": "user", "content": scenario},
]

completion = client.beta.chat.completions.parse(
    model=MODEL_NAME,
    messages=messages,
    response_format=SearchTool,
    temperature=0.5,
)
event = completion.choices[0].message.parsed
print(event.thinking)
print('; '.join(event.queries))
event
Computational biology is a broad field – it involves things like data analysis, machine learning, and modeling. Let’s start by identifying core areas of study.  I’ll generate 10 search queries to help you find relevant undergraduate courses.
machine learning; data analysis; bioinformatics; statistics; programming; biology; genetics; computational modeling; algorithms; databases
Out[105]:
SearchTool(tool_name='search_course_catalog', thinking='Computational biology is a broad field – it involves things like data analysis, machine learning, and modeling. Let’s start by identifying core areas of study.  I’ll generate 10 search queries to help you find relevant undergraduate courses.', queries=['machine learning', 'data analysis', 'bioinformatics', 'statistics', 'programming', 'biology', 'genetics', 'computational modeling', 'algorithms', 'databases'])
In [106]:
# find courses that would match *any* of the queries
matches = {
    course
    for query in event.queries
    for course in search_courses(query)
}
len(matches)
Out[106]:
33
In [107]:
event.model_dump_json()
Out[107]:
'{"tool_name":"search_course_catalog","thinking":"Computational biology is a broad field – it involves things like data analysis, machine learning, and modeling. Let’s start by identifying core areas of study.  I’ll generate 10 search queries to help you find relevant undergraduate courses.","queries":["machine learning","data analysis","bioinformatics","statistics","programming","biology","genetics","computational modeling","algorithms","databases"]}'
In [108]:
def format_matches_as_document(matches):
    """
    Format the matches as a document.
    """
    return f"{len(matches)} total matches:\n" + "\n".join(
        f"{course}: {title} - {description}"
        for course, title, description in matches
    )
formatted_matches = format_matches_as_document(matches)
print(formatted_matches)
33 total matches:
BIOL 160: Ecological and Evolutionary Systems - The basic concepts in ecological and evolutionary biology. Topics include: population ecology and genetics, community ecology, evolutionary processes and speciation, phylogenetics, adaptive biology, ecosystem dynamics, environmental degradation and environmental sustainability, and biodiversity. Students develop critical thinking skills by applying these concepts to biological challenges and problems at local, regional, and global scales. Lectures, in-class activities, and discussions. 
BIOL 161L: Cellular and Genetic Systems Lab - Students use prevailing methods to conduct lab experiments that test the effects of cooking on compounds with nutritional and other health benefits, thereby developing competencies for contemporary cellular and molecular biology research.Corequisite: BIOL 161 . Lab fee. See catalog for details.
CS 106: Introduction to Scientific Computation And Modeling - An introduction to computing as a tool for science, emphasizing programming as a methodology for problem solving, quantitative data analysis, and simulation in science and mathematics. This includes in silico modeling of natural phenomena, precise specification of a problem, design of its algorithmic solution, testing, debugging, and maintaining software, using scripting to increase scientific productivity, and the use of existing scientific software libraries. A secondary emphasis is the discussion of breadth topics, including historical, theoretical, ethical and biblical perspectives on computing as a discipline. This course provides an alternative to CS 108, providing an introduction to computing focusing on scientific examples and applications. Laboratory. Lab fee - see catalog for details.
CS 212: Data Structures and Algorithms - A systematic study of algorithms and their application to more advanced data structures, including trees, heaps, hash tables, and graphs. Algorithms and data structures are analyzed in their use of both time and space, and the choice of data structure in problem solving is studied. Techniques for algorithm design are introduced. Theoretical issues, such as optimality, best- and worst-case performance, and limitations of algorithms are studied, as well as implementation issues. Lab fee - see catalog for details.
BIOL 141L: Cell Biology and Genetics Lab - Laboratory exercises are designed to teach crucial lab skills while reinforcing key concepts in cellular and molecular biology. It provides students with the opportunity to further explore the concepts discussed in the lecture as well as the connections between scientific methods, evidence, and knowledge. Lab fee. See catalog for details
BIOL 161: Cellular and Genetic Systems - A presentation of the basic concepts in cellular and molecular biology and genetics. Topics include: structure and function of cells and macromolecules; energy and metabolism; cell division and regulation; DNA replication, transcription and translation; genetics; control of gene expression; and cellular mechanisms of development. Students develop critical thinking skills by applying these concepts to a broad array of bioscience problems. Laboratories consist of integrative science research projects that instill scientific competencies and proficiency with the prevailing methodologies in the cellular and molecular biosciences. BIOL 161 and BIOL 161L are required courses for biology majors.
STAT 145: Biostatistics - An introduction to the concepts and methods of probability and statistics for students in life science programs. Topics include descriptive statistics, probability theory, random variables and probability distributions, experimental design, sampling distributions, confidence intervals and hypothesis tests, analysis of variance, and correlation and regression. This course is an alternative to STAT 143 for students in certain life science programs. It is a required course for biology and public health majors and is open to others. Students may not receive credit for both STAT 143 and STAT 145.
CS 108: Introduction to Computing - An introduction to computing as a problem-solving discipline. A primary emphasis is on programming as a methodology for problem solving, including: the precise specification of a problem, the design of its solution, the encoding of that solution, and the testing, debugging and maintenance of programs. A secondary emphasis is the discussion of topics from the breadth of computing including historical, theoretical, ethical and biblical perspectives on computing as a discipline. Laboratory. Lab fee - see catalog for details.
BIOL 345L: Ecosystem Ecology and Mgt Lab - Students use established field and laboratory methods to conduct a semester-long project comprising a data-driven assessment of human impacts on and/or ecological characteristics of a local ecosystem. Students will develop technical skills and practice experimental design, data collection and recording, data analysis, and scientific communication.  Lab fee - see catalog for details.
STAT 143: Introduction to Probability and Statistics - An introduction to the concepts and methods of probability and statistics. The course is designed for students interested in the application of probability and statistics in business, economics, and the social and life sciences. Topics include descriptive statistics, probability theory, random variables and probability distributions, sampling distributions, point and interval estimation, hypothesis testing, analysis of variance, and correlation and regression. Students may not receive credit for both STAT 143 and STAT 145.
PSYC 256: Fundamentals of Research and Practice - This course will provide hands-on, participatory research activities that build on the basic theories and applications of PSYC 255. Students will be conducting projects that allow the learning of fundamental practice skills in community or social science research, but also provide additional practice and theory building in statistics and basic research methods. Specific concepts will include basic perspectives in social science research, the fundamentals of measurement in social sciences, sampling techniques, survey design, application of statistical methods to real world situations, use of jamovi statistical software, ethical issues in research, and the critical evaluation of research methods and results.
CHEM 210: Analytical Chemistry - Features a problem-solving approach that incorporates sampling, sample preparation, separation of analytes from interfering substances, measurement and data analysis interpretation. Quantitative analysis is presented in the context of analytical methods that include statistics of sample measurements (significance tests, outlier tests, linear regression), separation science (gas, liquid, and chromatography), optical spectroscopy (UV-visible, fluorescence, and atomic absorption spectroscopy), and electrochemistry (electrode potentials, and ion-selective electrodes). Highly recommended for 1st and 2nd year students, and not open to seniors except by permission.  
BIOL 123: Living Systems - Students construct comprehensive understandings of human interactions with living systems, interconnecting foundational biological concepts to contemporary scientific, societal, ethical, and religious issues. Topics covered include ecological and evolutionary systems (climate change, biodiversity, ecosystem health, natural selection, extinction), human health (nutrition, chronic and infectious diseases, allergies), genetics (mutation, meiosis, heredity, race), and stem cells (mitosis, gene expression). Problem-based learning approaches are employed in this course to examine complex societal challenges, with contemporary problems setting the context for readings and discussions that facilitate investigating, thinking, and applying. Lab Fee. See Catalog for details.
DATA 202: Predictive Analytics - A conceptual and practical introduction data preparation, visualization, and predictive analytics. Students will use programming to construct generalizable workflows to acquire, filter, transform, and combine data sets from various sources; to construct quantitative summaries and basic visualizations; and to apply a range of modeling tools to label and predict data. Students will also discuss ethical and social considerations of data collection and data-driven systems. Lab fee - see catalog for details. Minimum of C in chosen prerequisite course.
CHEM 210L: Analytical Chemistry Laboratory - Experiments applying analytical chemistry to art, nanotechnology, spectroscopy, gas- and liquid-based separations, and forensic science will be performed. Relevant statistical methods to data analysis will be performed.
STAT 343: Probability and Statistics - Probability, probability density functions, binomial, Poisson, and normal distributions, central limit theorem, limiting distributions, sample statistics, hypothesis tests, and estimators.
BIOL 205: Human Anatomy - This course examines the structure of human organ systems, including some histology and developmental biology. Major topics include the integumentary, skeletal, muscular, nervous, endocrine, cardiovascular, lymphatic, respiratory, digestive, urinary, and reproductive systems. Learning activities include lectures, active-learning activities, and exploration of clinical applications relevant to the system under study. 
INFO 201: Introduction to Management Information Systems - This course extends student knowledge in data preparation and visualization by offering hands-on expertise with workflow software, designing dashboards, and developing stories to explain data research observations. Students will apply concepts to given scenarios, providing explanations and recommendations through both written and oral communication. In addition, the course introduces common enterprise structures that support corporate information needs, including foundational concepts in information technology such as networking, relational databases, cloud resources, and data collection technologies (e.g., RFID, IoT). The course explores interorganizational systems like Electronic Data Interchange (EDI), blockchain, and related standards, while introducing students to ethical considerations in technology, emphasizing privacy, honesty, consent, and the concept of shalom in tech ethics. Sophomore or higher standing required for enrollment, or permission of the instructor.
BIOL 160L: Ecological and Evolutionary Systems Lab - Laboratories make use of prevailing methodologies to address interesting questions about organisms as complex adaptive systems, thereby giving students insights into the practice of contemporary ecological, evolutionary, and organismal biology research. Lab fee. See catalog for details.
MATH 222: Geometry, Probability, Statistics, and Methods for Elementary School Teachers - This course is a continuation of MATH 221. Both content and methodology relevant to teaching geometry, probability, and statistics in elementary school are considered. Topics covered include basic geometric concepts in two and three dimensions, transformational geometry, measurement, probability, and descriptive and inferential statistics. Pedagogical issues addressed include the place of geometry, probability, and statistics in the elementary school curriculum, use of computers in mathematics, and the development of geometric and probabilistic thinking.
BIOL 115: Essentials of Human Anatomy and Physiology - This course is a study of the major theories of biology as applied to human beings. The student is introduced to the concepts of cells, genetics, ecology, and evolution through the study of the anatomy, physiology, and development of the human body and health. Students apply these concepts to contemporary issues in human biology, society, and the environment. Laboratory activities utilize methods of biological investigation, with an emphasis on human anatomy and physiology. Three two-hour sessions weekly.Lectures and laboratory.Lab fee. See Catalog for details
BIOL 336L: General Microbiology Lab - We will integrate lecture with laboratory practices like isolating and culturing bacteria, identifying bacteria using molecular and chemical means, finding virulence factors using hospital lab techniques, and making foods that require microbial fermentation. A large part of the integrated lecture/lab will be a laboratory-based project that students will conceive as teams. Lab fee - see catalog for details.
BIOL 336: General Microbiology - Do bacteria and viruses always cause disease? Do the bacteria in our gut influence our health and behavior? Have other organisms formed mutualistic relationships with bacteria? Can bacteria survive being in outer space? In this course, students study the immense diversity of microbial life and their creative environmental adaptations. They will explore how bacteria interact with each other, their environment, and with other animals, both in health and in disease.
PSYC 255: Statistics for the Behavioral Sciences - This course is an introduction to statistics and computer application in psychology. Concepts and procedures taught include levels of measurement, measures of central tendency, correlation techniques, probability theory, and hypothesis tests. Lab work includes the use of statistical software. Psychology students typically take this course in their sophomore year. Prerequisites: An introductory course in one of the social sciences (e.g., PSYC 151) and meeting the Calvin admission requirement in mathematics.
BIOL 295: Biology Seminar - Various vocational and research topics in biology and related disciplines are presented by visiting speakers, faculty, and students. Biology majors must complete two semesters of BIOL 295. The first semester should be when they are enrolled in BIOL 200, and the second semester should be during the junior or senior year. Students of all levels are encouraged to attend biology seminars, even when they are not enrolled in BIOL 295.
GEO 181L: FYRES Laboratory - This laboratory course engages students in hands-on dune research experiences, with many activities taking place at Lake Michigan dune sites. Student activities are supported by upper-level student research mentors. Directed experiences at dune sites early in the semester give students experience in dune environments, dune research methods, data analysis, and the process of scientific inquiry. Then teams of students implement investigations focused on Michigan dunes, including designing their study, collecting field data, analyzing the results, and drawing conclusions. Each team communicates their study results in a conference-style research poster and oral presentation at the end of the semester. Lab fee - see catalog for details.
RECR 314: Programming Principles of Therapeutic Recreation - This course will provide students with an understanding of the role and function of the therapeutic recreation profession in the delivery of habilitative and rehabilitative services to persons with disabilities. This course will help students understand and develop comprehensive programs in health care settings. The management of therapeutic recreation in clinical and community settings will be also examined.
IDIS 210: Introduction to the Digital Humanities - This course teaches the use of digital tools and methods for study, research, and presentation within the humanities disciplines. Students will learn and apply technical skills, including how to develop and query databases, use computers for textual and numerical analyses, map locations from novels and historical periods, and present projects in print and digital formats. Students will also explore social media, including "fake news," and what it means to be a good digital citizen. Learning is hands-on and interactive, and builds a foundation for future computer-based collaborative research and career opportunities. This course is open to students in all majors and may be of particular interest to those in the humanities and social sciences.  
BIOL 345: Ecosystem Ecology and Management - The lives of human beings and countless other creatures are sustained by the goods and services resulting from the proper functioning of earth's ecosystems. As the human population places increasing pressure on these systems, the need for their careful stewardship and management grows. This course provides a detailed study of ecosystem structure and function, with special emphasis on local ecosystems, and the scientific basis for managing and restoring ecosystems. Specific topics include energy flow and nutrient cycling, biodiversity and endangered species management, conservation genetics, population dynamics, landscape ecology, and human dimensions of ecosystem management.Lectures, laboratories, case studies, and field investigations.
CS 374: High Performance Computing - A study of architectures, algorithms and programming techniques that help minimize the execution times of computer programs that solve particular problems. Topics include high performance computer architectures, parallel programming techniques for distributed and shared-memory multiprocessors, code optimization and hands-on experience using the Calvin University supercomputer. Laboratory. Lab fee - see catalog for details.
BIOL 395: Perspectives in Biology - This is a writing intensive course that integrates interdisciplinary perspectives on contemporary challenges and enduring questions in biology. By first examining current literature from different fields and having candid discussions about current issues, students come to see how differing perspectives inform these challenges and questions. Students learn how to engage with primary literature through participation in class discussions and via dialogue associated with peer presentations. Skills in biological communication surrounding a specific topic are taught and assessed as students lead a discussion based on research papers, present a research talk, and then produce a written thesis paper. Students also develop a vocational articulation for ways they can contribute to scientific and societal resolutions of these challenges and questions.
BIOL 141: Cell Biology and Genetics for the Health Sciences - This course presents the structures, functions, and evolution of prokaryotic and eukaryotic cells at the molecular, subcellular, and cellular levels. Fundamental concepts of genetics are studied including Mendelian genetics and molecular genetics. The course introduces basic historical, philosophical, and biblical frameworks for the study of biology. Applications of course concepts to contemporary issues in biology are considered.
CS 112: Introduction to Data Structures - A continuation of CS 108, CS 106, or CS 104, using C++ classes to introduce and implement the elementary data structures including lists, stacks, queues and trees. Advanced programming techniques such as indirection, inheritance, and templates are introduced, along with an emphasis on algorithm analysis, efficiency, and good programming style. Laboratory. Lab fee - see catalog for details.
In [109]:
messages.append(
    {"role": "assistant", "content": event.model_dump_json()}
)
messages.append(
    {"role": "user", "content": formatted_matches}
)
In [110]:
messages
Out[110]:
[{'role': 'system',
  'content': '\nYou are a course advisor bot that can make search queries to a course catalog. You will help students find courses that match their interests.\n\nThe conversation will follow the following format:\n1. The user will describe their interests. \n2. The assistant will write 10 search queries that would match titles or descriptions of courses in an undergraduate program. For example, if the student is interested in art, the assistant should query for "art", "photography", "visual rhetoric", etc.\n3. The user will respond with a list of courses that match the queries.\n4. The assistant will then suggest specific courses relevant to the user\'s interests.\n\nNotes:\n- Before responding, think about the user\'s interests.\n- Ensure that each query would match one or more specific courses in the course catalog.\n- Queries should be one or two words long\n'},
 {'role': 'user',
  'content': 'I want to do graduate school in computational biology. What undergrad courses could I take to prepare myself?'},
 {'role': 'assistant',
  'content': '{"tool_name":"search_course_catalog","thinking":"Computational biology is a broad field – it involves things like data analysis, machine learning, and modeling. Let’s start by identifying core areas of study.  I’ll generate 10 search queries to help you find relevant undergraduate courses.","queries":["machine learning","data analysis","bioinformatics","statistics","programming","biology","genetics","computational modeling","algorithms","databases"]}'},
 {'role': 'user',
  'content': '33 total matches:\nBIOL 160: Ecological and Evolutionary Systems - The basic concepts in ecological and evolutionary biology. Topics include: population ecology and genetics, community ecology, evolutionary processes and speciation, phylogenetics, adaptive biology, ecosystem dynamics, environmental degradation and environmental sustainability, and biodiversity. Students develop critical thinking skills by applying these concepts to biological challenges and problems at local, regional, and global scales. Lectures, in-class activities, and discussions.\xa0\nBIOL 161L: Cellular and Genetic Systems Lab - Students use prevailing methods to conduct lab experiments that test the effects of cooking on compounds with nutritional and other health benefits, thereby developing competencies for contemporary cellular and molecular biology research.Corequisite: BIOL 161 . Lab fee. See catalog for details.\nCS 106: Introduction to Scientific Computation And Modeling - An introduction to computing as a tool for science, emphasizing programming as a methodology for problem solving, quantitative data analysis, and simulation in science and mathematics. This includes in silico modeling of natural phenomena, precise specification of a problem, design of its algorithmic solution, testing, debugging, and maintaining software, using scripting to increase scientific productivity, and the use of existing scientific software libraries. A secondary emphasis is the discussion of breadth topics, including historical, theoretical, ethical and biblical perspectives on computing as a discipline. This course provides an alternative to CS 108, providing an introduction to computing focusing on scientific examples and applications. Laboratory. Lab fee - see catalog for details.\nCS 212: Data Structures and Algorithms - A systematic study of algorithms and their application to more advanced data structures, including trees, heaps, hash tables, and graphs. Algorithms and data structures are analyzed in their use of both time and space, and the choice of data structure in problem solving is studied. Techniques for algorithm design are introduced. Theoretical issues, such as optimality, best- and worst-case performance, and limitations of algorithms are studied, as well as implementation issues. Lab fee - see catalog for details.\nBIOL 141L: Cell Biology and Genetics Lab - Laboratory exercises are designed to teach crucial lab skills while reinforcing key concepts in cellular and molecular biology. It provides students with the opportunity to further explore the concepts discussed in the lecture as well as the connections between scientific methods, evidence, and knowledge. Lab fee. See catalog for details\nBIOL 161: Cellular and Genetic Systems - A presentation of the basic concepts in cellular and molecular biology and genetics. Topics include: structure and function of cells and macromolecules; energy and metabolism; cell division and regulation; DNA replication, transcription and translation; genetics; control of gene expression; and cellular mechanisms of development. Students develop critical thinking skills by applying these concepts to a broad array of bioscience problems. Laboratories consist of integrative science research projects that instill scientific competencies and proficiency with the prevailing methodologies in the cellular and molecular biosciences. BIOL 161 and BIOL 161L are required courses for biology majors.\nSTAT 145: Biostatistics - An introduction to the concepts and methods of probability and statistics for students in life science programs. Topics include descriptive statistics, probability theory, random variables and probability distributions, experimental design, sampling distributions, confidence intervals and hypothesis tests, analysis of variance, and correlation and regression. This course is an alternative to STAT 143\xa0for students in certain life science programs. It is a required course for biology and public health majors and is open to others. Students may not receive credit for both STAT 143 and STAT 145.\nCS 108: Introduction to Computing - An introduction to computing as a problem-solving discipline. A primary emphasis is on programming as a methodology for problem solving, including: the precise specification of a problem, the design of its solution, the encoding of that solution, and the testing, debugging and maintenance of programs. A secondary emphasis is the discussion of topics from the breadth of computing including historical, theoretical, ethical and biblical perspectives on computing as a discipline. Laboratory. Lab fee - see catalog for details.\nBIOL 345L: Ecosystem Ecology and Mgt Lab - Students use established field and laboratory methods to conduct a semester-long project comprising a data-driven assessment of human impacts on and/or ecological characteristics of a local ecosystem. Students will develop technical skills and practice experimental design, data collection and recording, data analysis, and scientific communication.\xa0\xa0Lab fee - see catalog for details.\nSTAT 143: Introduction to Probability and Statistics - An introduction to the concepts and methods of probability and statistics. The course is designed for students interested in the application of probability and statistics in business, economics, and the social and life sciences. Topics include descriptive statistics, probability theory, random variables and probability distributions, sampling distributions, point and interval estimation, hypothesis testing, analysis of variance, and correlation and regression. Students may not receive credit for both STAT 143 and STAT 145.\nPSYC 256: Fundamentals of Research and Practice - This course will provide hands-on, participatory research activities that build on the basic theories and applications of PSYC 255. Students will be conducting projects that allow the learning of fundamental practice skills in community or social science research, but also provide additional practice and theory building in statistics and basic research methods. Specific concepts will include basic perspectives in social science research, the fundamentals of measurement in social sciences, sampling techniques, survey design, application of statistical methods to real world situations, use of jamovi statistical software, ethical issues in research, and the critical evaluation of research methods and results.\nCHEM 210: Analytical Chemistry - Features a problem-solving approach that incorporates sampling, sample preparation, separation of analytes from interfering substances, measurement and data analysis interpretation. Quantitative analysis is presented in the context of analytical methods that include statistics of sample measurements (significance tests, outlier tests, linear regression), separation science (gas, liquid, and chromatography), optical spectroscopy (UV-visible, fluorescence, and atomic absorption spectroscopy), and electrochemistry (electrode potentials, and ion-selective electrodes). Highly recommended for 1st and 2nd year students, and not open to seniors except by permission.\xa0\xa0\nBIOL 123: Living Systems - Students construct comprehensive understandings of human interactions with living systems, interconnecting foundational biological concepts to contemporary scientific, societal, ethical, and religious issues. Topics covered include ecological and evolutionary systems (climate change, biodiversity, ecosystem health, natural selection, extinction), human health (nutrition, chronic and infectious diseases, allergies), genetics (mutation, meiosis, heredity, race), and stem cells (mitosis, gene expression). Problem-based learning approaches are employed in this course to examine complex societal challenges, with contemporary problems setting the context for readings and discussions that facilitate investigating, thinking, and applying. Lab Fee. See Catalog for details.\nDATA 202: Predictive Analytics - A conceptual and practical introduction data preparation, visualization, and predictive analytics. Students will use programming to construct generalizable workflows to acquire, filter, transform, and combine data sets from various sources; to construct quantitative summaries and basic visualizations; and to apply a range of modeling tools to label and predict data. Students will also discuss ethical and social considerations of data collection and data-driven systems. Lab fee - see catalog for details. Minimum of C in chosen prerequisite course.\nCHEM 210L: Analytical Chemistry Laboratory - Experiments applying analytical chemistry to art, nanotechnology, spectroscopy, gas- and liquid-based separations, and forensic science will be performed. Relevant statistical methods to data analysis will be performed.\nSTAT 343: Probability and Statistics - Probability, probability density functions, binomial, Poisson, and normal distributions, central limit theorem, limiting distributions, sample statistics, hypothesis tests, and estimators.\nBIOL 205: Human Anatomy - This course examines the structure of human organ systems, including some histology and developmental biology. Major topics include the integumentary, skeletal, muscular, nervous, endocrine, cardiovascular, lymphatic, respiratory, digestive, urinary, and reproductive systems. Learning activities include lectures, active-learning activities, and exploration of clinical applications relevant to the system under study.\xa0\nINFO 201: Introduction to Management Information Systems - This course extends student knowledge in data preparation and visualization by offering hands-on expertise with workflow software, designing dashboards, and developing stories to explain data research observations. Students will apply concepts to given scenarios, providing explanations and recommendations through both written and oral communication. In addition, the course introduces common enterprise structures that support corporate information needs, including foundational concepts in information technology such as networking, relational databases, cloud resources, and data collection technologies (e.g., RFID, IoT). The course explores interorganizational systems like Electronic Data Interchange (EDI), blockchain, and related standards, while introducing students to ethical considerations in technology, emphasizing privacy, honesty, consent, and the concept of shalom in tech ethics. Sophomore or higher standing required for enrollment, or permission of the instructor.\nBIOL 160L: Ecological and Evolutionary Systems Lab - Laboratories make use of prevailing methodologies to address interesting questions about organisms as complex adaptive systems, thereby giving students insights into the practice of contemporary ecological, evolutionary, and organismal biology research.\xa0Lab fee. See catalog for details.\nMATH 222: Geometry, Probability, Statistics, and Methods for Elementary School Teachers - This course is a continuation of MATH 221. Both content and methodology relevant to teaching geometry, probability, and statistics in elementary school are considered. Topics covered include basic geometric concepts in two and three dimensions, transformational geometry, measurement, probability, and descriptive and inferential statistics. Pedagogical issues addressed include the place of geometry, probability, and statistics in the elementary school curriculum, use of computers in mathematics, and the development of geometric and probabilistic thinking.\nBIOL 115: Essentials of Human Anatomy and Physiology - This course is a study of the major theories of biology as applied to human beings. The student is introduced to the concepts of cells, genetics, ecology, and evolution through the study of the anatomy, physiology, and development of the human body and health. Students apply these concepts to contemporary issues in human biology, society, and the environment. Laboratory activities utilize methods of biological investigation, with an emphasis on human anatomy and physiology. Three two-hour sessions weekly.Lectures and laboratory.Lab fee. See Catalog for details\nBIOL 336L: General Microbiology Lab - We will integrate lecture with laboratory practices like isolating and culturing bacteria, identifying bacteria using molecular and chemical means, finding virulence factors using hospital lab techniques, and making foods that require microbial fermentation. A large part of the integrated lecture/lab will be a laboratory-based project that students will conceive as teams.\xa0Lab fee - see catalog for details.\nBIOL 336: General Microbiology - Do bacteria and viruses always cause disease? Do the bacteria in our gut influence our health and behavior? Have other organisms formed mutualistic relationships with bacteria? Can bacteria survive being in outer space? In this course, students study the immense diversity of microbial life and their creative environmental adaptations. They will explore how bacteria interact with each other, their environment, and with other animals, both in health and in disease.\nPSYC 255: Statistics for the Behavioral Sciences - This course is an introduction to statistics and computer application in psychology. Concepts and procedures taught include levels of measurement, measures of central tendency, correlation techniques, probability theory, and hypothesis tests. Lab work includes the use of statistical software. Psychology students typically take this course in their sophomore year. Prerequisites: An introductory course in one of the social sciences (e.g., PSYC 151) and meeting the Calvin admission requirement in mathematics.\nBIOL 295: Biology Seminar - Various vocational and research topics in biology and related disciplines are presented by visiting speakers, faculty, and students. Biology majors must complete two semesters of BIOL 295. The first semester should be when they are enrolled in BIOL 200, and the second semester should be during the junior or senior year. Students of all levels are encouraged to attend biology seminars, even when they are not enrolled in BIOL 295.\nGEO 181L: FYRES Laboratory - This laboratory course engages students in hands-on dune research experiences, with many activities taking place at Lake Michigan dune sites. Student activities are supported by upper-level student research mentors. Directed experiences at dune sites early in the semester give students experience in dune environments, dune research methods, data analysis, and the process of scientific inquiry. Then teams of students implement investigations focused on Michigan dunes, including designing their study, collecting field data, analyzing the results, and drawing conclusions. Each team communicates their study results in a conference-style research poster and oral presentation at the end of the semester.\xa0Lab fee - see catalog for details.\nRECR 314: Programming Principles of Therapeutic Recreation - This course will provide students with an understanding of the role and function of the therapeutic recreation profession in the delivery of habilitative and rehabilitative services to persons with disabilities. This course will help students understand and develop comprehensive programs in health care settings. The management of therapeutic recreation in clinical and community settings will be also examined.\nIDIS 210: Introduction to the Digital Humanities - This course teaches the use of digital tools and methods for study, research, and presentation within the humanities disciplines. Students will learn and apply technical skills, including how to develop and query databases, use computers for textual and numerical analyses, map locations from novels and historical periods, and present projects in print and digital formats. Students will also explore social media, including "fake news," and what it means to be a good digital citizen. Learning is hands-on and interactive, and builds a foundation for future computer-based collaborative research and career opportunities. This course is open to students in all majors and may be of particular interest to those in the humanities and social sciences.\xa0\xa0\nBIOL 345: Ecosystem Ecology and Management - The lives of human beings and countless other creatures are sustained by the goods and services resulting from the proper functioning of earth\'s ecosystems. As the human population places increasing pressure on these systems, the need for their careful stewardship and management grows. This course provides a detailed study of ecosystem structure and function, with special emphasis on local ecosystems, and the scientific basis for managing and restoring ecosystems. Specific topics include energy flow and nutrient cycling, biodiversity and endangered species management, conservation genetics, population dynamics, landscape ecology, and human dimensions of ecosystem management.Lectures, laboratories, case studies, and field investigations.\nCS 374: High Performance Computing - A study of architectures, algorithms and programming techniques that help minimize the execution times of computer programs that solve particular problems. Topics include high performance computer architectures, parallel programming techniques for distributed and shared-memory multiprocessors, code optimization and hands-on experience using the Calvin University supercomputer. Laboratory. Lab fee - see catalog for details.\nBIOL 395: Perspectives in Biology - This is a writing intensive course that integrates interdisciplinary perspectives on contemporary challenges and enduring questions in biology. By first examining current literature from different fields and having candid discussions about current issues, students come to see how differing perspectives inform these challenges and questions. Students learn how to engage\xa0with primary literature\xa0through participation in class discussions and via dialogue associated with peer presentations. Skills in biological communication surrounding a specific topic are taught and assessed as students lead\xa0a discussion based on research papers, present\xa0a research talk, and then produce\xa0a written thesis paper. Students also develop a vocational\xa0articulation for ways\xa0they can contribute to scientific and societal resolutions of these challenges and questions.\nBIOL 141: Cell Biology and Genetics for the Health Sciences - This course presents the structures, functions, and evolution of prokaryotic and eukaryotic cells at the molecular, subcellular, and cellular levels. Fundamental concepts of genetics are studied including Mendelian genetics and molecular genetics. The course introduces basic historical, philosophical, and biblical frameworks for the study of biology. Applications of course concepts to contemporary issues in biology are considered.\nCS 112: Introduction to Data Structures - A continuation of CS 108, CS 106, or CS 104, using C++ classes to introduce and implement the elementary data structures including lists, stacks, queues and trees. Advanced programming techniques such as indirection, inheritance, and templates are introduced, along with an emphasis on algorithm analysis, efficiency, and good programming style. Laboratory. Lab fee - see catalog for details.'}]
In [111]:
class CourseRecommendation(BaseModel):
    course_code: str
    reasoning: str

class RecommendTool(BaseModel):
    tool_name: Literal["recommend_course"] = "recommend_course"
    thinking: str
    recommendations: list[CourseRecommendation]
In [112]:
completion = client.beta.chat.completions.parse(
    model=MODEL_NAME,
    messages=messages,
    response_format=RecommendTool,
    temperature=0.5,
)
event = completion.choices[0].message.parsed
print(event.thinking)
for rec in event.recommendations:
    try:
        description = course_descriptions[rec.course_code]
    except KeyError:
        description = ("Unknown course", "No description available")
    print(f"{rec.course_code}: {description[0]} - {description[1]}")
    print(f"Reasoning: {rec.reasoning}")
Based on the provided information, here’s a breakdown of the recommendations and a suggested approach to prioritizing them:
BIOL 345: Ecosystem Ecology and Management - The lives of human beings and countless other creatures are sustained by the goods and services resulting from the proper functioning of earth's ecosystems. As the human population places increasing pressure on these systems, the need for their careful stewardship and management grows. This course provides a detailed study of ecosystem structure and function, with special emphasis on local ecosystems, and the scientific basis for managing and restoring ecosystems. Specific topics include energy flow and nutrient cycling, biodiversity and endangered species management, conservation genetics, population dynamics, landscape ecology, and human dimensions of ecosystem management.Lectures, laboratories, case studies, and field investigations.
Reasoning: This course focuses on ecosystem ecology and management, a highly relevant and timely topic. It aligns well with the overall goal of understanding the interconnectedness of life and the challenges facing our planet.
BIOL 395: Perspectives in Biology - This is a writing intensive course that integrates interdisciplinary perspectives on contemporary challenges and enduring questions in biology. By first examining current literature from different fields and having candid discussions about current issues, students come to see how differing perspectives inform these challenges and questions. Students learn how to engage with primary literature through participation in class discussions and via dialogue associated with peer presentations. Skills in biological communication surrounding a specific topic are taught and assessed as students lead a discussion based on research papers, present a research talk, and then produce a written thesis paper. Students also develop a vocational articulation for ways they can contribute to scientific and societal resolutions of these challenges and questions.
Reasoning: This course integrates interdisciplinary perspectives on contemporary challenges and enduring questions in biology. It’s a good fit for students who want to develop a broader understanding of the field and engage in critical thinking.
CS 374: High Performance Computing - A study of architectures, algorithms and programming techniques that help minimize the execution times of computer programs that solve particular problems. Topics include high performance computer architectures, parallel programming techniques for distributed and shared-memory multiprocessors, code optimization and hands-on experience using the Calvin University supercomputer. Laboratory. Lab fee - see catalog for details.
Reasoning: This course provides a foundational understanding of high-performance computing, which is increasingly important for modern research and data analysis. It's a valuable skill for any student interested in STEM fields.
RECR 314: Programming Principles of Therapeutic Recreation - This course will provide students with an understanding of the role and function of the therapeutic recreation profession in the delivery of habilitative and rehabilitative services to persons with disabilities. This course will help students understand and develop comprehensive programs in health care settings. The management of therapeutic recreation in clinical and community settings will be also examined.
Reasoning: This course is specifically geared towards students interested in therapeutic recreation and rehabilitation, which could be a good fit for those interested in a career path in this field.
GEO 181L: FYRES Laboratory - This laboratory course engages students in hands-on dune research experiences, with many activities taking place at Lake Michigan dune sites. Student activities are supported by upper-level student research mentors. Directed experiences at dune sites early in the semester give students experience in dune environments, dune research methods, data analysis, and the process of scientific inquiry. Then teams of students implement investigations focused on Michigan dunes, including designing their study, collecting field data, analyzing the results, and drawing conclusions. Each team communicates their study results in a conference-style research poster and oral presentation at the end of the semester. Lab fee - see catalog for details.
Reasoning: This lab focuses on dune research, which is a valuable skill for students interested in environmental science and fieldwork. It’s a good option for students who enjoy outdoor activities and data collection.
BIOL 295: Biology Seminar - Various vocational and research topics in biology and related disciplines are presented by visiting speakers, faculty, and students. Biology majors must complete two semesters of BIOL 295. The first semester should be when they are enrolled in BIOL 200, and the second semester should be during the junior or senior year. Students of all levels are encouraged to attend biology seminars, even when they are not enrolled in BIOL 295.
Reasoning: This course provides a detailed study of ecosystem ecology and management, which is relevant to a wide range of fields.
IDIS 210: Introduction to the Digital Humanities - This course teaches the use of digital tools and methods for study, research, and presentation within the humanities disciplines. Students will learn and apply technical skills, including how to develop and query databases, use computers for textual and numerical analyses, map locations from novels and historical periods, and present projects in print and digital formats. Students will also explore social media, including "fake news," and what it means to be a good digital citizen. Learning is hands-on and interactive, and builds a foundation for future computer-based collaborative research and career opportunities. This course is open to students in all majors and may be of particular interest to those in the humanities and social sciences.  
Reasoning: This course is ideal for students interested in digital humanities and exploring the intersection of technology and humanities. It's a good fit for those who are curious about the future of knowledge and communication.
In [ ]: