aita_core.config — Configuration

The configuration module defines the CourseConfig dataclass and provides global config management via set_config() / get_config().

class aita_core.config.CourseConfig(course_id: str, course_name: str, course_short_name: str, course_description: str, system_prompt: str, week_topics: dict, topic_num_to_week: dict, hw_num_to_week: dict, lab_num_to_week: dict, study_guide_to_week: dict, example_prompts: dict, base_dir: str, course_materials_dir: str, faiss_db_dir: str, docs_dir: str, backup_dir: str, data_dir: str, admin_password: str, cookie_name: str, cookie_key: str, redirect_uri: str, admin_emails: list = <factory>, google_client_secret_file: str = '', semester_start: str = '', break_weeks: list = <factory>, test_mode: bool = False, week_aware: bool = True, inject_schedule: bool = True, meeting_pattern: str = '', survey_enabled: bool = False, survey_open_date: str = '', survey_consent_text: str = '', exam_scope: dict = <factory>, textbook_url: str = '', textbook_chapter_to_week: dict = <factory>, llm_provider: str = 'openai', gcp_project: str = '', gcp_location: str = 'us-central1', embedding_model: str = 'text-embedding-3-large', embedding_dimensions: int = 3072, llm_model: str = 'gpt-4o-mini', llm_temperature: float = 0, llm_max_output_tokens: int = 0, llm_extra_params: dict = <factory>, chunk_size: int = 2048, chunk_overlap: int = 256, retrieval_k: int = 5, retrieval_source_balance: str = '', retrieval_max_homework: int = 2, retrieval_min_score: float = 0.0)[source]

Bases: object

Parameters:
  • course_id (str)

  • course_name (str)

  • course_short_name (str)

  • course_description (str)

  • system_prompt (str)

  • week_topics (dict)

  • topic_num_to_week (dict)

  • hw_num_to_week (dict)

  • lab_num_to_week (dict)

  • study_guide_to_week (dict)

  • example_prompts (dict)

  • base_dir (str)

  • course_materials_dir (str)

  • faiss_db_dir (str)

  • docs_dir (str)

  • backup_dir (str)

  • data_dir (str)

  • admin_password (str)

  • cookie_name (str)

  • cookie_key (str)

  • redirect_uri (str)

  • admin_emails (list)

  • google_client_secret_file (str)

  • semester_start (str)

  • break_weeks (list)

  • test_mode (bool)

  • week_aware (bool)

  • inject_schedule (bool)

  • meeting_pattern (str)

  • survey_enabled (bool)

  • survey_open_date (str)

  • survey_consent_text (str)

  • exam_scope (dict)

  • textbook_url (str)

  • textbook_chapter_to_week (dict)

  • llm_provider (str)

  • gcp_project (str)

  • gcp_location (str)

  • embedding_model (str)

  • embedding_dimensions (int)

  • llm_model (str)

  • llm_temperature (float)

  • llm_max_output_tokens (int)

  • llm_extra_params (dict)

  • chunk_size (int)

  • chunk_overlap (int)

  • retrieval_k (int)

  • retrieval_source_balance (str)

  • retrieval_max_homework (int)

  • retrieval_min_score (float)

course_id: str
course_name: str
course_short_name: str
course_description: str
system_prompt: str
week_topics: dict
topic_num_to_week: dict
hw_num_to_week: dict
lab_num_to_week: dict
study_guide_to_week: dict
example_prompts: dict
base_dir: str
course_materials_dir: str
faiss_db_dir: str
docs_dir: str
backup_dir: str
data_dir: str
admin_password: str
cookie_name: str
cookie_key: str
redirect_uri: str
admin_emails: list
google_client_secret_file: str = ''
semester_start: str = ''
break_weeks: list
test_mode: bool = False
week_aware: bool = True
inject_schedule: bool = True
meeting_pattern: str = ''
survey_enabled: bool = False
survey_open_date: str = ''
exam_scope: dict
textbook_url: str = ''
textbook_chapter_to_week: dict
llm_provider: str = 'openai'
gcp_project: str = ''
gcp_location: str = 'us-central1'
embedding_model: str = 'text-embedding-3-large'
embedding_dimensions: int = 3072
llm_model: str = 'gpt-4o-mini'
llm_temperature: float = 0
llm_max_output_tokens: int = 0
llm_extra_params: dict
chunk_size: int = 2048
chunk_overlap: int = 256
retrieval_k: int = 5
retrieval_source_balance: str = ''
retrieval_max_homework: int = 2
retrieval_min_score: float = 0.0
property google_auth_enabled: bool
property week_to_hw: dict
get_current_week()[source]

Compute current instructional week from today’s date and semester_start.

Subtracts any break weeks (e.g., spring break) that have already elapsed. Returns 1 if semester_start is not set or date is before semester start. Clamps to max week in week_topics.

Return type:

int

get_topics_covered(current_week)[source]
get_topics_not_covered(current_week)[source]
auto_detect_exam_scope()[source]

Auto-detect exam scope from week_topics by finding review/exam weeks.

Return type:

dict

get_exam_topics(exam_name)[source]

Get the list of topics covered by a specific exam.

Parameters:

exam_name (str)

Return type:

list

load_overrides()[source]

Load saved config overrides from JSON file in data_dir.

save_overrides(overrides)[source]

Save config overrides to JSON file and apply them in-memory.

Parameters:

overrides (dict)

aita_core.config.set_config(config)[source]
Parameters:

config (CourseConfig)

aita_core.config.get_config()[source]
Return type:

CourseConfig

aita_core.config.discover_google_oauth(base_dir)[source]

Locate the OAuth client-secret file and validate the companion env vars.

Every course repo had this block copied verbatim into its config.py. Returns (client_secret_path, cookie_key, redirect_uri); client_secret_path is “” when OAuth is not fully configured, which makes the app fall back to student-ID login rather than half-starting OAuth.

Constants

aita_core.config.INT_KEY_DICT_FIELDS: frozenset

Set of field names whose dict keys are integers (need conversion when serializing to/from JSON).

aita_core.config.EDITABLE_FIELDS: list[str]

List of CourseConfig field names that can be edited via the admin panel and saved as JSON overrides.