Repository navigation
docs: stop the custom LLM example at the earliest stop word - #8806
Felix Shi (shi-felix) wants to merge 3 commits into
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Strix Security ReviewWarning This pull request has 117 commits after the last Strix review ( ✅ No open security findings. PR summary: The PR fixes the manual stop-word example in the custom LLM documentation (English and Korean) so it truncates at the earliest matching stop word and strips surrounding whitespace, matching `BaseLLM._apply_stop_words`, and adds tests that pin the documented behaviour. Review summaryThis PR is documentation-only in substance: it corrects the manual stop-word truncation example in the English and Korean custom-LLM guides so the cut happens at the earliest matching stop word (matching Review 1 on this PR · Reviewed by Strix |
Summary
The manual stop-word example in the custom LLM guide cut at the first entry in
self.stopthat appeared in the response, not at the earliest match. Reordering the stop list therefore changed the output, and it disagreed withBaseLLM._apply_stop_words, which the same guide points readers toward.Fixes #8002.
Changes
docs/edge/en/learn/custom-llm.mdx: the example now collects the match positions and cuts at the smallest one, then.strip()s — the same behaviour asBaseLLM._apply_stop_words. A short paragraph says why the order no longer matters and why the whitespace is trimmed.docs/edge/ko/learn/custom-llm.mdx: the same change in the Korean guide.lib/crewai/tests/test_custom_llm.py: aManualStopWordLLMthat mirrors the documented snippet, plus the runnable check the issue asks for — both stop-list orders and a response with no match.docs/edge/ar/learn/custom-llm.mdxhas no stop-word section in this checkout (its translation stops before "Required Methods"), anddocs/edge/pt-BR/learn/custom-llm.mdxcarries# (não traduzir blocos de código)placeholders where the code blocks should be, so there is no matching guidance to update in those two locales. I left them alone rather than adding a section the translators have not reached yet.Testing
Both stop-list orders now agree, and the old snippet disagreed:
Python 3.13.14 on Windows, no model calls and no credentials.
AI assistance
Written with AI assistance (WorkBuddy) and reviewed before submission.
Note
Low Risk
Documentation and test-only changes; no runtime LLM or agent behavior is modified in this PR.
Overview
Fixes the custom LLM guide’s manual stop-word snippet so it matches
BaseLLM._apply_stop_words: it now finds all stop-word positions, truncates at the earliest match (not the first list entry that appears), and **.strip()**s the result.English and Korean
custom-llm.mdxpages get the updated code plus a short note that stop-list order no longer affects output.test_custom_llm.pyadds aManualStopWordLLMcopy of the documented logic and tests for both stop-list orderings and responses with no matches, so the guide and tests stay aligned (fixes #8002).Reviewed by Cursor Bugbot for commit 98065ae. Bugbot is set up for automated code reviews on this repo. Configure here.