From 11fdfcccd04aea8a792db5332d3aeafce13e5a7a Mon Sep 17 00:00:00 2001 From: "Scott M. Litvinoff" Date: Thu, 26 Nov 2026 19:12:02 -0500 Subject: [PATCH 1/3] Migrate from retired Claude Sonnet 4 to Claude Sonnet 5.5 claude-sonnet-4-20250514 was retired on 2026-06-15, so every query failed. - Switch ANTHROPIC_MODEL to claude-sonnet-5-5 - Drop temperature (non-default sampling params are rejected) - Raise max_tokens to 4096 since thinking tokens count toward it - Set effort to low via extra_body (pinned SDK lacks output_config) - Extract text blocks explicitly instead of content[0], skipping thinking blocks and handling refusals Co-Authored-By: Claude Opus 5.5 --- backend/ai_generator.py | 23 ++++++++++++++++++----- backend/config.py | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/backend/ai_generator.py b/backend/ai_generator.py index 0363ca90c..055a70970 100644 --- a/backend/ai_generator.py +++ b/backend/ai_generator.py @@ -33,11 +33,15 @@ def __init__(self, api_key: str, model: str): self.client = anthropic.Anthropic(api_key=api_key) self.model = model - # Pre-build base API parameters + # Pre-build base API parameters. + # Sonnet 5.5 rejects non-default sampling params (temperature etc.) and + # thinking tokens count toward max_tokens, so leave headroom. + # output_config is sent via extra_body because the pinned SDK (0.58.2) + # predates the named parameter. self.base_params = { "model": self.model, - "temperature": 0, - "max_tokens": 800 + "max_tokens": 4096, + "extra_body": {"output_config": {"effort": "low"}} } def generate_response(self, query: str, @@ -84,7 +88,7 @@ def generate_response(self, query: str, return self._handle_tool_execution(response, api_params, tool_manager) # Return direct response - return response.content[0].text + return self._extract_text(response) def _handle_tool_execution(self, initial_response, base_params: Dict[str, Any], tool_manager): """ @@ -132,4 +136,13 @@ def _handle_tool_execution(self, initial_response, base_params: Dict[str, Any], # Get final response final_response = self.client.messages.create(**final_params) - return final_response.content[0].text \ No newline at end of file + return self._extract_text(final_response) + + @staticmethod + def _extract_text(response) -> str: + """Return the text of a response, skipping thinking blocks.""" + if response.stop_reason == "refusal": + return "Sorry, I can't help with that request." + return "".join( + block.text for block in response.content if block.type == "text" + ) diff --git a/backend/config.py b/backend/config.py index d9f6392ef..55b4999fb 100644 --- a/backend/config.py +++ b/backend/config.py @@ -10,7 +10,7 @@ class Config: """Configuration settings for the RAG system""" # Anthropic API settings ANTHROPIC_API_KEY: str = os.getenv("ANTHROPIC_API_KEY", "") - ANTHROPIC_MODEL: str = "claude-sonnet-4-20250514" + ANTHROPIC_MODEL: str = "claude-sonnet-5-5" # Embedding model settings EMBEDDING_MODEL: str = "all-MiniLM-L6-v2" From f392f79a28eb99f0eebd7c82f92b8966401405f7 Mon Sep 17 00:00:00 2001 From: "Scott M. Litvinoff" Date: Thu, 26 Nov 2026 19:29:09 -0500 Subject: [PATCH 2/3] Upgrade Anthropic Python SDK from 0.58.2 to 2.14.0 SDK 2.x sends API version 2026-10-21 by default. - Pin anthropic==2.14.0 and regenerate uv.lock (adds httpx2, the SDK's HTTP dependency) - Pass output_config as a native parameter instead of via extra_body Co-Authored-By: Claude Opus 5.5 --- backend/ai_generator.py | 8 ++-- pyproject.toml | 2 +- uv.lock | 91 +++++++++++++++++++++++++++++++++-------- 3 files changed, 78 insertions(+), 23 deletions(-) diff --git a/backend/ai_generator.py b/backend/ai_generator.py index 055a70970..5329e06cc 100644 --- a/backend/ai_generator.py +++ b/backend/ai_generator.py @@ -34,14 +34,12 @@ def __init__(self, api_key: str, model: str): self.model = model # Pre-build base API parameters. - # Sonnet 5.5 rejects non-default sampling params (temperature etc.) and - # thinking tokens count toward max_tokens, so leave headroom. - # output_config is sent via extra_body because the pinned SDK (0.58.2) - # predates the named parameter. + # Sampling params (temperature etc.) are rejected on API version + # 2026-10-21, and thinking tokens count toward max_tokens, so leave headroom. self.base_params = { "model": self.model, "max_tokens": 4096, - "extra_body": {"output_config": {"effort": "low"}} + "output_config": {"effort": "low"} } def generate_response(self, query: str, diff --git a/pyproject.toml b/pyproject.toml index 3f05e2de0..fa68b37b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ readme = "README.md" requires-python = ">=3.13" dependencies = [ "chromadb==1.0.15", - "anthropic==0.58.2", + "anthropic==2.14.0", "sentence-transformers==5.0.0", "fastapi==0.116.1", "uvicorn==0.35.0", diff --git a/uv.lock b/uv.lock index 9ae65c557..a47ba5915 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 5 requires-python = ">=3.13" [[package]] @@ -13,33 +13,34 @@ wheels = [ [[package]] name = "anthropic" -version = "0.58.2" +version = "2.14.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, - { name = "distro" }, - { name = "httpx" }, + { name = "docstring-parser" }, + { name = "httpx2" }, { name = "jiter" }, + { name = "opentelemetry-api" }, { name = "pydantic" }, { name = "sniffio" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/95/b9/ab06c586aa5a5e7499017cee5ebab94ee260e75975c45395f32b8592abdd/anthropic-0.58.2.tar.gz", hash = "sha256:86396cc45530a83acea25ae6bca9f86656af81e3d598b4d22a1300e0e4cf8df8", size = 425125, upload-time = "2025-07-18T13:38:55.94Z" } +sdist = { url = "https://files.pythonhosted.org/packages/ae/ca/714857a41e333b9292b1db0d642d46256d27b3efe4697df642286ca23ad9/anthropic-2.14.0.tar.gz", hash = "sha256:afb02f4df8efba429ff769bbfd71340d8b244b41ba42c073a45cc307702549fe", size = 2090851, upload-time = "2026-11-24T21:01:49.208Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/d0/f2/68d908ff308c9a65af5749ec31952e01d32f19ea073b0268affc616e6ebc/anthropic-0.58.2-py3-none-any.whl", hash = "sha256:3742181c634c725f337b71096839b6404145e33a8e190c75387c4028b825864d", size = 292896, upload-time = "2025-07-18T13:38:54.782Z" }, + { url = "https://files.pythonhosted.org/packages/5d/27/8bbae12e619497c651f35fec779389ab04e6b7b92b022f94390ec82be973/anthropic-2.14.0-py3-none-any.whl", hash = "sha256:5cf986851f61c0858ac88c6f7c28490369a68ff4a89c309849605b764da0664d", size = 2726387, upload-time = "2026-11-24T21:01:46.861Z" }, ] [[package]] name = "anyio" -version = "4.9.0" +version = "4.16.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "idna" }, - { name = "sniffio" }, + { name = "typing-extensions", marker = "python_full_version < '3.15'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/95/7d/4c1bd541d4dffa1b52bd83fb8527089e097a106fc90b467a7313b105f840/anyio-4.9.0.tar.gz", hash = "sha256:673c0c244e15788651a4ff38710fea9675823028a6f08a5eda409e0c9840a028", size = 190949, upload-time = "2025-03-17T00:02:54.77Z" } +sdist = { url = "https://files.pythonhosted.org/packages/a1/98/7e457a3b014976887a050561955c0b76e1e7e2d6e27b78ecef2ef80518f2/anyio-4.16.0.tar.gz", hash = "sha256:59bb03251907983d1603d27c3087ddb1e93299ea2163adcdba37899a4fb12ffb", size = 310971, upload-time = "2026-11-01T11:20:07.282Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/a1/ee/48ca1a7c89ffec8b6a0c5d02b89c305671d5ffd8d3c94acf8b8c408575bb/anyio-4.9.0-py3-none-any.whl", hash = "sha256:9f76d541cad6e36af7beb62e978876f3b41e3e04f2c1fbf0884604c0a9c4d93c", size = 100916, upload-time = "2025-03-17T00:02:52.713Z" }, + { url = "https://files.pythonhosted.org/packages/a9/16/7757fb84c819accc7d7e9af5291b261e4abb8627ee040f99e7d35ef2457a/anyio-4.16.0-py3-none-any.whl", hash = "sha256:c66ae634e0b8228396b801741beb3294326d4b6102f7bba4041c0dfb58c29026", size = 134521, upload-time = "2026-11-01T11:20:05.59Z" }, ] [[package]] @@ -248,6 +249,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2", size = 20277, upload-time = "2023-12-24T09:54:30.421Z" }, ] +[[package]] +name = "docstring-parser" +version = "0.18.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e0/4d/f332313098c1de1b2d2ff91cf2674415cc7cddab2ca1b01ae29774bd5fdf/docstring_parser-0.18.0.tar.gz", hash = "sha256:292510982205c12b1248696f44959db3cdd1740237a968ea1e2e7a900eeb2015", size = 29341, upload-time = "2026-04-14T04:09:19.867Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a7/5f/ed01f9a3cdffbd5a008556fc7b2a08ddb1cc6ace7effa7340604b1d16699/docstring_parser-0.18.0-py3-none-any.whl", hash = "sha256:b3fcbed555c47d8479be0796ef7e19c2670d428d72e96da63f3a40122860374b", size = 22484, upload-time = "2026-04-14T04:09:18.638Z" }, +] + [[package]] name = "durationpy" version = "0.10" @@ -379,6 +389,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784, upload-time = "2025-04-24T22:06:20.566Z" }, ] +[[package]] +name = "httpcore2" +version = "2.16.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "h11" }, + { name = "truststore" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/92/9d/df40b41f7db0370f82019820709244e7b660c52aa3da3c9e5c4e8141f6e6/httpcore2-2.16.2.tar.gz", hash = "sha256:6c519d0f7b44f7269fa9bbb4d2763db395a4a2370f046d8e8e0a4b38227815d2", size = 70064, upload-time = "2026-11-16T10:12:19.491Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/e8/009c347feac27f8960605aa98d55ed263b5870dd4fd80b82fd1d00d5716c/httpcore2-2.16.2-py3-none-any.whl", hash = "sha256:16051ae2a42f776007543f32de9349a317b23d2cbb4e1456b4bac0e88b87419a", size = 85551, upload-time = "2026-11-16T10:12:16.674Z" }, +] + [[package]] name = "httptools" version = "0.6.4" @@ -409,6 +432,31 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517, upload-time = "2024-12-06T15:37:21.509Z" }, ] +[[package]] +name = "httpx2" +version = "2.16.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio", marker = "sys_platform != 'emscripten'" }, + { name = "httpcore2", marker = "sys_platform != 'emscripten'" }, + { name = "httpx2-jsfetch", marker = "sys_platform == 'emscripten'" }, + { name = "idna" }, + { name = "truststore", marker = "sys_platform != 'emscripten'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/1c/77/6515121dc5ac3c743ad1bff5afe635bcd1a3f23cc40db3c5c89f7d02917d/httpx2-2.16.2.tar.gz", hash = "sha256:748b615678f07d8e3b183efe81ad13b655ca88bfc56ce4589219b2d442860574", size = 103370, upload-time = "2026-11-16T10:12:20.49Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/77/de/8c4306a3d6aa2495111986addf33a9e561eff4c47552e4c4b9251160d0ad/httpx2-2.16.2-py3-none-any.whl", hash = "sha256:f05c13aade4c45dbf1c9060647a1058f0acad62398fad96e741269edb33d46f5", size = 97893, upload-time = "2026-11-16T10:12:18.192Z" }, +] + +[[package]] +name = "httpx2-jsfetch" +version = "1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/cd/c4/0e5636363151a2a1795e0a77617168b9ca438e1748ec05fc9b5687f93d64/httpx2_jsfetch-1.0.tar.gz", hash = "sha256:70a0e3eabfef7cce5ad9c629f7d01ca05e418f586646f4ddf14782e4c1454c60", size = 6872, upload-time = "2026-08-07T00:13:07.492Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9b/43/832f631d32e4f1211caa2ba368317739fe71f0b8530e4c9d15dc454bac2a/httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32", size = 6382, upload-time = "2026-08-07T00:13:06.567Z" }, +] + [[package]] name = "huggingface-hub" version = "0.33.4" @@ -442,11 +490,11 @@ wheels = [ [[package]] name = "idna" -version = "3.10" +version = "3.20" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/f1/70/7703c29685631f5a7590aa73f1f1d3fa9a380e654b86af429e0934a32f7d/idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9", size = 190490, upload-time = "2024-09-15T18:07:39.745Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f5/08/8eea9d4b8302028f3abb2c0813953f7aec26d33b7a8960ed760e65ff29fa/idna-3.20.tar.gz", hash = "sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44", size = 216463, upload-time = "2026-09-17T14:11:04.752Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442, upload-time = "2024-09-15T18:07:37.964Z" }, + { url = "https://files.pythonhosted.org/packages/58/a2/bb081bab032533a855d44de1d56f8e8426114ff1ba5d1f07a438a0a654f8/idna-3.20-py3-none-any.whl", hash = "sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c", size = 69583, upload-time = "2026-09-17T14:11:03.168Z" }, ] [[package]] @@ -1563,7 +1611,7 @@ dependencies = [ [package.metadata] requires-dist = [ - { name = "anthropic", specifier = "==0.58.2" }, + { name = "anthropic", specifier = "==2.14.0" }, { name = "chromadb", specifier = "==1.0.15" }, { name = "fastapi", specifier = "==0.116.1" }, { name = "python-dotenv", specifier = "==1.1.1" }, @@ -1711,6 +1759,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/28/71/bd20ffcb7a64c753dc2463489a61bf69d531f308e390ad06390268c4ea04/triton-3.3.1-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a3198adb9d78b77818a5388bff89fa72ff36f9da0bc689db2f0a651a67ce6a42", size = 155735832, upload-time = "2025-05-29T23:40:10.522Z" }, ] +[[package]] +name = "truststore" +version = "0.10.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ee/9f/c5201d42a484c061e528825fc8e2d565f5abd50a4ced6fb7d29c4ec99b2b/truststore-0.10.5.tar.gz", hash = "sha256:30d36967ccaded5cbb38d602c433f53600036c79d502f4533a49b60a03bbefcd", size = 28091, upload-time = "2026-10-12T22:27:31.808Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/51/e9/3a7820be2bb0fe53b6bc9c3be26d3d1158004e4c3ab953aa6840b955b1e9/truststore-0.10.5-py3-none-any.whl", hash = "sha256:9aaaedaefaf06d8b206278cf8b5012bc897f485a874503501e12d776df78951c", size = 19017, upload-time = "2026-10-12T22:27:30.377Z" }, +] + [[package]] name = "typer" version = "0.16.0" @@ -1728,11 +1785,11 @@ wheels = [ [[package]] name = "typing-extensions" -version = "4.14.1" +version = "4.16.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/98/5a/da40306b885cc8c09109dc2e1abd358d5684b1425678151cdaed4731c822/typing_extensions-4.14.1.tar.gz", hash = "sha256:38b39f4aeeab64884ce9f74c94263ef78f3c22467c8724005483154c26648d36", size = 107673, upload-time = "2025-07-04T13:28:34.16Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/b5/00/d631e67a838026495268c2f6884f3711a15a9a2a96cd244fdaea53b823fb/typing_extensions-4.14.1-py3-none-any.whl", hash = "sha256:d1e1e3b58374dc93031d6eda2420a48ea44a36c2b4766a4fdeb3710755731d76", size = 43906, upload-time = "2025-07-04T13:28:32.743Z" }, + { url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" }, ] [[package]] From fa2593c566557c016f02ce69eae31b9e1b40adaa Mon Sep 17 00:00:00 2001 From: "Scott M. Litvinoff" Date: Thu, 26 Nov 2026 19:41:12 -0500 Subject: [PATCH 3/3] Add CLAUDE.md with commands, architecture, and Claude API notes Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..69c988980 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,44 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Commands + +Dependencies are managed with `uv` (Python 3.13). Requires `ANTHROPIC_API_KEY` in a root `.env` (see `.env.example`). + +```bash +uv sync # install dependencies +./run.sh # start the server on :8000 +cd backend && uv run uvicorn app:app --reload --port 8000 # same, manually +``` + +- Web UI: http://localhost:8000 · API docs: http://localhost:8000/docs +- There is no test suite, linter, or build step configured. +- The server must be started from `backend/`: paths like `../docs`, `../frontend`, and `./chroma_db` are relative to it. +- Root `main.py` is an unused placeholder; the entry point is `backend/app.py`. + +## Architecture + +A RAG chatbot over course transcripts: FastAPI backend, ChromaDB vector store, Claude via the Anthropic SDK, and a vanilla HTML/JS frontend served as static files by the same FastAPI app. + +**Ingestion (on startup).** `app.py` calls `RAGSystem.add_course_folder("../docs")`. `DocumentProcessor` parses each file, expecting a header of `Course Title:` / `Course Link:` / `Course Instructor:` followed by `Lesson N: ` markers (each optionally followed by `Lesson Link:`). Text is split into sentence-based chunks (`CHUNK_SIZE`/`CHUNK_OVERLAP` in `config.py`) tagged with course title and lesson number. Courses whose title already exists in ChromaDB are skipped, so the persisted DB in `backend/chroma_db/` survives restarts — delete it (or use `clear_existing=True`) to force re-ingestion after changing chunking or document format. Only `.txt` really works despite `.pdf`/`.docx` being accepted. + +**Two ChromaDB collections** (`vector_store.py`), both embedded with `all-MiniLM-L6-v2`: +- `course_catalog` — one entry per course (title is the ID; lessons stored as JSON in metadata). Used to fuzzy-resolve a course name via vector search. +- `course_content` — the chunks, filterable by `course_title` and `lesson_number`. + +**Query flow (tool-based RAG, not retrieve-then-generate).** `POST /api/query` → `RAGSystem.query()` → `AIGenerator.generate_response()`. Claude is given a single tool, `search_course_content` (`search_tools.py`), and decides whether to call it. If it does, `CourseSearchTool` → `VectorStore.search()` resolves the course name against `course_catalog`, then queries `course_content` with metadata filters. Results go back to Claude in a second API call **without tools**, so at most one round of searching happens per query. + +**Sources are passed via side-channel state**: `CourseSearchTool._format_results` stores `last_sources` on the tool instance; `RAGSystem.query()` reads them via `ToolManager.get_last_sources()` and then resets them. New tools that should surface sources must expose a `last_sources` attribute. This shared state is not safe under concurrent requests. + +**Sessions** (`session_manager.py`) are in-memory only (lost on restart) and keep the last `MAX_HISTORY` exchanges. History is injected as plain text into the system prompt, not as message turns. The frontend gets its `session_id` from the first response and sends it back on later queries. + +**Adding a tool**: subclass `Tool` in `search_tools.py` (implement `get_tool_definition()` returning an Anthropic tool schema and `execute(**kwargs)`), then register it with `tool_manager.register_tool()` in `RAGSystem.__init__`. + +## Claude API notes + +- Model is set in `config.py` (`claude-sonnet-5-5`); SDK is `anthropic` 2.x, which sends API version `2026-10-21`. +- Do not add `temperature`/`top_p`/`top_k` — they are rejected on this API version. +- Thinking is on by default, so responses can contain `thinking` blocks before text; always extract text via `AIGenerator._extract_text()` rather than `response.content[0].text`. Thinking tokens count toward `max_tokens`. +- Effort is set via `output_config={"effort": "low"}` in `AIGenerator.base_params`. +- `backend/ai_generator.py` uses CRLF line endings; preserve them when editing.