pdf-quiz-generator/backend/scripts
Daniel 9b9795dee3 refactor: drop the litellm SDK for the openai client
litellm was doing nothing this project needs. Nine call sites, all the same
shape — model, messages, a temperature, an api_base pointing at the proxy — and
no streaming, tools, response_format, fallbacks, retries, Router or cost
tracking anywhere. `_proxy_model()` prefixed every model with `openai/`
specifically to stop litellm routing by provider, which is to say the SDK was
configured to behave like the OpenAI client it now is. Embeddings, model
discovery, speech and transcription already went over plain httpx.

The client is built in one place instead of thirteen assembled kwargs dicts,
and three things about it are deliberate: the base URL normalises to end in
`/v1`, because the SDK appends to whatever root it gets and litellm happened to
tolerate the bare host; `max_retries=0`, because the SDK retries twice by
default and would have turned the hand-written three attempts in
`extract_questions` into nine; and a placeholder key when none is configured,
so an unconfigured deployment fails at the request with the 502 every call site
expects rather than inside the constructor with a 500.

Verified against the live proxy rather than only against mocks: sync client,
async client and `_call_model` each returned from llm.danvics.com, and the
service boots clean. Nine distributions dropped, 156 to 147.

This also unblocked requirements.txt, which could not be edited at all while
litellm==1.28.13 — withdrawn from PyPI — was pinned in it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TqXevQJhxFrM7jJg82cgZN
2026-09-12 15:19:08 +02:00
..
abp-2024-outline.json feat: exams are a group you can build, with the board's own blueprint 2026-09-11 20:27:48 +02:00
article_pipeline.py feat: a study objective that changes what you see; purge unused figures 2026-09-11 02:47:01 +02:00
assign_category_systems.py feat: an organ system is a fact about a topic, not about a keyword 2026-09-12 04:32:25 +02:00
backfill_question_figures.py feat: AMBOSS exam chrome, review as a study session, and no silent submissions 2026-09-12 07:37:58 +02:00
backfill_section_index.py feat: real organ systems, symptoms grouped by system, and admin taxonomy CRUD 2026-09-10 10:44:39 +02:00
bind_exam_tags.py feat: exam-scoped disciplines and exam-scoped facet counts 2026-09-10 02:48:34 +02:00
classify_unfiled_questions.py feat: MinIO-backed media libraries, and file the last 316 questions 2026-09-10 06:45:22 +02:00
convert_tags_to_categories.py refactor: name the study plans ourselves, and stop reserving 64k tokens a call 2026-09-11 01:41:18 +02:00
fix_blueprint_collisions.py fix: one topic per idea, and one ABP domain per topic 2026-09-12 07:42:00 +02:00
fix_lab_formatting.py refactor: name the study plans ourselves, and stop reserving 64k tokens a call 2026-09-11 01:41:18 +02:00
generate_articles.py feat: article CMS, three reading views, and articles written from the library 2026-09-10 17:13:07 +02:00
index_question_images.py fix: choosing is answering; figures say only what an educator wrote 2026-09-12 00:19:35 +02:00
link_articles.py feat: settings as places with addresses; repair nested cross-references 2026-09-11 12:46:13 +02:00
mdm_pass.py fix: 'No therapy is required' is an answer, not a placeholder 2026-09-11 13:58:02 +02:00
merge_duplicate_categories.py feat: AMBOSS exam chrome, review as a study session, and no silent submissions 2026-09-12 07:37:58 +02:00
merge_duplicate_conditions.py feat: nest the system tree and give each condition one home 2026-09-10 04:26:48 +02:00
migrate_uploads_to_s3.py feat: serve uploads through storage, and move all 3,852 files to MinIO 2026-09-10 10:23:34 +02:00
nest_symptoms_by_system.py feat: real organ systems, symptoms grouped by system, and admin taxonomy CRUD 2026-09-10 10:44:39 +02:00
nest_systems.py feat: nest the system tree and give each condition one home 2026-09-10 04:26:48 +02:00
number_board_reviews.py feat: session analysis after a quiz, and a merged TODO for the rest 2026-09-11 03:07:05 +02:00
parent_keywords_to_systems.py feat: an organ system is a fact about a topic, not about a keyword 2026-09-12 04:32:25 +02:00
promote_primary_categories.py feat: promote primary categories from system down to condition 2026-09-10 04:32:55 +02:00
prose_pass.py fix: the imperative detector only ever saw sentence starts 2026-09-11 13:16:05 +02:00
purge_unused_figures.py feat: a study objective that changes what you see; purge unused figures 2026-09-11 02:47:01 +02:00
rename_study_plans.py refactor: name the study plans ourselves, and stop reserving 64k tokens a call 2026-09-11 01:41:18 +02:00
reorganize_topics.py fix: one topic per idea, and one ABP domain per topic 2026-09-12 07:42:00 +02:00
restore_subject_disease_tags.py fix: put the disciplines and diseases back, and order Performance as shown 2026-09-12 05:39:22 +02:00
retire_question_tags.py feat: retire the tags, and stop settings from hiding from the page that 2026-09-12 05:06:58 +02:00
retitle_figures.py feat: cross-link the articles, and strip what the analysis page replaced 2026-09-11 03:44:44 +02:00
rewrite_catalogue_summaries.py refactor: drop the litellm SDK for the openai client 2026-09-12 15:19:08 +02:00
rollback_tag_category_conversion.py feat: system category hierarchy from tags, category editor overlay 2026-09-08 23:50:25 +02:00
sanitize_categories.py fix: category tree cleanup, mixed-content redirect, and category page clarity 2026-09-10 04:09:18 +02:00
sanitize_tags.py feat: facet filters on the question bank, category page, sanitised tags 2026-09-10 00:13:31 +02:00
seed_abp_blueprint.py feat: exams are a group you can build, with the board's own blueprint 2026-09-11 20:27:48 +02:00
seed_illustrations.py feat: one Markdown renderer for the whole site, with LaTeX and highlights intact 2026-09-10 18:12:37 +02:00
seed_lab_references.py feat: PREP as tags, stats toggle, comments redesign, quizzes CTA 2026-09-09 01:30:20 +02:00
seed_sample_content.py feat: sample smart-links quiz, bank feedback polish, performance hierarchy 2026-09-09 03:31:54 +02:00
seed_showcase_articles.py feat: AMBOSS-style session management, question manager, showcase articles 2026-09-09 18:27:53 +02:00
seed_study_plans.py feat: study-plan blocks as modules, sessions that know their block 2026-09-11 04:31:21 +02:00
settle_topic_questions.py fix: the ear to ENT, gynecology to its own branch, and Surgery back into medicine 2026-09-12 08:06:59 +02:00
tag_source_quizzes.py refactor: name the study plans ourselves, and stop reserving 64k tokens a call 2026-09-11 01:41:18 +02:00
triage_question_images.py feat: link a question to its reading from either end, and a player that reads like a Qbank 2026-09-12 15:17:04 +02:00