feat(localization): add Turkish curriculum pipeline - #367
Conversation
|
Important Review skippedToo many files! This PR contains 878 files, which is 578 over the limit of 300. To get a review, narrow the scope: Usage-priced reviews support at most 300 files. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (878)
You can disable this status message by setting the 📝 WalkthroughWalkthroughAdds a Turkish curriculum localization pipeline with protected-token validation, terminology checks, tests, and CI integration. Localizes Turkish metadata, navigation, content, accessibility text, dynamic UI messages, and interactive labels across the site, and adds Turkish translations for lesson documentation across every curriculum phase (00–19). ChangesTurkish localization
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests (beta)
|
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/localize_curriculum.py`:
- Around line 124-125: Update the localization flow around validate_pair to
validate the rendered translation text in memory before modifying target. Pass
the generated content to validation first, then call target.write_text only when
validation succeeds, preserving the existing validation behavior and preventing
invalid output from being written.
- Around line 70-88: Update make_bundle in scripts/localize_curriculum.py
(70-88) to preserve Markdown heading, list, and blockquote prefixes separately
from translatable prose, and recognize both backtick and tilde fenced blocks.
Update the source/target validation logic in scripts/localize_curriculum.py
(128-151) to compare these structural prefixes and both fence styles. Add
regressions in scripts/tests/test_localize_curriculum.py (31-34) covering
tilde-fenced code and altered heading/list markers.
- Around line 112-115: Update apply_bundle to validate each record against the
exact source/target pairs returned by sources(root) before constructing or
writing paths. Reject records whose source or target does not match the expected
pair, including absolute paths or traversal via .., and only then resolve the
approved paths beneath root.
- Around line 107-109: Update the placeholder restoration loop in the
surrounding localization function to use a single re.sub() callback that maps
each matched {{Pn}} token directly to unit["protected"][n], preventing restored
literals from being processed again. Add a regression test covering a protected
literal that resembles another placeholder, and verify it remains unchanged
after restoration.
In `@site/catalog.html`:
- Around line 266-270: Add an option with value "in-progress" and the label
"Devam ediyor" to the catalogStatus select, alongside the existing complete and
planned options, so users can filter in-progress lessons consistently with the
renderer and homepage legend.
In `@site/index.html`:
- Around line 894-899: Standardize the shared navigation labels in the index
page to match the canonical terminology used by the other pages: use consistent
labels for the contents, catalog/courses, and glossary destinations in both
navigation blocks, including the additional block referenced by the review.
- Line 902: Translate the accessible labels in the star-count element and the
related controls to Turkish, including “GitHub stars,” “Star ... on GitHub,” and
“Follow ... on GitHub.” Update the labels at the referenced elements
consistently with the wording used by the visible Turkish controls.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4b9363bb-f241-4648-ad8b-58fcde9ad0dd
📒 Files selected for processing (11)
.github/workflows/curriculum.ymldocs/translation-guide-tr.mdscripts/localize_curriculum.pyscripts/tests/test_localize_curriculum.pysite/about.htmlsite/catalog.htmlsite/cmdpalette.jssite/glossary.htmlsite/index.htmlsite/lesson.htmlsite/prereqs.html
| for index, original in enumerate(unit["protected"]): | ||
| value = value.replace(f"{{{{P{index}}}}}", original) | ||
| return value |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Avoid recursive placeholder restoration.
A protected literal such as {{P1}} can be restored by {{P0}} and then mistakenly replaced again in the next loop iteration. Restore placeholders with one re.sub() callback instead of sequential str.replace() calls, and add a regression test.
Proposed fix
- for index, original in enumerate(unit["protected"]):
- value = value.replace(f"{{{{P{index}}}}}", original)
- return value
+ return re.sub(
+ r"\{\{P(\d+)\}\}",
+ lambda match: unit["protected"][int(match.group(1))],
+ value,
+ )📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| for index, original in enumerate(unit["protected"]): | |
| value = value.replace(f"{{{{P{index}}}}}", original) | |
| return value | |
| return re.sub( | |
| r"\{\{P(\d+)\}\}", | |
| lambda match: unit["protected"][int(match.group(1))], | |
| value, | |
| ) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/localize_curriculum.py` around lines 107 - 109, Update the
placeholder restoration loop in the surrounding localization function to use a
single re.sub() callback that maps each matched {{Pn}} token directly to
unit["protected"][n], preventing restored literals from being processed again.
Add a regression test covering a protected literal that resembles another
placeholder, and verify it remains unchanged after restoration.
| def apply_bundle(bundle: dict, root: Path = ROOT) -> None: | ||
| for record in bundle["files"]: | ||
| source = root / record["source"] | ||
| target = root / record["target"] |
There was a problem hiding this comment.
🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win
Restrict bundle records to known curriculum source/target pairs.
record["target"] can be absolute or contain ..; root / record["target"] then writes outside the repository. A crafted bundle can use a valid curriculum source hash and overwrite any file writable by the caller. Resolve records through sources(root) and reject any source or target that is not the exact expected pair.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/localize_curriculum.py` around lines 112 - 115, Update apply_bundle
to validate each record against the exact source/target pairs returned by
sources(root) before constructing or writing paths. Reject records whose source
or target does not match the expected pair, including absolute paths or
traversal via .., and only then resolve the approved paths beneath root.
| target.write_text("".join(lines)) | ||
| validate_pair(source, target) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Validate generated content before overwriting the target.
Line 124 writes the translation before Line 125 detects structural/token failures, leaving an invalid or partially updated target behind. Validate the rendered text in memory first, then write only after validation succeeds.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/localize_curriculum.py` around lines 124 - 125, Update the
localization flow around validate_pair to validate the rendered translation text
in memory before modifying target. Pass the generated content to validation
first, then call target.write_text only when validation succeeds, preserving the
existing validation behavior and preventing invalid output from being written.
| <select class="catalog-filter" id="catalogStatus"> | ||
| <option value="">All Status</option> | ||
| <option value="complete">Complete</option> | ||
| <option value="planned">Planned</option> | ||
| <option value="">Tüm Durumlar</option> | ||
| <option value="complete">Tamamlandı</option> | ||
| <option value="planned">Planlandı</option> | ||
| </select> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add the in-progress status filter option.
The renderer handles r.status === 'in-progress' on Lines 435-436, and site/index.html exposes “Devam ediyor” on Lines 987-989, but this filter only offers complete and planned. Users cannot filter in-progress lessons.
Proposed fix
<option value="complete">Tamamlandı</option>
+ <option value="in-progress">Devam Ediyor</option>
<option value="planned">Planlandı</option>Based on the supplied status rendering and homepage status legend.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <select class="catalog-filter" id="catalogStatus"> | |
| <option value="">All Status</option> | |
| <option value="complete">Complete</option> | |
| <option value="planned">Planned</option> | |
| <option value="">Tüm Durumlar</option> | |
| <option value="complete">Tamamlandı</option> | |
| <option value="planned">Planlandı</option> | |
| </select> | |
| <select class="catalog-filter" id="catalogStatus"> | |
| <option value="">Tüm Durumlar</option> | |
| <option value="complete">Tamamlandı</option> | |
| <option value="in-progress">Devam Ediyor</option> | |
| <option value="planned">Planlandı</option> | |
| </select> |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@site/catalog.html` around lines 266 - 270, Add an option with value
"in-progress" and the label "Devam ediyor" to the catalogStatus select,
alongside the existing complete and planned options, so users can filter
in-progress lessons consistently with the renderer and homepage legend.
|
Someone is attempting to deploy a commit to the OSS program Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Actionable comments posted: 12
Note
Due to the large number of review comments, Critical severity comments were prioritized as inline comments.
🧹 Nitpick comments (4)
phases/07-transformers-deep-dive/12-kv-cache-flash-attention/docs/tr.md (1)
182-188: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winUse the documented dtype form in the Transformers example.
Import
torchand usetorch_dtype=torch.bfloat16; the official FlashAttention-2 example uses this form and requires fp16/bf16-compatible loading. (huggingface.co)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@phases/07-transformers-deep-dive/12-kv-cache-flash-attention/docs/tr.md` around lines 182 - 188, Update the Transformers example around AutoModelForCausalLM to import torch and pass torch.bfloat16 as the torch_dtype value instead of the string "bfloat16". Keep the existing model name and attn_implementation settings unchanged.phases/05-nlp-foundations-to-advanced/29-dialogue-state-tracking/docs/tr.md (1)
35-35: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winQualify and cite the “83%” JGA claim.
MultiWOZ 2.4 scores vary by model, domain, split, and evaluation script; the canonical dataset paper reports substantially different figures across systems. Cite the exact result and evaluation setup instead of presenting 83% as a general 2026 ceiling. (github.com)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@phases/05-nlp-foundations-to-advanced/29-dialogue-state-tracking/docs/tr.md` at line 35, Update the “Metrik” paragraph’s MultiWOZ 2.4 JGA statement to identify the specific model, domains or split, and evaluation script underlying the percentage, and add a citation to the corresponding result. Do not present 83% as a general 2026 ceiling; if no precise source supports it, replace or remove the claim.phases/14-agent-engineering/24-agent-observability-platforms/docs/tr.md (1)
48-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCite or remove the Maxim market statistic.
The claim that 89% of organizations have agent observability is attributed only to “Maxim” and has no corresponding source in the reading list. Add the report citation or present this as an explicitly unverified estimate.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@phases/14-agent-engineering/24-agent-observability-platforms/docs/tr.md` at line 48, Update the “Maxim'e göre (2026 saha analizi)” statistic in the observability content by either adding the corresponding Maxim report citation to the reading list and linking the claim to it, or clearly labeling the figures as an unverified estimate. Do not leave the 89% and 32% figures attributed to Maxim without supporting source information.Source: Coding guidelines
phases/13-tools-and-protocols/18-mcp-auth-production/docs/tr.md (1)
168-182: 🔒 Security & Privacy | 🔵 Trivial | 🏗️ Heavy liftVersion and source the IdP capability matrix before using it as a deployment gate.
The table makes vendor-specific claims about CIMD, DCR, RFC 8707, and PKCE support, but provides no product versions, verification date, or test source. A stale row can cause false deployment rejection or create incorrect security assumptions. Add dated per-vendor evidence or label the matrix illustrative and require live capability checks.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@phases/13-tools-and-protocols/18-mcp-auth-production/docs/tr.md` around lines 168 - 182, Update the “IdP yetenek matrisi” section to either add dated, per-vendor product/version evidence and test sources for the CIMD, DCR, RFC 8707, and PKCE claims, or clearly label the matrix as illustrative rather than authoritative. Preserve the deployment gate by requiring live capability checks, especially validating S256 support and at least one registration path, instead of relying solely on stale table entries.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9b022c0a-7a63-407b-870a-a1264efdf1d5
📒 Files selected for processing (218)
phases/00-setup-and-tooling/01-dev-environment/docs/tr.mdphases/00-setup-and-tooling/02-git-and-collaboration/docs/tr.mdphases/00-setup-and-tooling/README.tr.mdphases/01-math-foundations/README.tr.mdphases/02-ml-fundamentals/README.tr.mdphases/03-deep-learning-core/README.tr.mdphases/04-computer-vision/README.tr.mdphases/05-nlp-foundations-to-advanced/01-text-processing/docs/tr.mdphases/05-nlp-foundations-to-advanced/02-bag-of-words-tfidf/docs/tr.mdphases/05-nlp-foundations-to-advanced/03-word-embeddings-word2vec/docs/tr.mdphases/05-nlp-foundations-to-advanced/04-glove-fasttext-subword/docs/tr.mdphases/05-nlp-foundations-to-advanced/05-sentiment-analysis/docs/tr.mdphases/05-nlp-foundations-to-advanced/06-named-entity-recognition/docs/tr.mdphases/05-nlp-foundations-to-advanced/07-pos-tagging-parsing/docs/tr.mdphases/05-nlp-foundations-to-advanced/08-cnns-rnns-for-text/docs/tr.mdphases/05-nlp-foundations-to-advanced/09-sequence-to-sequence/docs/tr.mdphases/05-nlp-foundations-to-advanced/10-attention-mechanism/docs/tr.mdphases/05-nlp-foundations-to-advanced/11-machine-translation/docs/tr.mdphases/05-nlp-foundations-to-advanced/12-text-summarization/docs/tr.mdphases/05-nlp-foundations-to-advanced/13-question-answering/docs/tr.mdphases/05-nlp-foundations-to-advanced/14-information-retrieval-search/docs/tr.mdphases/05-nlp-foundations-to-advanced/15-topic-modeling/docs/tr.mdphases/05-nlp-foundations-to-advanced/16-text-generation-pre-transformer/docs/tr.mdphases/05-nlp-foundations-to-advanced/17-chatbots-rule-to-neural/docs/tr.mdphases/05-nlp-foundations-to-advanced/18-multilingual-nlp/docs/tr.mdphases/05-nlp-foundations-to-advanced/19-subword-tokenization/docs/tr.mdphases/05-nlp-foundations-to-advanced/20-structured-outputs-constrained-decoding/docs/tr.mdphases/05-nlp-foundations-to-advanced/21-nli-textual-entailment/docs/tr.mdphases/05-nlp-foundations-to-advanced/22-embedding-models-deep-dive/docs/tr.mdphases/05-nlp-foundations-to-advanced/23-chunking-strategies-rag/docs/tr.mdphases/05-nlp-foundations-to-advanced/24-coreference-resolution/docs/tr.mdphases/05-nlp-foundations-to-advanced/25-entity-linking/docs/tr.mdphases/05-nlp-foundations-to-advanced/26-relation-extraction-kg/docs/tr.mdphases/05-nlp-foundations-to-advanced/27-llm-evaluation-frameworks/docs/tr.mdphases/05-nlp-foundations-to-advanced/28-long-context-evaluation/docs/tr.mdphases/05-nlp-foundations-to-advanced/29-dialogue-state-tracking/docs/tr.mdphases/05-nlp-foundations-to-advanced/README.tr.mdphases/06-speech-and-audio/01-audio-fundamentals/docs/tr.mdphases/06-speech-and-audio/02-spectrograms-mel-features/docs/tr.mdphases/06-speech-and-audio/03-audio-classification/docs/tr.mdphases/06-speech-and-audio/04-speech-recognition-asr/docs/tr.mdphases/06-speech-and-audio/05-whisper-architecture-finetuning/docs/tr.mdphases/06-speech-and-audio/06-speaker-recognition-verification/docs/tr.mdphases/06-speech-and-audio/07-text-to-speech/docs/tr.mdphases/06-speech-and-audio/08-voice-cloning-conversion/docs/tr.mdphases/06-speech-and-audio/09-music-generation/docs/tr.mdphases/06-speech-and-audio/10-audio-language-models/docs/tr.mdphases/06-speech-and-audio/11-real-time-audio-processing/docs/tr.mdphases/06-speech-and-audio/12-voice-assistant-pipeline/docs/tr.mdphases/06-speech-and-audio/13-neural-audio-codecs/docs/tr.mdphases/06-speech-and-audio/14-voice-activity-detection-turn-taking/docs/tr.mdphases/06-speech-and-audio/15-streaming-speech-to-speech-moshi-hibiki/docs/tr.mdphases/06-speech-and-audio/16-anti-spoofing-audio-watermarking/docs/tr.mdphases/06-speech-and-audio/17-audio-evaluation-metrics/docs/tr.mdphases/06-speech-and-audio/README.tr.mdphases/07-transformers-deep-dive/01-why-transformers/docs/tr.mdphases/07-transformers-deep-dive/02-self-attention-from-scratch/docs/tr.mdphases/07-transformers-deep-dive/03-multi-head-attention/docs/tr.mdphases/07-transformers-deep-dive/04-positional-encoding/docs/tr.mdphases/07-transformers-deep-dive/05-full-transformer/docs/tr.mdphases/07-transformers-deep-dive/06-bert-masked-language-modeling/docs/tr.mdphases/07-transformers-deep-dive/07-gpt-causal-language-modeling/docs/tr.mdphases/07-transformers-deep-dive/08-t5-bart-encoder-decoder/docs/tr.mdphases/07-transformers-deep-dive/09-vision-transformers/docs/tr.mdphases/07-transformers-deep-dive/10-audio-transformers-whisper/docs/tr.mdphases/07-transformers-deep-dive/11-mixture-of-experts/docs/tr.mdphases/07-transformers-deep-dive/12-kv-cache-flash-attention/docs/tr.mdphases/07-transformers-deep-dive/13-scaling-laws/docs/tr.mdphases/07-transformers-deep-dive/14-build-a-transformer-capstone/docs/tr.mdphases/07-transformers-deep-dive/15-attention-variants/docs/tr.mdphases/07-transformers-deep-dive/16-speculative-decoding/docs/tr.mdphases/07-transformers-deep-dive/README.tr.mdphases/08-generative-ai/01-generative-models-taxonomy-history/docs/tr.mdphases/08-generative-ai/02-autoencoders-vae/docs/tr.mdphases/08-generative-ai/03-gans-generator-discriminator/docs/tr.mdphases/08-generative-ai/04-conditional-gans-pix2pix/docs/tr.mdphases/08-generative-ai/05-stylegan/docs/tr.mdphases/08-generative-ai/06-diffusion-ddpm-from-scratch/docs/tr.mdphases/08-generative-ai/07-latent-diffusion-stable-diffusion/docs/tr.mdphases/08-generative-ai/08-controlnet-lora-conditioning/docs/tr.mdphases/08-generative-ai/09-inpainting-outpainting-editing/docs/tr.mdphases/08-generative-ai/10-video-generation/docs/tr.mdphases/08-generative-ai/11-audio-generation/docs/tr.mdphases/08-generative-ai/12-3d-generation/docs/tr.mdphases/08-generative-ai/13-flow-matching-rectified-flows/docs/tr.mdphases/08-generative-ai/14-evaluation-fid-clip-score/docs/tr.mdphases/08-generative-ai/19-visual-autoregressive-var/docs/tr.mdphases/08-generative-ai/README.tr.mdphases/09-reinforcement-learning/01-mdps-states-actions-rewards/docs/tr.mdphases/09-reinforcement-learning/02-dynamic-programming/docs/tr.mdphases/09-reinforcement-learning/03-monte-carlo-methods/docs/tr.mdphases/09-reinforcement-learning/04-q-learning-sarsa/docs/tr.mdphases/09-reinforcement-learning/05-dqn/docs/tr.mdphases/09-reinforcement-learning/06-policy-gradients-reinforce/docs/tr.mdphases/09-reinforcement-learning/07-actor-critic-a2c-a3c/docs/tr.mdphases/09-reinforcement-learning/08-ppo/docs/tr.mdphases/09-reinforcement-learning/09-reward-modeling-rlhf/docs/tr.mdphases/09-reinforcement-learning/10-multi-agent-rl/docs/tr.mdphases/09-reinforcement-learning/11-sim-to-real-transfer/docs/tr.mdphases/09-reinforcement-learning/12-rl-for-games/docs/tr.mdphases/09-reinforcement-learning/README.tr.mdphases/10-llms-from-scratch/README.tr.mdphases/11-llm-engineering/01-prompt-engineering/docs/tr.mdphases/11-llm-engineering/02-few-shot-cot/docs/tr.mdphases/11-llm-engineering/03-structured-outputs/docs/tr.mdphases/11-llm-engineering/04-embeddings/docs/tr.mdphases/11-llm-engineering/05-context-engineering/docs/tr.mdphases/11-llm-engineering/06-rag/docs/tr.mdphases/11-llm-engineering/07-advanced-rag/docs/tr.mdphases/11-llm-engineering/08-fine-tuning-lora/docs/tr.mdphases/11-llm-engineering/09-function-calling/docs/tr.mdphases/11-llm-engineering/10-evaluation/docs/tr.mdphases/11-llm-engineering/11-caching-cost/docs/tr.mdphases/11-llm-engineering/12-guardrails/docs/tr.mdphases/11-llm-engineering/13-production-app/docs/tr.mdphases/11-llm-engineering/14-model-context-protocol/docs/tr.mdphases/11-llm-engineering/15-prompt-caching/docs/tr.mdphases/11-llm-engineering/16-langgraph-state-machines/docs/tr.mdphases/11-llm-engineering/17-agent-framework-tradeoffs/docs/tr.mdphases/11-llm-engineering/README.tr.mdphases/12-multimodal-ai/01-vision-transformer-patch-tokens/docs/tr.mdphases/12-multimodal-ai/02-clip-contrastive-pretraining/docs/tr.mdphases/12-multimodal-ai/03-blip2-qformer-bridge/docs/tr.mdphases/12-multimodal-ai/04-flamingo-gated-cross-attention/docs/tr.mdphases/12-multimodal-ai/05-llava-visual-instruction-tuning/docs/tr.mdphases/12-multimodal-ai/06-any-resolution-patch-n-pack/docs/tr.mdphases/12-multimodal-ai/07-open-weight-vlm-recipes/docs/tr.mdphases/12-multimodal-ai/08-llava-onevision-single-multi-video/docs/tr.mdphases/12-multimodal-ai/09-qwen-vl-family-dynamic-fps/docs/tr.mdphases/12-multimodal-ai/10-internvl3-native-multimodal/docs/tr.mdphases/12-multimodal-ai/11-chameleon-early-fusion-tokens/docs/tr.mdphases/12-multimodal-ai/12-emu3-next-token-for-generation/docs/tr.mdphases/12-multimodal-ai/13-transfusion-autoregressive-diffusion/docs/tr.mdphases/12-multimodal-ai/14-show-o-discrete-diffusion-unified/docs/tr.mdphases/12-multimodal-ai/15-janus-pro-decoupled-encoders/docs/tr.mdphases/12-multimodal-ai/16-mio-any-to-any-streaming/docs/tr.mdphases/12-multimodal-ai/17-video-language-temporal-grounding/docs/tr.mdphases/12-multimodal-ai/18-long-video-million-token/docs/tr.mdphases/12-multimodal-ai/19-audio-language-whisper-to-af3/docs/tr.mdphases/12-multimodal-ai/20-omni-models-thinker-talker/docs/tr.mdphases/12-multimodal-ai/21-embodied-vlas-openvla-pi0-groot/docs/tr.mdphases/12-multimodal-ai/22-document-diagram-understanding/docs/tr.mdphases/12-multimodal-ai/23-colpali-vision-native-rag/docs/tr.mdphases/12-multimodal-ai/24-multimodal-rag-cross-modal/docs/tr.mdphases/12-multimodal-ai/25-multimodal-agents-computer-use/docs/tr.mdphases/12-multimodal-ai/README.tr.mdphases/13-tools-and-protocols/01-the-tool-interface/docs/tr.mdphases/13-tools-and-protocols/02-function-calling-deep-dive/docs/tr.mdphases/13-tools-and-protocols/03-parallel-and-streaming-tool-calls/docs/tr.mdphases/13-tools-and-protocols/04-structured-output/docs/tr.mdphases/13-tools-and-protocols/05-tool-schema-design/docs/tr.mdphases/13-tools-and-protocols/06-mcp-fundamentals/docs/tr.mdphases/13-tools-and-protocols/07-building-an-mcp-server/docs/tr.mdphases/13-tools-and-protocols/08-building-an-mcp-client/docs/tr.mdphases/13-tools-and-protocols/09-mcp-transports/docs/tr.mdphases/13-tools-and-protocols/10-mcp-resources-and-prompts/docs/tr.mdphases/13-tools-and-protocols/11-mcp-sampling/docs/tr.mdphases/13-tools-and-protocols/12-mcp-roots-and-elicitation/docs/tr.mdphases/13-tools-and-protocols/13-mcp-async-tasks/docs/tr.mdphases/13-tools-and-protocols/14-mcp-apps/docs/tr.mdphases/13-tools-and-protocols/15-mcp-security-tool-poisoning/docs/tr.mdphases/13-tools-and-protocols/16-mcp-security-oauth-2-1/docs/tr.mdphases/13-tools-and-protocols/17-mcp-gateways-and-registries/docs/tr.mdphases/13-tools-and-protocols/18-mcp-auth-production/docs/tr.mdphases/13-tools-and-protocols/19-a2a-protocol/docs/tr.mdphases/13-tools-and-protocols/20-opentelemetry-genai/docs/tr.mdphases/13-tools-and-protocols/21-llm-routing-layer/docs/tr.mdphases/13-tools-and-protocols/22-skills-and-agent-sdks/docs/tr.mdphases/13-tools-and-protocols/23-capstone-tool-ecosystem/docs/tr.mdphases/13-tools-and-protocols/README.tr.mdphases/14-agent-engineering/01-the-agent-loop/docs/tr.mdphases/14-agent-engineering/02-rewoo-plan-and-execute/docs/tr.mdphases/14-agent-engineering/03-reflexion-verbal-rl/docs/tr.mdphases/14-agent-engineering/04-tree-of-thoughts-lats/docs/tr.mdphases/14-agent-engineering/05-self-refine-and-critic/docs/tr.mdphases/14-agent-engineering/06-tool-use-and-function-calling/docs/tr.mdphases/14-agent-engineering/07-memory-virtual-context-memgpt/docs/tr.mdphases/14-agent-engineering/08-memory-blocks-sleep-time-compute/docs/tr.mdphases/14-agent-engineering/09-hybrid-memory-mem0/docs/tr.mdphases/14-agent-engineering/10-skill-libraries-voyager/docs/tr.mdphases/14-agent-engineering/11-planning-htn-and-evolutionary/docs/tr.mdphases/14-agent-engineering/12-anthropic-workflow-patterns/docs/tr.mdphases/14-agent-engineering/13-langgraph-stateful-graphs/docs/tr.mdphases/14-agent-engineering/14-autogen-actor-model/docs/tr.mdphases/14-agent-engineering/15-crewai-role-based-crews/docs/tr.mdphases/14-agent-engineering/16-openai-agents-sdk/docs/tr.mdphases/14-agent-engineering/17-claude-agent-sdk/docs/tr.mdphases/14-agent-engineering/18-agno-and-mastra-runtimes/docs/tr.mdphases/14-agent-engineering/19-benchmarks-swebench-gaia/docs/tr.mdphases/14-agent-engineering/20-benchmarks-webarena-osworld/docs/tr.mdphases/14-agent-engineering/21-computer-use-agents/docs/tr.mdphases/14-agent-engineering/22-voice-agents-pipecat-livekit/docs/tr.mdphases/14-agent-engineering/23-otel-genai-conventions/docs/tr.mdphases/14-agent-engineering/24-agent-observability-platforms/docs/tr.mdphases/14-agent-engineering/25-multi-agent-debate/docs/tr.mdphases/14-agent-engineering/26-failure-modes-agentic/docs/tr.mdphases/14-agent-engineering/27-prompt-injection-defense/docs/tr.mdphases/14-agent-engineering/28-orchestration-patterns/docs/tr.mdphases/14-agent-engineering/29-production-runtimes/docs/tr.mdphases/14-agent-engineering/30-eval-driven-agent-development/docs/tr.mdphases/14-agent-engineering/31-agent-workbench-why-models-fail/docs/tr.mdphases/14-agent-engineering/32-minimal-agent-workbench/docs/tr.mdphases/14-agent-engineering/33-instructions-as-executable-constraints/docs/tr.mdphases/14-agent-engineering/34-repo-memory-and-state/docs/tr.mdphases/14-agent-engineering/35-initialization-scripts/docs/tr.mdphases/14-agent-engineering/36-scope-contracts/docs/tr.mdphases/14-agent-engineering/37-runtime-feedback-loops/docs/tr.mdphases/14-agent-engineering/38-verification-gates/docs/tr.mdphases/14-agent-engineering/39-reviewer-agent/docs/tr.mdphases/14-agent-engineering/40-multi-session-handoff/docs/tr.mdphases/14-agent-engineering/41-workbench-for-real-repos/docs/tr.mdphases/14-agent-engineering/42-agent-workbench-capstone/docs/tr.mdphases/14-agent-engineering/README.tr.mdphases/15-autonomous-systems/README.tr.mdphases/16-multi-agent-and-swarms/README.tr.mdphases/17-infrastructure-and-production/README.tr.mdphases/18-ethics-safety-alignment/README.tr.mdphases/19-capstone-projects/README.tr.md
| from transformers import AutoTokenizer, AutoModelForSequenceClassification | ||
|
|
||
| tok = AutoTokenizer.from_pretrained("Babelscape/rebel-large") | ||
| model = AutoModelForSequenceClassification.from_pretrained("Babelscape/rebel-large") | ||
|
|
||
| text = "Tim Cook was born in Alabama. He later became CEO of Apple." | ||
| encoded = tok(text, return_tensors="pt", truncation=True) | ||
| output = model.generate(**encoded, max_length=200) | ||
| triples = tok.batch_decode(output, skip_special_tokens=False) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Target excerpt:"
sed -n '60,85p' phases/05-nlp-foundations-to-advanced/26-relation-extraction-kg/docs/tr.md || true
echo
echo "Search for REBEL imports/usages in repository:"
rg -n 'AutoModel|SequenceClassification|Seq2SeqLM|rebel-large|model\.generate' phases/05-nlp-foundations-to-advanced/26-relation-extraction-kg/docs phases/05-nlp-foundations-to-advanced/26-relation-extraction-kg -S || true
echo
echo "Check whether transformers package is available and inspect model config if present:"
python3 - <<'PY'
try:
import transformers
print("transformers", getattr(transformers, "__version__", "unknown"))
from transformers import AutoModelForSequenceClassification, AutoModelForSeq2SeqLM, AutoConfig
for name in ["Babelscape/rebel-large"]:
print("name", name)
for cls in [AutoModelForSequenceClassification, AutoModelForSeq2SeqLM]:
try:
config = AutoConfig.from_pretrained(name, use_safetensors=False)
print(cls.__name__, "config.id2label", getattr(config, "id2label", None), "is_encoder_decoder", getattr(config, "is_encoder_decoder", None), "architectures", getattr(config, "architectures", None), "model_type", getattr(config, "model_type", None))
except Exception as e:
print(cls.__name__, "ERROR", type(e).__name__, str(e))
except Exception as e:
print("import_or_config_ERROR", type(e).__name__, str(e))
PYRepository: rohitg00/ai-engineering-from-scratch
Length of output: 3819
🌐 Web query:
Hugging Face Babelscape/rebel-large AutoModelForSeq2SeqLM transformers seq2seq
💡 Result:
The Babelscape/rebel-large model is a sequence-to-sequence (seq2seq) model designed for end-to-end relation extraction [1][2]. It is based on the BART architecture and was presented in the paper, REBEL: Relation Extraction By End-to-end Language generation [1][3][2]. To use this model with the Hugging Face transformers library, you can employ the AutoModelForSeq2SeqLM class, as the model reframes relation extraction as a text-to-text generation task [1][4]. Below is the standard approach for loading and using the model: from transformers import AutoModelForSeq2SeqLM, AutoTokenizer # Load model and tokenizer tokenizer = AutoTokenizer.from_pretrained("Babelscape/rebel-large") model = AutoModelForSeq2SeqLM.from_pretrained("Babelscape/rebel-large") # Example usage with generation parameters gen_kwargs = { "max_length": 256, "length_penalty": 0, "num_beams": 3, "num_return_sequences": 3, } text = "Punta Cana is a resort town in the municipality of Higüey, in La Altagracia Province, the easternmost province of the Dominican Republic." # Tokenize and generate model_inputs = tokenizer(text, max_length=256, padding=True, truncation=True, return_tensors='pt') generated_tokens = model.generate( model_inputs["input_ids"].to(model.device), attention_mask=model_inputs["attention_mask"].to(model.device), gen_kwargs,) # Decode output decoded_preds = tokenizer.batch_decode(generated_tokens, skip_special_tokens=False) [1][4][5] Alternatively, you can use the Hugging Face pipeline for a more concise implementation: from transformers import pipeline triplet_extractor = pipeline("text2text-generation", model="Babelscape/rebel-large", tokenizer="Babelscape/rebel-large") [1][6][7] For more information, you can refer to the official model card on Hugging Face or the accompanying GitHub repository [1][6].
Citations:
- 1: https://huggingface.co/Babelscape/rebel-large
- 2: https://babelscape.com/research/publication/rebel-relation-extraction-by-end-to-end-language-generation
- 3: https://raw.githubusercontent.com/Babelscape/rebel/main/docs/EMNLP_2021_REBEL__Camera_Ready_.pdf
- 4: https://huggingface.co/Babelscape/rebel-large/blob/main/README.md
- 5: https://huggingface.co/Babelscape/rebel-large/raw/b54265a636c21152697edfb7881195b48c32dd21/README.md
- 6: https://github.com/babelscape/rebel
- 7: https://github.com/Babelscape/rebel
Load REBEL as AutoModelForSeq2SeqLM.
Babelscape/rebel-large is a seq2seq generation model, so this code should use AutoModelForSeq2SeqLM; AutoModelForSequenceClassification is not the model class that supports the documented .generate() usage.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@phases/05-nlp-foundations-to-advanced/26-relation-extraction-kg/docs/tr.md`
around lines 69 - 77, Update the REBEL model initialization to use
AutoModelForSeq2SeqLM instead of AutoModelForSequenceClassification, while
preserving the existing tokenizer and model.generate flow.
| ```python | ||
| def q_learning(env, episodes, alpha=0.1, gamma=0.99, epsilon=0.1): | ||
| Q = defaultdict(lambda: {a: 0.0 for a in ACTIONS}) | ||
| for _ in range(episodes): | ||
| s = env.reset() | ||
| while True: | ||
| a = choose(s, Q, epsilon) | ||
| s_next, r, done = env.step(s, a) | ||
| target = r + (gamma * max(Q[s_next].values()) if not done else 0.0) | ||
| Q[s][a] += alpha * (target - Q[s][a]) | ||
| if done: | ||
| break | ||
| s = s_next | ||
| return Q |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Define a Q-learning action-selection helper in this scope.
choose only exists inside sarsa(s), but q_learning calls it with three arguments. This snippet raises NameError before training starts.
Proposed fix
def q_learning(env, episodes, alpha=0.1, gamma=0.99, epsilon=0.1):
Q = defaultdict(lambda: {a: 0.0 for a in ACTIONS})
for _ in range(episodes):
s = env.reset()
while True:
- a = choose(s, Q, epsilon)
+ a = epsilon_greedy(Q, s, epsilon)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@phases/09-reinforcement-learning/04-q-learning-sarsa/docs/tr.md` around lines
87 - 100, Define or reuse a three-argument action-selection helper accessible to
q_learning, ensuring choose(s, Q, epsilon) is available in the same scope before
training begins; do not rely on the choose implementation nested inside
sarsa(s).
| def sample(self, batch, rng): | ||
| return rng.sample(self.buf, batch) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Pass the required RNG to ReplayBuffer.sample.
The method signature is sample(self, batch, rng), but the training loop calls buffer.sample(batch), which raises TypeError.
Also applies to: 116-117
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@phases/09-reinforcement-learning/05-dqn/docs/tr.md` around lines 63 - 64,
Update the training loop’s ReplayBuffer.sample call to pass the required RNG
argument alongside batch, matching the sample(self, batch, rng) signature and
preventing the TypeError. Apply the same change to both call sites.
| ### 1. Adım: kullanıma sunma sırasında `log π_old(a | s)`'yi yakalayın | ||
|
|
||
| ```python | ||
| for step in range(T): | ||
| probs = softmax(logits(theta, state_features(s))) | ||
| a = sample(probs, rng) | ||
| s_next, r, done = env.step(s, a) | ||
| buffer.append({ | ||
| "s": s, "a": a, "r": r, "done": done, | ||
| "v_old": value(w, state_features(s)), | ||
| "log_pi_old": log(probs[a] + 1e-12), | ||
| }) | ||
| s = s_next | ||
| ``` |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Handle rollout initialization and episode termination.
The snippet starts collecting with an uninitialized s, and after done it continues stepping the same environment. Initialize s = env.reset() before the loop, reset on terminal transitions, and preserve the terminal mask for GAE/value-target computation.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@phases/09-reinforcement-learning/08-ppo/docs/tr.md` around lines 66 - 79,
Update the rollout loop around the `for step in range(T)` snippet to initialize
`s` from `env.reset()` before collection, and reset the environment after
terminal transitions instead of stepping the completed episode. Preserve the
transition’s `done` value in the buffer so GAE and value-target computation
retain the terminal mask.
| def chunk_text(text, chunk_size=200, overlap=50): | ||
| words = text.split() | ||
| chunks = [] | ||
| start = 0 | ||
| while start < len(words): | ||
| end = start + chunk_size | ||
| chunk = " ".join(words[start:end]) | ||
| chunks.append(chunk) | ||
| start += chunk_size - overlap | ||
| return chunks |
There was a problem hiding this comment.
🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win
Validate chunking parameters consistently across both lessons.
Both implementations can hang when overlap >= chunk_size because the loop index stops advancing.
phases/11-llm-engineering/04-embeddings/docs/tr.md#L229-L238: requirechunk_size > 0and0 <= overlap < chunk_size.phases/11-llm-engineering/06-rag/docs/tr.md#L191-L200: apply the same validation before calculating the step.
📍 Affects 2 files
phases/11-llm-engineering/04-embeddings/docs/tr.md#L229-L238(this comment)phases/11-llm-engineering/06-rag/docs/tr.md#L191-L200
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@phases/11-llm-engineering/04-embeddings/docs/tr.md` around lines 229 - 238,
The chunk_text implementations lack validation and can stop advancing when
overlap is greater than or equal to chunk_size. In
phases/11-llm-engineering/04-embeddings/docs/tr.md lines 229-238 and
phases/11-llm-engineering/06-rag/docs/tr.md lines 191-200, validate chunk_size >
0 and 0 <= overlap < chunk_size before calculating the loop step, while
preserving the existing chunking behavior for valid parameters.
| def calculator(expression, precision=2): | ||
| allowed = set("0123456789+-*/.() ") | ||
| if not all(c in allowed for c in expression): | ||
| return {"error": True, "message": f"Invalid characters in expression: {expression}"} | ||
| try: | ||
| result = eval(expression, {"__builtins__": {}}, {"math": math}) | ||
| return {"result": round(float(result), precision), "expression": expression} | ||
| except Exception as e: | ||
| return {"error": True, "message": str(e)} |
There was a problem hiding this comment.
🔒 Security & Privacy | 🔴 Critical | 🏗️ Heavy lift
Do not use eval for calculator input.
Character filtering does not prevent resource-exhaustion inputs such as enormous exponentiation or deeply nested expressions. Parse a restricted AST, enforce expression length/value limits, and evaluate only approved numeric nodes.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@phases/11-llm-engineering/09-function-calling/docs/tr.md` around lines 209 -
217, Replace eval in calculator with restricted AST parsing and evaluation of
only approved numeric and arithmetic nodes. Enforce maximum expression length,
nesting depth, and numeric/intermediate value limits before and during
evaluation, while preserving the existing result and error response shapes.
| def run_code(code, language="python"): | ||
| if language != "python": | ||
| return {"error": True, "message": f"Language '{language}' not supported. Only 'python' is available."} | ||
| forbidden = ["import os", "import sys", "import subprocess", "exec(", "eval(", "__import__", "open("] | ||
| for pattern in forbidden: | ||
| if pattern in code: | ||
| return {"error": True, "message": f"Forbidden operation: {pattern}", "code": "SECURITY_VIOLATION"} | ||
| try: | ||
| local_vars = {} | ||
| exec(code, {"__builtins__": {"print": print, "range": range, "len": len, "str": str, "int": int, "float": float, "list": list, "dict": dict, "sum": sum, "min": min, "max": max, "abs": abs, "round": round, "sorted": sorted, "enumerate": enumerate, "zip": zip, "map": map, "filter": filter, "math": math}}, local_vars) | ||
| result = local_vars.get("result", None) | ||
| return {"success": True, "result": result, "variables": {k: str(v) for k, v in local_vars.items() if not k.startswith("_")}} | ||
| except Exception as e: | ||
| return {"error": True, "message": f"{type(e).__name__}: {e}"} |
There was a problem hiding this comment.
🔒 Security & Privacy | 🔴 Critical | 🏗️ Heavy lift
Remove exec from the advertised sandbox or isolate it out of process.
A denylist is not a Python sandbox: object introspection and unbounded CPU/memory usage can bypass these checks or exhaust the host. Since this tool executes model-generated code, use a separately isolated worker/container with OS-level resource limits, or remove the code-execution tool from the example.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@phases/11-llm-engineering/09-function-calling/docs/tr.md` around lines 286 -
299, The run_code function advertises an unsafe in-process exec-based sandbox;
remove this code-execution example/tool, or replace its execution path with a
separately isolated worker or container enforcing OS-level CPU, memory, and
execution limits. Do not retain in-process exec with denylist filtering as the
security boundary.
| def get(self, query): | ||
| query_embedding = simple_embed(query) | ||
| now = time.time() | ||
| best_match = None | ||
| best_sim = 0.0 | ||
| for entry in self.entries: | ||
| if now - entry["timestamp"] > self.ttl: | ||
| continue | ||
| sim = cosine_similarity(query_embedding, entry["embedding"]) | ||
| if sim > best_sim: | ||
| best_sim = sim | ||
| best_match = entry | ||
| if best_match and best_sim >= self.threshold: | ||
| self.hits += 1 | ||
| best_match["access_count"] += 1 | ||
| return {"response": best_match["response"], "similarity": round(best_sim, 4), "original_query": best_match["query"]} |
There was a problem hiding this comment.
🔒 Security & Privacy | 🔴 Critical | 🏗️ Heavy lift
Isolate semantic-cache entries by tenant and authorization context.
A shared cache keyed only by query can return one user’s or tenant’s response to another user. Include authorization scope, tenant, locale, model, and relevant document/version context, or restrict this cache to public, identical responses.
Also applies to: 363-373
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@phases/11-llm-engineering/11-caching-cost/docs/tr.md` around lines 344 - 359,
Update the semantic-cache get flow and its corresponding set/store path to scope
entries by tenant, authorization context, locale, model, and relevant
document/version context before comparing embeddings. Ensure cache hits only
return responses valid for the current request, or restrict matching to public
identical responses; preserve the existing TTL, similarity threshold, and
hit-count behavior.
…decoding): localize quiz
Summary
Verification
python3 -m unittest scripts.tests.test_localize_curriculum -v(6 passed)python3 scripts/audit_lessons.py(503 lessons, 0 issues)python3 scripts/localize_curriculum.py check(523 sources, no errors)